generated from FabricMC/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #22
- Loading branch information
Showing
11 changed files
with
129 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/de/rubixdev/enchantedshulkers/enchantment/VacuumEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package de.rubixdev.enchantedshulkers.enchantment; | ||
|
||
import de.rubixdev.enchantedshulkers.Mod; | ||
import de.rubixdev.enchantedshulkers.Utils; | ||
import de.rubixdev.enchantedshulkers.config.WorldConfig; | ||
import net.minecraft.enchantment.Enchantment; | ||
import net.minecraft.entity.EquipmentSlot; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.collection.DefaultedList; | ||
|
||
import java.util.List; | ||
|
||
public class VacuumEnchantment extends Enchantment { | ||
public VacuumEnchantment() { | ||
super(Rarity.RARE, Mod.PORTABLE_CONTAINER_TARGET, new EquipmentSlot[] { | ||
EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND | ||
}); | ||
} | ||
|
||
@Override | ||
public int getMinPower(int level) { | ||
return level * 25; | ||
} | ||
|
||
@Override | ||
public int getMaxPower(int level) { | ||
return getMinPower(level) + 50; | ||
} | ||
|
||
@Override | ||
public boolean isTreasure() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isAvailableForEnchantedBookOffer() { | ||
return WorldConfig.generateVacuum(); | ||
} | ||
|
||
@Override | ||
public boolean isAvailableForRandomSelection() { | ||
return WorldConfig.generateVacuum(); | ||
} | ||
|
||
public static boolean onItemPickup(ServerPlayerEntity player, ItemStack stack) { | ||
if (player.isCreative() && !WorldConfig.creativeVacuum()) return false; | ||
return SiphonEnchantment.onItemPickup(player, stack, Mod.VACUUM_ENCHANTMENT, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters