From 2066bc61a9c2a742655ca511260c8af966e7b31c Mon Sep 17 00:00:00 2001 From: Hubry Date: Wed, 11 Mar 2020 02:13:03 +0100 Subject: [PATCH] Normalize java line endings on crlf This should fix the build? --- .gitattributes | 1 + .../api/capability/FloatingFlowerImpl.java | 64 +-- .../botania/api/corporea/CorporeaRequest.java | 46 +- .../api/corporea/IWrappedInventory.java | 108 ++-- .../api/item/AccessoryRenderHelper.java | 168 +++--- .../client/core/handler/LayerTerraHelmet.java | 70 +-- .../botania/client/render/tile/TEISR.java | 86 +-- .../botania/common/block/ModSubtiles.java | 516 +++++++++--------- .../corporea/WrappedIInventory.java | 156 +++--- .../corporea/WrappedInventoryBase.java | 100 ++-- .../common/lib/ResourceLocationHelper.java | 34 +- .../botania/common/network/PacketItemAge.java | 96 ++-- 12 files changed, 723 insertions(+), 722 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..de1936db8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* .java eol=crlf \ No newline at end of file diff --git a/src/main/java/vazkii/botania/api/capability/FloatingFlowerImpl.java b/src/main/java/vazkii/botania/api/capability/FloatingFlowerImpl.java index d587e98e6..7033fb554 100644 --- a/src/main/java/vazkii/botania/api/capability/FloatingFlowerImpl.java +++ b/src/main/java/vazkii/botania/api/capability/FloatingFlowerImpl.java @@ -1,32 +1,32 @@ -/* - * 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.api.capability; - -import net.minecraft.item.ItemStack; - -import vazkii.botania.api.item.IFloatingFlower; - -public class FloatingFlowerImpl implements IFloatingFlower { - private IslandType type = IslandType.GRASS; - - @Override - public ItemStack getDisplayStack() { - return ItemStack.EMPTY; - } - - @Override - public IslandType getIslandType() { - return type; - } - - @Override - public void setIslandType(IslandType type) { - this.type = type; - } -} +/* + * 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.api.capability; + +import net.minecraft.item.ItemStack; + +import vazkii.botania.api.item.IFloatingFlower; + +public class FloatingFlowerImpl implements IFloatingFlower { + private IslandType type = IslandType.GRASS; + + @Override + public ItemStack getDisplayStack() { + return ItemStack.EMPTY; + } + + @Override + public IslandType getIslandType() { + return type; + } + + @Override + public void setIslandType(IslandType type) { + this.type = type; + } +} diff --git a/src/main/java/vazkii/botania/api/corporea/CorporeaRequest.java b/src/main/java/vazkii/botania/api/corporea/CorporeaRequest.java index 602f8a96a..b21f4b959 100644 --- a/src/main/java/vazkii/botania/api/corporea/CorporeaRequest.java +++ b/src/main/java/vazkii/botania/api/corporea/CorporeaRequest.java @@ -1,23 +1,23 @@ -/* - * 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.api.corporea; - -public class CorporeaRequest { - public final ICorporeaRequestMatcher matcher; - public int count; - public int foundItems = 0; - public int extractedItems = 0; - - public CorporeaRequest(ICorporeaRequestMatcher matcher, int count) { - super(); - this.matcher = matcher; - this.count = count; - } - -} +/* + * 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.api.corporea; + +public class CorporeaRequest { + public final ICorporeaRequestMatcher matcher; + public int count; + public int foundItems = 0; + public int extractedItems = 0; + + public CorporeaRequest(ICorporeaRequestMatcher matcher, int count) { + super(); + this.matcher = matcher; + this.count = count; + } + +} diff --git a/src/main/java/vazkii/botania/api/corporea/IWrappedInventory.java b/src/main/java/vazkii/botania/api/corporea/IWrappedInventory.java index 8844775c2..adae7546a 100644 --- a/src/main/java/vazkii/botania/api/corporea/IWrappedInventory.java +++ b/src/main/java/vazkii/botania/api/corporea/IWrappedInventory.java @@ -1,54 +1,54 @@ -/* - * 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.api.corporea; - -import net.minecraft.item.ItemStack; - -import java.util.List; - -/** - * This interface wraps IInventory corporea works with in order to provide - * compatibility with different storage mods. - */ -public interface IWrappedInventory { - - /** - * Break encapsulation and exposes original inventory. - */ - InvWithLocation getWrappedObject(); - - /** - * Counts items in the inventory matching the request - * - * @param request - * - specifies what should be found - * @return List of ItemStack, individual stacks may exceed maxStackSize for - * purposes of counting huge amounts. To get final count requestor - * should sum stackSize of all stacks. - */ - List countItems(CorporeaRequest request); - - /** - * Convenience method for accessing spark over inventory - */ - ICorporeaSpark getSpark(); - - /** - * Extracts items matching request from the inventory.
- * {@link CorporeaRequest#count} is updated to reflect how many items are - * yet to be extracted.
- * {@link CorporeaRequest#foundItems} and - * {@link CorporeaRequest#extractedItems} are updated to reflect how many - * items were found and extracted. - * - * @param request - * @return List of ItemStacks to be delivered to the destination. - */ - List extractItems(CorporeaRequest request); -} +/* + * 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.api.corporea; + +import net.minecraft.item.ItemStack; + +import java.util.List; + +/** + * This interface wraps IInventory corporea works with in order to provide + * compatibility with different storage mods. + */ +public interface IWrappedInventory { + + /** + * Break encapsulation and exposes original inventory. + */ + InvWithLocation getWrappedObject(); + + /** + * Counts items in the inventory matching the request + * + * @param request + * - specifies what should be found + * @return List of ItemStack, individual stacks may exceed maxStackSize for + * purposes of counting huge amounts. To get final count requestor + * should sum stackSize of all stacks. + */ + List countItems(CorporeaRequest request); + + /** + * Convenience method for accessing spark over inventory + */ + ICorporeaSpark getSpark(); + + /** + * Extracts items matching request from the inventory.
+ * {@link CorporeaRequest#count} is updated to reflect how many items are + * yet to be extracted.
+ * {@link CorporeaRequest#foundItems} and + * {@link CorporeaRequest#extractedItems} are updated to reflect how many + * items were found and extracted. + * + * @param request + * @return List of ItemStacks to be delivered to the destination. + */ + List extractItems(CorporeaRequest request); +} diff --git a/src/main/java/vazkii/botania/api/item/AccessoryRenderHelper.java b/src/main/java/vazkii/botania/api/item/AccessoryRenderHelper.java index 1ac6a8762..d262aabc4 100644 --- a/src/main/java/vazkii/botania/api/item/AccessoryRenderHelper.java +++ b/src/main/java/vazkii/botania/api/item/AccessoryRenderHelper.java @@ -1,84 +1,84 @@ -/* - * 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.api.item; - -import com.mojang.blaze3d.matrix.MatrixStack; - -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.entity.LivingEntity; - -/** - * A few helper methods for the render. - */ -public final class AccessoryRenderHelper { - - /** - * Rotates the render for a bauble correctly if the player is sneaking. - */ - public static void rotateIfSneaking(MatrixStack ms, LivingEntity player) { - if (player.isCrouching()) { - applySneakingRotation(ms); - } - } - - /** - * Rotates the render for a bauble correctly for a sneaking player. - */ - public static void applySneakingRotation(MatrixStack ms) { - ms.translate(0F, 0.2F, 0F); - ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90F / (float) Math.PI)); - } - - /** - * Shifts the render for a bauble correctly to the head, including sneaking rotation. - */ - public static void translateToHeadLevel(MatrixStack ms, LivingEntity player, float partialTicks) { - - float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; - float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; - float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; - - ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-yawOffset)); - ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(yaw - 270)); - ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(pitch)); - - ms.translate(0, -player.getEyeHeight(), 0); -// if (player.shouldRenderSneaking()) TODO Sneaking needs a different adjustment now -// GlStateManager.translatef(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F); - } - - /** - * Shifts the render for a bauble correctly to the face. - * Use for renders after calling {@link AccessoryRenderHelper#translateToHeadLevel}. - */ - public static void translateToFace(MatrixStack ms) { - ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90)); - ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180)); - ms.translate(0f, -4.35f, -1.27f); - } - - /** - * Scales down the render to a correct size. - * Use for any render. - */ - public static void defaultTransforms(MatrixStack ms) { - ms.translate(0.0, 3.0, 1.0); - ms.scale(0.55F, 0.55F, 0.55F); - } - - /** - * Shifts the render for a bauble correctly to the chest. - * Use for renders after calling {@link AccessoryRenderHelper#rotateIfSneaking}. - */ - public static void translateToChest(MatrixStack ms) { - ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180)); - ms.translate(0F, -3.2F, -0.85F); - } - -} +/* + * 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.api.item; + +import com.mojang.blaze3d.matrix.MatrixStack; + +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.entity.LivingEntity; + +/** + * A few helper methods for the render. + */ +public final class AccessoryRenderHelper { + + /** + * Rotates the render for a bauble correctly if the player is sneaking. + */ + public static void rotateIfSneaking(MatrixStack ms, LivingEntity player) { + if (player.isCrouching()) { + applySneakingRotation(ms); + } + } + + /** + * Rotates the render for a bauble correctly for a sneaking player. + */ + public static void applySneakingRotation(MatrixStack ms) { + ms.translate(0F, 0.2F, 0F); + ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90F / (float) Math.PI)); + } + + /** + * Shifts the render for a bauble correctly to the head, including sneaking rotation. + */ + public static void translateToHeadLevel(MatrixStack ms, LivingEntity player, float partialTicks) { + + float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; + float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; + float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; + + ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-yawOffset)); + ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(yaw - 270)); + ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(pitch)); + + ms.translate(0, -player.getEyeHeight(), 0); +// if (player.shouldRenderSneaking()) TODO Sneaking needs a different adjustment now +// GlStateManager.translatef(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F); + } + + /** + * Shifts the render for a bauble correctly to the face. + * Use for renders after calling {@link AccessoryRenderHelper#translateToHeadLevel}. + */ + public static void translateToFace(MatrixStack ms) { + ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90)); + ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180)); + ms.translate(0f, -4.35f, -1.27f); + } + + /** + * Scales down the render to a correct size. + * Use for any render. + */ + public static void defaultTransforms(MatrixStack ms) { + ms.translate(0.0, 3.0, 1.0); + ms.scale(0.55F, 0.55F, 0.55F); + } + + /** + * Shifts the render for a bauble correctly to the chest. + * Use for renders after calling {@link AccessoryRenderHelper#rotateIfSneaking}. + */ + public static void translateToChest(MatrixStack ms) { + ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(180)); + ms.translate(0F, -3.2F, -0.85F); + } + +} diff --git a/src/main/java/vazkii/botania/client/core/handler/LayerTerraHelmet.java b/src/main/java/vazkii/botania/client/core/handler/LayerTerraHelmet.java index 2d617a769..6b0591d36 100644 --- a/src/main/java/vazkii/botania/client/core/handler/LayerTerraHelmet.java +++ b/src/main/java/vazkii/botania/client/core/handler/LayerTerraHelmet.java @@ -1,35 +1,35 @@ -/* - * 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.client.core.handler; - -import com.mojang.blaze3d.matrix.MatrixStack; - -import net.minecraft.client.entity.player.AbstractClientPlayerEntity; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.entity.IEntityRenderer; -import net.minecraft.client.renderer.entity.layers.LayerRenderer; -import net.minecraft.client.renderer.entity.model.PlayerModel; -import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ItemStack; - -import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm; - -public class LayerTerraHelmet extends LayerRenderer> { - public LayerTerraHelmet(IEntityRenderer> renderer) { - super(renderer); - } - - @Override - public void render(MatrixStack ms, IRenderTypeBuffer buffers, int light, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { - ItemStack helm = player.getItemStackFromSlot(EquipmentSlotType.HEAD); - if (!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm) { - ItemTerrasteelHelm.renderOnPlayer(ms, buffers, light, helm, player, partialTicks); - } - } -} +/* + * 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.client.core.handler; + +import com.mojang.blaze3d.matrix.MatrixStack; + +import net.minecraft.client.entity.player.AbstractClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.entity.IEntityRenderer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.entity.model.PlayerModel; +import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.ItemStack; + +import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm; + +public class LayerTerraHelmet extends LayerRenderer> { + public LayerTerraHelmet(IEntityRenderer> renderer) { + super(renderer); + } + + @Override + public void render(MatrixStack ms, IRenderTypeBuffer buffers, int light, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + ItemStack helm = player.getItemStackFromSlot(EquipmentSlotType.HEAD); + if (!helm.isEmpty() && helm.getItem() instanceof ItemTerrasteelHelm) { + ItemTerrasteelHelm.renderOnPlayer(ms, buffers, light, helm, player, partialTicks); + } + } +} diff --git a/src/main/java/vazkii/botania/client/render/tile/TEISR.java b/src/main/java/vazkii/botania/client/render/tile/TEISR.java index 13d859b0f..1b958275e 100644 --- a/src/main/java/vazkii/botania/client/render/tile/TEISR.java +++ b/src/main/java/vazkii/botania/client/render/tile/TEISR.java @@ -1,43 +1,43 @@ -/* - * 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.client.render.tile; - -import com.google.common.base.Preconditions; -import com.mojang.blaze3d.matrix.MatrixStack; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.LazyValue; -import net.minecraft.util.registry.Registry; - -public class TEISR extends ItemStackTileEntityRenderer { - private final Block block; - private final LazyValue dummy; - - public TEISR(Block block) { - this.block = Preconditions.checkNotNull(block); - this.dummy = new LazyValue<>(() -> { - TileEntityType type = Registry.BLOCK_ENTITY_TYPE.getValue(block.getRegistryName()).get(); - return type.create(); - }); - } - - @Override - public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) { - if (stack.getItem() == block.asItem()) { - TileEntityRendererDispatcher.instance.getRenderer(dummy.getValue()) - .render(null, 0, ms, buffers, light, overlay); - } - } -} +/* + * 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.client.render.tile; + +import com.google.common.base.Preconditions; +import com.mojang.blaze3d.matrix.MatrixStack; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.LazyValue; +import net.minecraft.util.registry.Registry; + +public class TEISR extends ItemStackTileEntityRenderer { + private final Block block; + private final LazyValue dummy; + + public TEISR(Block block) { + this.block = Preconditions.checkNotNull(block); + this.dummy = new LazyValue<>(() -> { + TileEntityType type = Registry.BLOCK_ENTITY_TYPE.getValue(block.getRegistryName()).get(); + return type.create(); + }); + } + + @Override + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) { + if (stack.getItem() == block.asItem()) { + TileEntityRendererDispatcher.instance.getRenderer(dummy.getValue()) + .render(null, 0, ms, buffers, light, overlay); + } + } +} diff --git a/src/main/java/vazkii/botania/common/block/ModSubtiles.java b/src/main/java/vazkii/botania/common/block/ModSubtiles.java index 07a485193..8d9a8ac66 100644 --- a/src/main/java/vazkii/botania/common/block/ModSubtiles.java +++ b/src/main/java/vazkii/botania/common/block/ModSubtiles.java @@ -1,258 +1,258 @@ -/* - * 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.block; - -import com.google.common.collect.ImmutableList; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.ObjectHolder; - -import vazkii.botania.api.subtile.TileEntitySpecialFlower; -import vazkii.botania.common.block.subtile.SubTileManastar; -import vazkii.botania.common.block.subtile.SubTilePureDaisy; -import vazkii.botania.common.block.subtile.functional.*; -import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose; -import vazkii.botania.common.block.subtile.generating.SubTileDandelifeon; -import vazkii.botania.common.block.subtile.generating.SubTileEndoflame; -import vazkii.botania.common.block.subtile.generating.SubTileEntropinnyum; -import vazkii.botania.common.block.subtile.generating.SubTileGourmaryllis; -import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas; -import vazkii.botania.common.block.subtile.generating.SubTileKekimurus; -import vazkii.botania.common.block.subtile.generating.SubTileMunchdew; -import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus; -import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia; -import vazkii.botania.common.block.subtile.generating.SubTileShulkMeNot; -import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus; -import vazkii.botania.common.block.subtile.generating.SubTileThermalily; -import vazkii.botania.common.item.ModItems; -import vazkii.botania.common.item.block.ItemBlockSpecialFlower; -import vazkii.botania.common.lib.LibBlockNames; -import vazkii.botania.common.lib.LibMisc; - -import java.util.List; -import java.util.function.Supplier; - -import static vazkii.botania.common.block.ModBlocks.register; - -@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) -@ObjectHolder(LibMisc.MOD_ID) -public class ModSubtiles { - @ObjectHolder("pure_daisy") public static Block pureDaisy; - @ObjectHolder("manastar") public static Block manastar; - @ObjectHolder("hydroangeas") public static Block hydroangeas; - @ObjectHolder("endoflame") public static Block endoflame; - @ObjectHolder("thermalily") public static Block thermalily; - @ObjectHolder("rosa_arcana") public static Block rosaArcana; - @ObjectHolder("munchdew") public static Block munchdew; - @ObjectHolder("entropinnyum") public static Block entropinnyum; - @ObjectHolder("kekimurus") public static Block kekimurus; - @ObjectHolder("gourmaryllis") public static Block gourmaryllis; - @ObjectHolder("narslimmus") public static Block narslimmus; - @ObjectHolder("spectrolus") public static Block spectrolus; - @ObjectHolder("dandelifeon") public static Block dandelifeon; - @ObjectHolder("rafflowsia") public static Block rafflowsia; - @ObjectHolder("shulk_me_not") public static Block shulkMeNot; - @ObjectHolder("bellethorn") public static Block bellethorn; - @ObjectHolder("bellethorn_chibi") public static Block bellethornChibi; - @ObjectHolder("bergamute") public static Block bergamute; - @ObjectHolder("dreadthorn") public static Block dreadthorn; - @ObjectHolder("heisei_dream") public static Block heiseiDream; - @ObjectHolder("tigerseye") public static Block tigerseye; - @ObjectHolder("jaded_amaranthus") public static Block jadedAmaranthus; - @ObjectHolder("orechid") public static Block orechid; - @ObjectHolder("fallen_kanade") public static Block fallenKanade; - @ObjectHolder("exoflame") public static Block exoflame; - @ObjectHolder("agricarnation") public static Block agricarnation; - @ObjectHolder("agricarnation_chibi") public static Block agricarnationChibi; - @ObjectHolder("hopperhock") public static Block hopperhock; - @ObjectHolder("hopperhock_chibi") public static Block hopperhockChibi; - @ObjectHolder("tangleberrie") public static Block tangleberrie; - @ObjectHolder("jiyuulia") public static Block jiyuulia; - @ObjectHolder("rannuncarpus") public static Block rannuncarpus; - @ObjectHolder("rannuncarpus_chibi") public static Block rannuncarpusChibi; - @ObjectHolder("hyacidus") public static Block hyacidus; - @ObjectHolder("pollidisiac") public static Block pollidisiac; - @ObjectHolder("clayconia") public static Block clayconia; - @ObjectHolder("clayconia_chibi") public static Block clayconiaChibi; - @ObjectHolder("loonium") public static Block loonium; - @ObjectHolder("daffomill") public static Block daffomill; - @ObjectHolder("vinculotus") public static Block vinculotus; - @ObjectHolder("spectranthemum") public static Block spectranthemum; - @ObjectHolder("medumone") public static Block medumone; - @ObjectHolder("marimorphosis") public static Block marimorphosis; - @ObjectHolder("marimorphosis_chibi") public static Block marimorphosisChibi; - @ObjectHolder("bubbell") public static Block bubbell; - @ObjectHolder("bubbell_chibi") public static Block bubbellChibi; - @ObjectHolder("solegnolia") public static Block solegnolia; - @ObjectHolder("solegnolia_chibi") public static Block solegnoliaChibi; - @ObjectHolder("orechid_ignem") public static Block orechidIgnem; - - @ObjectHolder("floating_pure_daisy") public static Block pureDaisyFloating; - @ObjectHolder("floating_manastar") public static Block manastarFloating; - @ObjectHolder("floating_hydroangeas") public static Block hydroangeasFloating; - @ObjectHolder("floating_endoflame") public static Block endoflameFloating; - @ObjectHolder("floating_thermalily") public static Block thermalilyFloating; - @ObjectHolder("floating_rosa_arcana") public static Block rosaArcanaFloating; - @ObjectHolder("floating_munchdew") public static Block munchdewFloating; - @ObjectHolder("floating_entropinnyum") public static Block entropinnyumFloating; - @ObjectHolder("floating_kekimurus") public static Block kekimurusFloating; - @ObjectHolder("floating_gourmaryllis") public static Block gourmaryllisFloating; - @ObjectHolder("floating_narslimmus") public static Block narslimmusFloating; - @ObjectHolder("floating_spectrolus") public static Block spectrolusFloating; - @ObjectHolder("floating_dandelifeon") public static Block dandelifeonFloating; - @ObjectHolder("floating_rafflowsia") public static Block rafflowsiaFloating; - @ObjectHolder("floating_shulk_me_not") public static Block shulkMeNotFloating; - @ObjectHolder("floating_bellethorn") public static Block bellethornFloating; - @ObjectHolder("floating_bellethorn_chibi") public static Block bellethornChibiFloating; - @ObjectHolder("floating_bergamute") public static Block bergamuteFloating; - @ObjectHolder("floating_dreadthorn") public static Block dreadthornFloating; - @ObjectHolder("floating_heisei_dream") public static Block heiseiDreamFloating; - @ObjectHolder("floating_tigerseye") public static Block tigerseyeFloating; - @ObjectHolder("floating_jaded_amaranthus") public static Block jadedAmaranthusFloating; - @ObjectHolder("floating_orechid") public static Block orechidFloating; - @ObjectHolder("floating_fallen_kanade") public static Block fallenKanadeFloating; - @ObjectHolder("floating_exoflame") public static Block exoflameFloating; - @ObjectHolder("floating_agricarnation") public static Block agricarnationFloating; - @ObjectHolder("floating_agricarnation_chibi") public static Block agricarnationChibiFloating; - @ObjectHolder("floating_hopperhock") public static Block hopperhockFloating; - @ObjectHolder("floating_hopperhock_chibi") public static Block hopperhockChibiFloating; - @ObjectHolder("floating_tangleberrie") public static Block tangleberrieFloating; - @ObjectHolder("floating_jiyuulia") public static Block jiyuuliaFloating; - @ObjectHolder("floating_rannuncarpus") public static Block rannuncarpusFloating; - @ObjectHolder("floating_rannuncarpus_chibi") public static Block rannuncarpusChibiFloating; - @ObjectHolder("floating_hyacidus") public static Block hyacidusFloating; - @ObjectHolder("floating_pollidisiac") public static Block pollidisiacFloating; - @ObjectHolder("floating_clayconia") public static Block clayconiaFloating; - @ObjectHolder("floating_clayconia_chibi") public static Block clayconiaChibiFloating; - @ObjectHolder("floating_loonium") public static Block looniumFloating; - @ObjectHolder("floating_daffomill") public static Block daffomillFloating; - @ObjectHolder("floating_vinculotus") public static Block vinculotusFloating; - @ObjectHolder("floating_spectranthemum") public static Block spectranthemumFloating; - @ObjectHolder("floating_medumone") public static Block medumoneFloating; - @ObjectHolder("floating_marimorphosis") public static Block marimorphosisFloating; - @ObjectHolder("floating_marimorphosis_chibi") public static Block marimorphosisChibiFloating; - @ObjectHolder("floating_bubbell") public static Block bubbellFloating; - @ObjectHolder("floating_bubbell_chibi") public static Block bubbellChibiFloating; - @ObjectHolder("floating_solegnolia") public static Block solegnoliaFloating; - @ObjectHolder("floating_solegnolia_chibi") public static Block solegnoliaChibiFloating; - @ObjectHolder("floating_orechid_ignem") public static Block orechidIgnemFloating; - - private static ResourceLocation floating(ResourceLocation orig) { - return new ResourceLocation(orig.getNamespace(), "floating_" + orig.getPath()); - } - - private static ResourceLocation chibi(ResourceLocation orig) { - return new ResourceLocation(orig.getNamespace(), orig.getPath() + "_chibi"); - } - - public static List, ResourceLocation>> getTypes() { - return ImmutableList.of( - Pair.of(SubTilePureDaisy::new, LibBlockNames.SUBTILE_PUREDAISY), - Pair.of(SubTileManastar::new, LibBlockNames.SUBTILE_MANASTAR), - Pair.of(SubTileEndoflame::new, LibBlockNames.SUBTILE_ENDOFLAME), - Pair.of(SubTileHydroangeas::new, LibBlockNames.SUBTILE_HYDROANGEAS), - Pair.of(SubTileThermalily::new, LibBlockNames.SUBTILE_THERMALILY), - Pair.of(SubTileArcaneRose::new, LibBlockNames.SUBTILE_ARCANE_ROSE), - Pair.of(SubTileMunchdew::new, LibBlockNames.SUBTILE_MUNCHDEW), - Pair.of(SubTileEntropinnyum::new, LibBlockNames.SUBTILE_ENTROPINNYUM), - Pair.of(SubTileKekimurus::new, LibBlockNames.SUBTILE_KEKIMURUS), - Pair.of(SubTileGourmaryllis::new, LibBlockNames.SUBTILE_GOURMARYLLIS), - Pair.of(SubTileNarslimmus::new, LibBlockNames.SUBTILE_NARSLIMMUS), - Pair.of(SubTileSpectrolus::new, LibBlockNames.SUBTILE_SPECTROLUS), - Pair.of(SubTileDandelifeon::new, LibBlockNames.SUBTILE_DANDELIFEON), - Pair.of(SubTileRafflowsia::new, LibBlockNames.SUBTILE_RAFFLOWSIA), - Pair.of(SubTileShulkMeNot::new, LibBlockNames.SUBTILE_SHULK_ME_NOT), - Pair.of(SubTileBellethorn::new, LibBlockNames.SUBTILE_BELLETHORN), - Pair.of(SubTileBellethorn.Mini::new, chibi(LibBlockNames.SUBTILE_BELLETHORN)), - Pair.of(SubTileBergamute::new, LibBlockNames.SUBTILE_BERGAMUTE), - Pair.of(SubTileDreadthorn::new, LibBlockNames.SUBTILE_DREADTHORN), - Pair.of(SubTileHeiseiDream::new, LibBlockNames.SUBTILE_HEISEI_DREAM), - Pair.of(SubTileTigerseye::new, LibBlockNames.SUBTILE_TIGERSEYE), - Pair.of(SubTileJadedAmaranthus::new, LibBlockNames.SUBTILE_JADED_AMARANTHUS), - Pair.of(SubTileOrechid::new, LibBlockNames.SUBTILE_ORECHID), - Pair.of(SubTileFallenKanade::new, LibBlockNames.SUBTILE_FALLEN_KANADE), - Pair.of(SubTileExoflame::new, LibBlockNames.SUBTILE_EXOFLAME), - Pair.of(SubTileAgricarnation::new, LibBlockNames.SUBTILE_AGRICARNATION), - Pair.of(SubTileAgricarnation.Mini::new, chibi(LibBlockNames.SUBTILE_AGRICARNATION)), - Pair.of(SubTileHopperhock::new, LibBlockNames.SUBTILE_HOPPERHOCK), - Pair.of(SubTileHopperhock.Mini::new, chibi(LibBlockNames.SUBTILE_HOPPERHOCK)), - Pair.of(SubTileTangleberrie::new, LibBlockNames.SUBTILE_TANGLEBERRIE), - Pair.of(SubTileJiyuulia::new, LibBlockNames.SUBTILE_JIYUULIA), - Pair.of(SubTileRannuncarpus::new, LibBlockNames.SUBTILE_RANNUNCARPUS), - Pair.of(SubTileRannuncarpus.Mini::new, chibi(LibBlockNames.SUBTILE_RANNUNCARPUS)), - Pair.of(SubTileHyacidus::new, LibBlockNames.SUBTILE_HYACIDUS), - Pair.of(SubTilePollidisiac::new, LibBlockNames.SUBTILE_POLLIDISIAC), - Pair.of(SubTileClayconia::new, LibBlockNames.SUBTILE_CLAYCONIA), - Pair.of(SubTileClayconia.Mini::new, chibi(LibBlockNames.SUBTILE_CLAYCONIA)), - Pair.of(SubTileLoonuim::new, LibBlockNames.SUBTILE_LOONIUM), - Pair.of(SubTileDaffomill::new, LibBlockNames.SUBTILE_DAFFOMILL), - Pair.of(SubTileVinculotus::new, LibBlockNames.SUBTILE_VINCULOTUS), - Pair.of(SubTileSpectranthemum::new, LibBlockNames.SUBTILE_SPECTRANTHEMUM), - Pair.of(SubTileMedumone::new, LibBlockNames.SUBTILE_MEDUMONE), - Pair.of(SubTileMarimorphosis::new, LibBlockNames.SUBTILE_MARIMORPHOSIS), - Pair.of(SubTileMarimorphosis.Mini::new, chibi(LibBlockNames.SUBTILE_MARIMORPHOSIS)), - Pair.of(SubTileBubbell::new, LibBlockNames.SUBTILE_BUBBELL), - Pair.of(SubTileBubbell.Mini::new, chibi(LibBlockNames.SUBTILE_BUBBELL)), - Pair.of(SubTileSolegnolia::new, LibBlockNames.SUBTILE_SOLEGNOLIA), - Pair.of(SubTileSolegnolia.Mini::new, chibi(LibBlockNames.SUBTILE_SOLEGNOLIA)), - Pair.of(SubTileOrechidIgnem::new, LibBlockNames.SUBTILE_ORECHID_IGNEM) - ); - } - - @SubscribeEvent - public static void registerBlocks(RegistryEvent.Register evt) { - IForgeRegistry r = evt.getRegistry(); - Block.Properties props = Block.Properties.from(Blocks.POPPY); - Block.Properties floatProps = Block.Properties.create(Material.EARTH).hardnessAndResistance(0.5F).sound(SoundType.GROUND).lightValue(15); - - for (Pair, ResourceLocation> type : getTypes()) { - register(r, new BlockSpecialFlower(props, type.getFirst()), type.getSecond()); - register(r, new BlockFloatingSpecialFlower(floatProps, type.getFirst()), floating(type.getSecond())); - } - } - - @SubscribeEvent - public static void registerItemBlocks(RegistryEvent.Register evt) { - IForgeRegistry b = ForgeRegistries.BLOCKS; - IForgeRegistry r = evt.getRegistry(); - Item.Properties props = ModItems.defaultBuilder(); - - for (Pair, ResourceLocation> type : getTypes()) { - Block block = b.getValue(type.getSecond()); - Block floating = b.getValue(floating(type.getSecond())); - - register(r, new ItemBlockSpecialFlower(block, props), type.getSecond()); - register(r, new ItemBlockSpecialFlower(floating, props), floating(type.getSecond())); - } - } - - @SubscribeEvent - public static void registerTEs(RegistryEvent.Register> evt) { - IForgeRegistry b = ForgeRegistries.BLOCKS; - IForgeRegistry> r = evt.getRegistry(); - - for (Pair, ResourceLocation> type : getTypes()) { - Block block = b.getValue(type.getSecond()); - Block floating = b.getValue(floating(type.getSecond())); - register(r, TileEntityType.Builder.create(type.getFirst(), block, floating).build(null), type.getSecond()); - } - } -} +/* + * 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.block; + +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.ObjectHolder; + +import vazkii.botania.api.subtile.TileEntitySpecialFlower; +import vazkii.botania.common.block.subtile.SubTileManastar; +import vazkii.botania.common.block.subtile.SubTilePureDaisy; +import vazkii.botania.common.block.subtile.functional.*; +import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose; +import vazkii.botania.common.block.subtile.generating.SubTileDandelifeon; +import vazkii.botania.common.block.subtile.generating.SubTileEndoflame; +import vazkii.botania.common.block.subtile.generating.SubTileEntropinnyum; +import vazkii.botania.common.block.subtile.generating.SubTileGourmaryllis; +import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas; +import vazkii.botania.common.block.subtile.generating.SubTileKekimurus; +import vazkii.botania.common.block.subtile.generating.SubTileMunchdew; +import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus; +import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia; +import vazkii.botania.common.block.subtile.generating.SubTileShulkMeNot; +import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus; +import vazkii.botania.common.block.subtile.generating.SubTileThermalily; +import vazkii.botania.common.item.ModItems; +import vazkii.botania.common.item.block.ItemBlockSpecialFlower; +import vazkii.botania.common.lib.LibBlockNames; +import vazkii.botania.common.lib.LibMisc; + +import java.util.List; +import java.util.function.Supplier; + +import static vazkii.botania.common.block.ModBlocks.register; + +@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +@ObjectHolder(LibMisc.MOD_ID) +public class ModSubtiles { + @ObjectHolder("pure_daisy") public static Block pureDaisy; + @ObjectHolder("manastar") public static Block manastar; + @ObjectHolder("hydroangeas") public static Block hydroangeas; + @ObjectHolder("endoflame") public static Block endoflame; + @ObjectHolder("thermalily") public static Block thermalily; + @ObjectHolder("rosa_arcana") public static Block rosaArcana; + @ObjectHolder("munchdew") public static Block munchdew; + @ObjectHolder("entropinnyum") public static Block entropinnyum; + @ObjectHolder("kekimurus") public static Block kekimurus; + @ObjectHolder("gourmaryllis") public static Block gourmaryllis; + @ObjectHolder("narslimmus") public static Block narslimmus; + @ObjectHolder("spectrolus") public static Block spectrolus; + @ObjectHolder("dandelifeon") public static Block dandelifeon; + @ObjectHolder("rafflowsia") public static Block rafflowsia; + @ObjectHolder("shulk_me_not") public static Block shulkMeNot; + @ObjectHolder("bellethorn") public static Block bellethorn; + @ObjectHolder("bellethorn_chibi") public static Block bellethornChibi; + @ObjectHolder("bergamute") public static Block bergamute; + @ObjectHolder("dreadthorn") public static Block dreadthorn; + @ObjectHolder("heisei_dream") public static Block heiseiDream; + @ObjectHolder("tigerseye") public static Block tigerseye; + @ObjectHolder("jaded_amaranthus") public static Block jadedAmaranthus; + @ObjectHolder("orechid") public static Block orechid; + @ObjectHolder("fallen_kanade") public static Block fallenKanade; + @ObjectHolder("exoflame") public static Block exoflame; + @ObjectHolder("agricarnation") public static Block agricarnation; + @ObjectHolder("agricarnation_chibi") public static Block agricarnationChibi; + @ObjectHolder("hopperhock") public static Block hopperhock; + @ObjectHolder("hopperhock_chibi") public static Block hopperhockChibi; + @ObjectHolder("tangleberrie") public static Block tangleberrie; + @ObjectHolder("jiyuulia") public static Block jiyuulia; + @ObjectHolder("rannuncarpus") public static Block rannuncarpus; + @ObjectHolder("rannuncarpus_chibi") public static Block rannuncarpusChibi; + @ObjectHolder("hyacidus") public static Block hyacidus; + @ObjectHolder("pollidisiac") public static Block pollidisiac; + @ObjectHolder("clayconia") public static Block clayconia; + @ObjectHolder("clayconia_chibi") public static Block clayconiaChibi; + @ObjectHolder("loonium") public static Block loonium; + @ObjectHolder("daffomill") public static Block daffomill; + @ObjectHolder("vinculotus") public static Block vinculotus; + @ObjectHolder("spectranthemum") public static Block spectranthemum; + @ObjectHolder("medumone") public static Block medumone; + @ObjectHolder("marimorphosis") public static Block marimorphosis; + @ObjectHolder("marimorphosis_chibi") public static Block marimorphosisChibi; + @ObjectHolder("bubbell") public static Block bubbell; + @ObjectHolder("bubbell_chibi") public static Block bubbellChibi; + @ObjectHolder("solegnolia") public static Block solegnolia; + @ObjectHolder("solegnolia_chibi") public static Block solegnoliaChibi; + @ObjectHolder("orechid_ignem") public static Block orechidIgnem; + + @ObjectHolder("floating_pure_daisy") public static Block pureDaisyFloating; + @ObjectHolder("floating_manastar") public static Block manastarFloating; + @ObjectHolder("floating_hydroangeas") public static Block hydroangeasFloating; + @ObjectHolder("floating_endoflame") public static Block endoflameFloating; + @ObjectHolder("floating_thermalily") public static Block thermalilyFloating; + @ObjectHolder("floating_rosa_arcana") public static Block rosaArcanaFloating; + @ObjectHolder("floating_munchdew") public static Block munchdewFloating; + @ObjectHolder("floating_entropinnyum") public static Block entropinnyumFloating; + @ObjectHolder("floating_kekimurus") public static Block kekimurusFloating; + @ObjectHolder("floating_gourmaryllis") public static Block gourmaryllisFloating; + @ObjectHolder("floating_narslimmus") public static Block narslimmusFloating; + @ObjectHolder("floating_spectrolus") public static Block spectrolusFloating; + @ObjectHolder("floating_dandelifeon") public static Block dandelifeonFloating; + @ObjectHolder("floating_rafflowsia") public static Block rafflowsiaFloating; + @ObjectHolder("floating_shulk_me_not") public static Block shulkMeNotFloating; + @ObjectHolder("floating_bellethorn") public static Block bellethornFloating; + @ObjectHolder("floating_bellethorn_chibi") public static Block bellethornChibiFloating; + @ObjectHolder("floating_bergamute") public static Block bergamuteFloating; + @ObjectHolder("floating_dreadthorn") public static Block dreadthornFloating; + @ObjectHolder("floating_heisei_dream") public static Block heiseiDreamFloating; + @ObjectHolder("floating_tigerseye") public static Block tigerseyeFloating; + @ObjectHolder("floating_jaded_amaranthus") public static Block jadedAmaranthusFloating; + @ObjectHolder("floating_orechid") public static Block orechidFloating; + @ObjectHolder("floating_fallen_kanade") public static Block fallenKanadeFloating; + @ObjectHolder("floating_exoflame") public static Block exoflameFloating; + @ObjectHolder("floating_agricarnation") public static Block agricarnationFloating; + @ObjectHolder("floating_agricarnation_chibi") public static Block agricarnationChibiFloating; + @ObjectHolder("floating_hopperhock") public static Block hopperhockFloating; + @ObjectHolder("floating_hopperhock_chibi") public static Block hopperhockChibiFloating; + @ObjectHolder("floating_tangleberrie") public static Block tangleberrieFloating; + @ObjectHolder("floating_jiyuulia") public static Block jiyuuliaFloating; + @ObjectHolder("floating_rannuncarpus") public static Block rannuncarpusFloating; + @ObjectHolder("floating_rannuncarpus_chibi") public static Block rannuncarpusChibiFloating; + @ObjectHolder("floating_hyacidus") public static Block hyacidusFloating; + @ObjectHolder("floating_pollidisiac") public static Block pollidisiacFloating; + @ObjectHolder("floating_clayconia") public static Block clayconiaFloating; + @ObjectHolder("floating_clayconia_chibi") public static Block clayconiaChibiFloating; + @ObjectHolder("floating_loonium") public static Block looniumFloating; + @ObjectHolder("floating_daffomill") public static Block daffomillFloating; + @ObjectHolder("floating_vinculotus") public static Block vinculotusFloating; + @ObjectHolder("floating_spectranthemum") public static Block spectranthemumFloating; + @ObjectHolder("floating_medumone") public static Block medumoneFloating; + @ObjectHolder("floating_marimorphosis") public static Block marimorphosisFloating; + @ObjectHolder("floating_marimorphosis_chibi") public static Block marimorphosisChibiFloating; + @ObjectHolder("floating_bubbell") public static Block bubbellFloating; + @ObjectHolder("floating_bubbell_chibi") public static Block bubbellChibiFloating; + @ObjectHolder("floating_solegnolia") public static Block solegnoliaFloating; + @ObjectHolder("floating_solegnolia_chibi") public static Block solegnoliaChibiFloating; + @ObjectHolder("floating_orechid_ignem") public static Block orechidIgnemFloating; + + private static ResourceLocation floating(ResourceLocation orig) { + return new ResourceLocation(orig.getNamespace(), "floating_" + orig.getPath()); + } + + private static ResourceLocation chibi(ResourceLocation orig) { + return new ResourceLocation(orig.getNamespace(), orig.getPath() + "_chibi"); + } + + public static List, ResourceLocation>> getTypes() { + return ImmutableList.of( + Pair.of(SubTilePureDaisy::new, LibBlockNames.SUBTILE_PUREDAISY), + Pair.of(SubTileManastar::new, LibBlockNames.SUBTILE_MANASTAR), + Pair.of(SubTileEndoflame::new, LibBlockNames.SUBTILE_ENDOFLAME), + Pair.of(SubTileHydroangeas::new, LibBlockNames.SUBTILE_HYDROANGEAS), + Pair.of(SubTileThermalily::new, LibBlockNames.SUBTILE_THERMALILY), + Pair.of(SubTileArcaneRose::new, LibBlockNames.SUBTILE_ARCANE_ROSE), + Pair.of(SubTileMunchdew::new, LibBlockNames.SUBTILE_MUNCHDEW), + Pair.of(SubTileEntropinnyum::new, LibBlockNames.SUBTILE_ENTROPINNYUM), + Pair.of(SubTileKekimurus::new, LibBlockNames.SUBTILE_KEKIMURUS), + Pair.of(SubTileGourmaryllis::new, LibBlockNames.SUBTILE_GOURMARYLLIS), + Pair.of(SubTileNarslimmus::new, LibBlockNames.SUBTILE_NARSLIMMUS), + Pair.of(SubTileSpectrolus::new, LibBlockNames.SUBTILE_SPECTROLUS), + Pair.of(SubTileDandelifeon::new, LibBlockNames.SUBTILE_DANDELIFEON), + Pair.of(SubTileRafflowsia::new, LibBlockNames.SUBTILE_RAFFLOWSIA), + Pair.of(SubTileShulkMeNot::new, LibBlockNames.SUBTILE_SHULK_ME_NOT), + Pair.of(SubTileBellethorn::new, LibBlockNames.SUBTILE_BELLETHORN), + Pair.of(SubTileBellethorn.Mini::new, chibi(LibBlockNames.SUBTILE_BELLETHORN)), + Pair.of(SubTileBergamute::new, LibBlockNames.SUBTILE_BERGAMUTE), + Pair.of(SubTileDreadthorn::new, LibBlockNames.SUBTILE_DREADTHORN), + Pair.of(SubTileHeiseiDream::new, LibBlockNames.SUBTILE_HEISEI_DREAM), + Pair.of(SubTileTigerseye::new, LibBlockNames.SUBTILE_TIGERSEYE), + Pair.of(SubTileJadedAmaranthus::new, LibBlockNames.SUBTILE_JADED_AMARANTHUS), + Pair.of(SubTileOrechid::new, LibBlockNames.SUBTILE_ORECHID), + Pair.of(SubTileFallenKanade::new, LibBlockNames.SUBTILE_FALLEN_KANADE), + Pair.of(SubTileExoflame::new, LibBlockNames.SUBTILE_EXOFLAME), + Pair.of(SubTileAgricarnation::new, LibBlockNames.SUBTILE_AGRICARNATION), + Pair.of(SubTileAgricarnation.Mini::new, chibi(LibBlockNames.SUBTILE_AGRICARNATION)), + Pair.of(SubTileHopperhock::new, LibBlockNames.SUBTILE_HOPPERHOCK), + Pair.of(SubTileHopperhock.Mini::new, chibi(LibBlockNames.SUBTILE_HOPPERHOCK)), + Pair.of(SubTileTangleberrie::new, LibBlockNames.SUBTILE_TANGLEBERRIE), + Pair.of(SubTileJiyuulia::new, LibBlockNames.SUBTILE_JIYUULIA), + Pair.of(SubTileRannuncarpus::new, LibBlockNames.SUBTILE_RANNUNCARPUS), + Pair.of(SubTileRannuncarpus.Mini::new, chibi(LibBlockNames.SUBTILE_RANNUNCARPUS)), + Pair.of(SubTileHyacidus::new, LibBlockNames.SUBTILE_HYACIDUS), + Pair.of(SubTilePollidisiac::new, LibBlockNames.SUBTILE_POLLIDISIAC), + Pair.of(SubTileClayconia::new, LibBlockNames.SUBTILE_CLAYCONIA), + Pair.of(SubTileClayconia.Mini::new, chibi(LibBlockNames.SUBTILE_CLAYCONIA)), + Pair.of(SubTileLoonuim::new, LibBlockNames.SUBTILE_LOONIUM), + Pair.of(SubTileDaffomill::new, LibBlockNames.SUBTILE_DAFFOMILL), + Pair.of(SubTileVinculotus::new, LibBlockNames.SUBTILE_VINCULOTUS), + Pair.of(SubTileSpectranthemum::new, LibBlockNames.SUBTILE_SPECTRANTHEMUM), + Pair.of(SubTileMedumone::new, LibBlockNames.SUBTILE_MEDUMONE), + Pair.of(SubTileMarimorphosis::new, LibBlockNames.SUBTILE_MARIMORPHOSIS), + Pair.of(SubTileMarimorphosis.Mini::new, chibi(LibBlockNames.SUBTILE_MARIMORPHOSIS)), + Pair.of(SubTileBubbell::new, LibBlockNames.SUBTILE_BUBBELL), + Pair.of(SubTileBubbell.Mini::new, chibi(LibBlockNames.SUBTILE_BUBBELL)), + Pair.of(SubTileSolegnolia::new, LibBlockNames.SUBTILE_SOLEGNOLIA), + Pair.of(SubTileSolegnolia.Mini::new, chibi(LibBlockNames.SUBTILE_SOLEGNOLIA)), + Pair.of(SubTileOrechidIgnem::new, LibBlockNames.SUBTILE_ORECHID_IGNEM) + ); + } + + @SubscribeEvent + public static void registerBlocks(RegistryEvent.Register evt) { + IForgeRegistry r = evt.getRegistry(); + Block.Properties props = Block.Properties.from(Blocks.POPPY); + Block.Properties floatProps = Block.Properties.create(Material.EARTH).hardnessAndResistance(0.5F).sound(SoundType.GROUND).lightValue(15); + + for (Pair, ResourceLocation> type : getTypes()) { + register(r, new BlockSpecialFlower(props, type.getFirst()), type.getSecond()); + register(r, new BlockFloatingSpecialFlower(floatProps, type.getFirst()), floating(type.getSecond())); + } + } + + @SubscribeEvent + public static void registerItemBlocks(RegistryEvent.Register evt) { + IForgeRegistry b = ForgeRegistries.BLOCKS; + IForgeRegistry r = evt.getRegistry(); + Item.Properties props = ModItems.defaultBuilder(); + + for (Pair, ResourceLocation> type : getTypes()) { + Block block = b.getValue(type.getSecond()); + Block floating = b.getValue(floating(type.getSecond())); + + register(r, new ItemBlockSpecialFlower(block, props), type.getSecond()); + register(r, new ItemBlockSpecialFlower(floating, props), floating(type.getSecond())); + } + } + + @SubscribeEvent + public static void registerTEs(RegistryEvent.Register> evt) { + IForgeRegistry b = ForgeRegistries.BLOCKS; + IForgeRegistry> r = evt.getRegistry(); + + for (Pair, ResourceLocation> type : getTypes()) { + Block block = b.getValue(type.getSecond()); + Block floating = b.getValue(floating(type.getSecond())); + register(r, TileEntityType.Builder.create(type.getFirst(), block, floating).build(null), type.getSecond()); + } + } +} diff --git a/src/main/java/vazkii/botania/common/integration/corporea/WrappedIInventory.java b/src/main/java/vazkii/botania/common/integration/corporea/WrappedIInventory.java index 52cf65970..e5b5a338f 100644 --- a/src/main/java/vazkii/botania/common/integration/corporea/WrappedIInventory.java +++ b/src/main/java/vazkii/botania/common/integration/corporea/WrappedIInventory.java @@ -1,78 +1,78 @@ -/* - * 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.integration.corporea; - -import net.minecraft.item.ItemStack; - -import vazkii.botania.api.corporea.CorporeaRequest; -import vazkii.botania.api.corporea.ICorporeaSpark; -import vazkii.botania.api.corporea.IWrappedInventory; -import vazkii.botania.api.corporea.InvWithLocation; - -import java.util.ArrayList; -import java.util.List; - -public class WrappedIInventory extends WrappedInventoryBase { - - protected final InvWithLocation inv; - - protected WrappedIInventory(InvWithLocation inv, ICorporeaSpark spark) { - super(spark); - this.inv = inv; - } - - @Override - public InvWithLocation getWrappedObject() { - return inv; - } - - @Override - public List countItems(CorporeaRequest request) { - return iterateOverSlots(request, false); - } - - @Override - public List extractItems(CorporeaRequest request) { - return iterateOverSlots(request, true); - } - - protected List iterateOverSlots(CorporeaRequest request, boolean doit) { - List stacks = new ArrayList(); - - for (int i = inv.handler.getSlots() - 1; i >= 0; i--) { - ItemStack stackAt = inv.handler.getStackInSlot(i); - // WARNING: this code is very similar in all implementations of - // IWrappedInventory - keep it synch - if (request.matcher.isStackValid(stackAt)) { - int rem = Math.min(stackAt.getCount(), request.count == -1 ? stackAt.getCount() : request.count); - request.foundItems += stackAt.getCount(); - - if (rem > 0) { - stacks.add(inv.handler.extractItem(i, rem, !doit)); - if (doit && spark != null) { - spark.onItemExtracted(stackAt); - } - } - - request.extractedItems += rem; - - if (request.count != -1) { - request.count -= rem; - } - } - } - - return stacks; - } - - public static IWrappedInventory wrap(InvWithLocation inv, ICorporeaSpark spark) { - return new WrappedIInventory(inv, spark); - } - -} +/* + * 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.integration.corporea; + +import net.minecraft.item.ItemStack; + +import vazkii.botania.api.corporea.CorporeaRequest; +import vazkii.botania.api.corporea.ICorporeaSpark; +import vazkii.botania.api.corporea.IWrappedInventory; +import vazkii.botania.api.corporea.InvWithLocation; + +import java.util.ArrayList; +import java.util.List; + +public class WrappedIInventory extends WrappedInventoryBase { + + protected final InvWithLocation inv; + + protected WrappedIInventory(InvWithLocation inv, ICorporeaSpark spark) { + super(spark); + this.inv = inv; + } + + @Override + public InvWithLocation getWrappedObject() { + return inv; + } + + @Override + public List countItems(CorporeaRequest request) { + return iterateOverSlots(request, false); + } + + @Override + public List extractItems(CorporeaRequest request) { + return iterateOverSlots(request, true); + } + + protected List iterateOverSlots(CorporeaRequest request, boolean doit) { + List stacks = new ArrayList(); + + for (int i = inv.handler.getSlots() - 1; i >= 0; i--) { + ItemStack stackAt = inv.handler.getStackInSlot(i); + // WARNING: this code is very similar in all implementations of + // IWrappedInventory - keep it synch + if (request.matcher.isStackValid(stackAt)) { + int rem = Math.min(stackAt.getCount(), request.count == -1 ? stackAt.getCount() : request.count); + request.foundItems += stackAt.getCount(); + + if (rem > 0) { + stacks.add(inv.handler.extractItem(i, rem, !doit)); + if (doit && spark != null) { + spark.onItemExtracted(stackAt); + } + } + + request.extractedItems += rem; + + if (request.count != -1) { + request.count -= rem; + } + } + } + + return stacks; + } + + public static IWrappedInventory wrap(InvWithLocation inv, ICorporeaSpark spark) { + return new WrappedIInventory(inv, spark); + } + +} diff --git a/src/main/java/vazkii/botania/common/integration/corporea/WrappedInventoryBase.java b/src/main/java/vazkii/botania/common/integration/corporea/WrappedInventoryBase.java index 46fcf1718..0ed084bb6 100644 --- a/src/main/java/vazkii/botania/common/integration/corporea/WrappedInventoryBase.java +++ b/src/main/java/vazkii/botania/common/integration/corporea/WrappedInventoryBase.java @@ -1,50 +1,50 @@ -/* - * 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.integration.corporea; - -import net.minecraft.item.ItemStack; - -import vazkii.botania.api.corporea.ICorporeaSpark; -import vazkii.botania.api.corporea.IWrappedInventory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public abstract class WrappedInventoryBase implements IWrappedInventory { - - protected final ICorporeaSpark spark; - - public WrappedInventoryBase(ICorporeaSpark spark) { - this.spark = spark; - } - - @Override - public ICorporeaSpark getSpark() { - return spark; - } - - protected Collection breakDownBigStack(ItemStack stack) { - List stacks = new ArrayList(); - int additionalStacks = stack.getCount() / stack.getMaxStackSize(); - int lastStackSize = stack.getCount() % stack.getMaxStackSize(); - if (additionalStacks > 0) { - ItemStack fullStack = stack.copy(); - fullStack.setCount(stack.getMaxStackSize()); - for (int i = 0; i < additionalStacks; i++) { - stacks.add(fullStack.copy()); - } - } - ItemStack lastStack = stack.copy(); - lastStack.setCount(lastStackSize); - stacks.add(lastStack); - - return stacks; - } -} +/* + * 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.integration.corporea; + +import net.minecraft.item.ItemStack; + +import vazkii.botania.api.corporea.ICorporeaSpark; +import vazkii.botania.api.corporea.IWrappedInventory; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public abstract class WrappedInventoryBase implements IWrappedInventory { + + protected final ICorporeaSpark spark; + + public WrappedInventoryBase(ICorporeaSpark spark) { + this.spark = spark; + } + + @Override + public ICorporeaSpark getSpark() { + return spark; + } + + protected Collection breakDownBigStack(ItemStack stack) { + List stacks = new ArrayList(); + int additionalStacks = stack.getCount() / stack.getMaxStackSize(); + int lastStackSize = stack.getCount() % stack.getMaxStackSize(); + if (additionalStacks > 0) { + ItemStack fullStack = stack.copy(); + fullStack.setCount(stack.getMaxStackSize()); + for (int i = 0; i < additionalStacks; i++) { + stacks.add(fullStack.copy()); + } + } + ItemStack lastStack = stack.copy(); + lastStack.setCount(lastStackSize); + stacks.add(lastStack); + + return stacks; + } +} diff --git a/src/main/java/vazkii/botania/common/lib/ResourceLocationHelper.java b/src/main/java/vazkii/botania/common/lib/ResourceLocationHelper.java index 57257942e..a6c5949f7 100644 --- a/src/main/java/vazkii/botania/common/lib/ResourceLocationHelper.java +++ b/src/main/java/vazkii/botania/common/lib/ResourceLocationHelper.java @@ -1,17 +1,17 @@ -/* - * 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.lib; - -import net.minecraft.util.ResourceLocation; - -public class ResourceLocationHelper { - public static ResourceLocation prefix(String path) { - return new ResourceLocation(LibMisc.MOD_ID, path); - } -} +/* + * 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.lib; + +import net.minecraft.util.ResourceLocation; + +public class ResourceLocationHelper { + public static ResourceLocation prefix(String path) { + return new ResourceLocation(LibMisc.MOD_ID, path); + } +} diff --git a/src/main/java/vazkii/botania/common/network/PacketItemAge.java b/src/main/java/vazkii/botania/common/network/PacketItemAge.java index d6818444a..05203faa0 100644 --- a/src/main/java/vazkii/botania/common/network/PacketItemAge.java +++ b/src/main/java/vazkii/botania/common/network/PacketItemAge.java @@ -1,48 +1,48 @@ -/* - * 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.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; - -public class PacketItemAge { - private final int entityId; - private final int age; - - public PacketItemAge(int entityId, int age) { - this.entityId = entityId; - this.age = age; - } - - public static PacketItemAge decode(PacketBuffer buf) { - return new PacketItemAge(buf.readVarInt(), buf.readVarInt()); - } - - public static void encode(PacketItemAge msg, PacketBuffer buf) { - buf.writeVarInt(msg.entityId); - buf.writeVarInt(msg.age); - } - - public static void handle(PacketItemAge message, Supplier ctx) { - if (ctx.get().getDirection().getReceptionSide().isClient()) { - ctx.get().enqueueWork(() -> { - Entity e = Minecraft.getInstance().world.getEntityByID(message.entityId); - if (e instanceof ItemEntity) { - ((ItemEntity) e).age = message.age; - } - }); - } - ctx.get().setPacketHandled(true); - } -} +/* + * 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.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.fml.network.NetworkEvent; + +import java.util.function.Supplier; + +public class PacketItemAge { + private final int entityId; + private final int age; + + public PacketItemAge(int entityId, int age) { + this.entityId = entityId; + this.age = age; + } + + public static PacketItemAge decode(PacketBuffer buf) { + return new PacketItemAge(buf.readVarInt(), buf.readVarInt()); + } + + public static void encode(PacketItemAge msg, PacketBuffer buf) { + buf.writeVarInt(msg.entityId); + buf.writeVarInt(msg.age); + } + + public static void handle(PacketItemAge message, Supplier ctx) { + if (ctx.get().getDirection().getReceptionSide().isClient()) { + ctx.get().enqueueWork(() -> { + Entity e = Minecraft.getInstance().world.getEntityByID(message.entityId); + if (e instanceof ItemEntity) { + ((ItemEntity) e).age = message.age; + } + }); + } + ctx.get().setPacketHandled(true); + } +}