mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Fix formatting
This commit is contained in:
1 parent
123b750d24
commit
2399745ff1
3 files changed
+38
-27
No files matched your search
@@ -67,7 +67,7 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
|
||||
|
||||
World world = getWorld();
|
||||
if (!world.isRemote && redstoneSignal == 0 && ticksExisted % 100 == 0
|
||||
&& getMana() >= COST && world.getDifficulty() != Difficulty.PEACEFUL) {
|
||||
&& getMana() >= COST && world.getDifficulty() != Difficulty.PEACEFUL) {
|
||||
Random rand = world.rand;
|
||||
|
||||
ItemStack stack;
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.core.loot;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -12,40 +21,42 @@ import net.minecraftforge.common.loot.LootModifier;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumPick;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static vazkii.botania.common.lib.ResourceLocationHelper.prefix;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class DisposeModifier extends LootModifier {
|
||||
protected DisposeModifier(ILootCondition[] conditions) {
|
||||
super(conditions);
|
||||
}
|
||||
protected DisposeModifier(ILootCondition[] conditions) {
|
||||
super(conditions);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void register(RegistryEvent.Register<GlobalLootModifierSerializer<?>> evt) {
|
||||
evt.getRegistry().register(new Serializer().setRegistryName(prefix("dispose")));
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void register(RegistryEvent.Register<GlobalLootModifierSerializer<?>> evt) {
|
||||
evt.getRegistry().register(new Serializer().setRegistryName(prefix("dispose")));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) {
|
||||
Entity e = context.get(LootParameters.THIS_ENTITY);
|
||||
ItemStack tool = context.get(LootParameters.TOOL);
|
||||
if (e != null && tool != null && !tool.isEmpty()) {
|
||||
ItemElementiumPick.filterDisposable(generatedLoot, e, tool);
|
||||
}
|
||||
return generatedLoot;
|
||||
}
|
||||
|
||||
public static class Serializer extends GlobalLootModifierSerializer<DisposeModifier> {
|
||||
@Override
|
||||
protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) {
|
||||
Entity e = context.get(LootParameters.THIS_ENTITY);
|
||||
ItemStack tool = context.get(LootParameters.TOOL);
|
||||
if (e != null && tool != null && !tool.isEmpty()) {
|
||||
ItemElementiumPick.filterDisposable(generatedLoot, e, tool);
|
||||
}
|
||||
return generatedLoot;
|
||||
}
|
||||
|
||||
public static class Serializer extends GlobalLootModifierSerializer<DisposeModifier> {
|
||||
@Override
|
||||
public DisposeModifier read(ResourceLocation location, JsonObject object, ILootCondition[] conditions) {
|
||||
return new DisposeModifier(conditions);
|
||||
}
|
||||
public DisposeModifier read(ResourceLocation location, JsonObject object, ILootCondition[] conditions) {
|
||||
return new DisposeModifier(conditions);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -29,10 +29,10 @@ public class ItemElementiumPick extends ItemManasteelPick {
|
||||
}
|
||||
|
||||
public static void filterDisposable(List<ItemStack> drops, Entity e, ItemStack stack) {
|
||||
if (!stack.isEmpty() && (stack.getItem() == ModItems.elementiumPick
|
||||
|| stack.getItem() == ModItems.terraPick && ItemTerraPick.isTipped(stack))) {
|
||||
drops.removeIf(s -> !s.isEmpty() && (isDisposable(s) || isSemiDisposable(s) && !e.isSneaking()));
|
||||
}
|
||||
if (!stack.isEmpty() && (stack.getItem() == ModItems.elementiumPick
|
||||
|| stack.getItem() == ModItems.terraPick && ItemTerraPick.isTipped(stack))) {
|
||||
drops.removeIf(s -> !s.isEmpty() && (isDisposable(s) || isSemiDisposable(s) && !e.isSneaking()));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDisposable(Block block) {
|
||||
|
||||
Reference in new issue
Block a user