mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 12:42:50 +00:00
Normalize java line endings on crlf
This should fix the build?
This commit is contained in:
1 parent
6d7e5037d9
commit
2066bc61a9
12 files changed
+723
-722
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ItemStack> countItems(CorporeaRequest request);
|
||||
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@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<ItemStack> 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<ItemStack> countItems(CorporeaRequest request);
|
||||
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@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<ItemStack> extractItems(CorporeaRequest request);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
public LayerTerraHelmet(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> 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<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
public LayerTerraHelmet(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<TileEntity> 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<TileEntity> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Pair<Supplier<? extends TileEntitySpecialFlower>, 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<Block> evt) {
|
||||
IForgeRegistry<Block> 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<Supplier<? extends TileEntitySpecialFlower>, 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<Item> evt) {
|
||||
IForgeRegistry<Block> b = ForgeRegistries.BLOCKS;
|
||||
IForgeRegistry<Item> r = evt.getRegistry();
|
||||
Item.Properties props = ModItems.defaultBuilder();
|
||||
|
||||
for (Pair<Supplier<? extends TileEntitySpecialFlower>, 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<TileEntityType<?>> evt) {
|
||||
IForgeRegistry<Block> b = ForgeRegistries.BLOCKS;
|
||||
IForgeRegistry<TileEntityType<?>> r = evt.getRegistry();
|
||||
|
||||
for (Pair<Supplier<? extends TileEntitySpecialFlower>, 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<Pair<Supplier<? extends TileEntitySpecialFlower>, 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<Block> evt) {
|
||||
IForgeRegistry<Block> 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<Supplier<? extends TileEntitySpecialFlower>, 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<Item> evt) {
|
||||
IForgeRegistry<Block> b = ForgeRegistries.BLOCKS;
|
||||
IForgeRegistry<Item> r = evt.getRegistry();
|
||||
Item.Properties props = ModItems.defaultBuilder();
|
||||
|
||||
for (Pair<Supplier<? extends TileEntitySpecialFlower>, 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<TileEntityType<?>> evt) {
|
||||
IForgeRegistry<Block> b = ForgeRegistries.BLOCKS;
|
||||
IForgeRegistry<TileEntityType<?>> r = evt.getRegistry();
|
||||
|
||||
for (Pair<Supplier<? extends TileEntitySpecialFlower>, 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<ItemStack> countItems(CorporeaRequest request) {
|
||||
return iterateOverSlots(request, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> extractItems(CorporeaRequest request) {
|
||||
return iterateOverSlots(request, true);
|
||||
}
|
||||
|
||||
protected List<ItemStack> iterateOverSlots(CorporeaRequest request, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
|
||||
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<ItemStack> countItems(CorporeaRequest request) {
|
||||
return iterateOverSlots(request, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> extractItems(CorporeaRequest request) {
|
||||
return iterateOverSlots(request, true);
|
||||
}
|
||||
|
||||
protected List<ItemStack> iterateOverSlots(CorporeaRequest request, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
+50
-50
@@ -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<? extends ItemStack> breakDownBigStack(ItemStack stack) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
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<? extends ItemStack> breakDownBigStack(ItemStack stack) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<NetworkEvent.Context> 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<NetworkEvent.Context> 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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user