A bit more altar cleanup
This commit is contained in:
parent
e2d2ecb3ba
commit
ecb81a7017
6 changed files with 108 additions and 108 deletions
|
@ -1,138 +1,148 @@
|
|||
package WayofTime.bloodmagic.altar;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
//@formatter:off
|
||||
public enum AltarTier {
|
||||
ONE(), TWO() {
|
||||
ONE() {
|
||||
@Override
|
||||
public void buildComponents() {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE));
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
// Nada
|
||||
}
|
||||
}, TWO() {
|
||||
@Override
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE));
|
||||
components.accept(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE));
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE));
|
||||
components.accept(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE));
|
||||
}
|
||||
},
|
||||
THREE() {
|
||||
@Override
|
||||
public void buildComponents() {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, -1, -3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, 0, -3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, -1, -3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, 0, -3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, -1, 3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, 0, 3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, -1, 3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, 0, 3)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, 1, -3), ComponentType.GLOWSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, 1, -3), ComponentType.GLOWSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, 1, 3), ComponentType.GLOWSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), ComponentType.GLOWSTONE));
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
// Doesn't pull from tier 2 because upgrades slots are different
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-3, -1, -3)));
|
||||
components.accept(new AltarComponent(new BlockPos(-3, 0, -3)));
|
||||
components.accept(new AltarComponent(new BlockPos(3, -1, -3)));
|
||||
components.accept(new AltarComponent(new BlockPos(3, 0, -3)));
|
||||
components.accept(new AltarComponent(new BlockPos(-3, -1, 3)));
|
||||
components.accept(new AltarComponent(new BlockPos(-3, 0, 3)));
|
||||
components.accept(new AltarComponent(new BlockPos(3, -1, 3)));
|
||||
components.accept(new AltarComponent(new BlockPos(3, 0, 3)));
|
||||
components.accept(new AltarComponent(new BlockPos(-3, 1, -3), ComponentType.GLOWSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(3, 1, -3), ComponentType.GLOWSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(-3, 1, 3), ComponentType.GLOWSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(3, 1, 3), ComponentType.GLOWSTONE));
|
||||
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -2, -3), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -2, 3), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -2, -3), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
}
|
||||
}
|
||||
},
|
||||
FOUR() {
|
||||
@Override
|
||||
public void buildComponents() {
|
||||
altarComponents.addAll(THREE.getAltarComponents());
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
THREE.getAltarComponents().forEach(components);
|
||||
|
||||
for (int i = -3; i <= 3; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -3, 5), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -3, -5), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
}
|
||||
|
||||
for (int i = -2; i <= 1; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, i, 5)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, i, -5)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, i, -5)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, i, 5)));
|
||||
components.accept(new AltarComponent(new BlockPos(5, i, 5)));
|
||||
components.accept(new AltarComponent(new BlockPos(5, i, -5)));
|
||||
components.accept(new AltarComponent(new BlockPos(-5, i, -5)));
|
||||
components.accept(new AltarComponent(new BlockPos(-5, i, 5)));
|
||||
}
|
||||
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, 5), ComponentType.BLOODSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), ComponentType.BLOODSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, -5), ComponentType.BLOODSTONE));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), ComponentType.BLOODSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(5, 2, 5), ComponentType.BLOODSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(5, 2, -5), ComponentType.BLOODSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(-5, 2, -5), ComponentType.BLOODSTONE));
|
||||
components.accept(new AltarComponent(new BlockPos(-5, 2, 5), ComponentType.BLOODSTONE));
|
||||
}
|
||||
},
|
||||
FIVE() {
|
||||
@Override
|
||||
public void buildComponents() {
|
||||
altarComponents.addAll(FOUR.getAltarComponents());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, 8), ComponentType.BEACON));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), ComponentType.BEACON));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(8, -3, -8), ComponentType.BEACON));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), ComponentType.BEACON));
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
FOUR.getAltarComponents().forEach(components);
|
||||
components.accept(new AltarComponent(new BlockPos(-8, -3, 8), ComponentType.BEACON));
|
||||
components.accept(new AltarComponent(new BlockPos(-8, -3, -8), ComponentType.BEACON));
|
||||
components.accept(new AltarComponent(new BlockPos(8, -3, -8), ComponentType.BEACON));
|
||||
components.accept(new AltarComponent(new BlockPos(8, -3, 8), ComponentType.BEACON));
|
||||
|
||||
for (int i = -6; i <= 6; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -4, -8), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -4, 8), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -4, -8), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
}
|
||||
}
|
||||
},
|
||||
SIX() {
|
||||
@Override
|
||||
public void buildComponents() {
|
||||
altarComponents.addAll(FIVE.getAltarComponents());
|
||||
public void buildComponents(Consumer<AltarComponent> components) {
|
||||
FIVE.getAltarComponents().forEach(components);
|
||||
|
||||
for (int i = -4; i <= 2; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(11, i, 11)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-11, i, -11)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(11, i, -11)));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-11, i, 11)));
|
||||
components.accept(new AltarComponent(new BlockPos(11, i, 11)));
|
||||
components.accept(new AltarComponent(new BlockPos(-11, i, -11)));
|
||||
components.accept(new AltarComponent(new BlockPos(11, i, -11)));
|
||||
components.accept(new AltarComponent(new BlockPos(-11, i, 11)));
|
||||
}
|
||||
|
||||
altarComponents.add(new AltarComponent(new BlockPos(11, 3, 11), ComponentType.CRYSTAL));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-11, 3, -11), ComponentType.CRYSTAL));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(11, 3, -11), ComponentType.CRYSTAL));
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), ComponentType.CRYSTAL));
|
||||
components.accept(new AltarComponent(new BlockPos(11, 3, 11), ComponentType.CRYSTAL));
|
||||
components.accept(new AltarComponent(new BlockPos(-11, 3, -11), ComponentType.CRYSTAL));
|
||||
components.accept(new AltarComponent(new BlockPos(11, 3, -11), ComponentType.CRYSTAL));
|
||||
components.accept(new AltarComponent(new BlockPos(-11, 3, 11), ComponentType.CRYSTAL));
|
||||
|
||||
for (int i = -9; i <= 9; i++) {
|
||||
altarComponents.add(new AltarComponent(new BlockPos(11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
altarComponents.add(new AltarComponent(new BlockPos(i, -5, -11), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(-11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -5, 11), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
components.accept(new AltarComponent(new BlockPos(i, -5, -11), ComponentType.BLOODRUNE).setUpgradeSlot());
|
||||
}
|
||||
}
|
||||
//@formatter:on
|
||||
};
|
||||
|
||||
public static final int MAXTIERS = values().length;
|
||||
|
||||
ArrayList<AltarComponent> altarComponents = new ArrayList<>();
|
||||
private List<AltarComponent> altarComponents;
|
||||
|
||||
public void buildComponents() {
|
||||
AltarTier() {
|
||||
this.altarComponents = Lists.newArrayList();
|
||||
|
||||
buildComponents(altarComponents::add);
|
||||
}
|
||||
|
||||
public abstract void buildComponents(Consumer<AltarComponent> components);
|
||||
|
||||
public int toInt() {
|
||||
return ordinal() + 1;
|
||||
}
|
||||
|
||||
public ArrayList<AltarComponent> getAltarComponents() {
|
||||
public List<AltarComponent> getAltarComponents() {
|
||||
return altarComponents;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,13 @@ public class AltarUtil {
|
|||
AltarTier lastCheck = AltarTier.ONE;
|
||||
for (AltarTier tier : AltarTier.values()) {
|
||||
for (AltarComponent component : tier.getAltarComponents()) {
|
||||
IBlockState worldState = world.getBlockState(pos.add(component.getOffset()));
|
||||
BlockPos componentPos = pos.add(component.getOffset());
|
||||
IBlockState worldState = world.getBlockState(componentPos);
|
||||
|
||||
if (worldState.getBlock() instanceof IAltarComponent)
|
||||
if (((IAltarComponent) worldState.getBlock()).getType(world, worldState, componentPos) == component.getComponent())
|
||||
continue;
|
||||
|
||||
if (component.getComponent() == ComponentType.NOTAIR && worldState.getMaterial() != Material.AIR && !worldState.getMaterial().isLiquid())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -31,14 +31,6 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class BloodAltar implements IFluidHandler {
|
||||
static {
|
||||
AltarTier.ONE.buildComponents();
|
||||
AltarTier.TWO.buildComponents();
|
||||
AltarTier.THREE.buildComponents();
|
||||
AltarTier.FOUR.buildComponents();
|
||||
AltarTier.FIVE.buildComponents();
|
||||
AltarTier.SIX.buildComponents();
|
||||
}
|
||||
|
||||
public boolean isActive;
|
||||
protected FluidStack fluidOutput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
|
||||
|
|
|
@ -117,7 +117,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
if (altar == null || player.isSneaking())
|
||||
return false;
|
||||
|
||||
ItemStack playerItem = player.inventory.getCurrentItem();
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator) {
|
||||
playerItem.getItem().onItemRightClick(world, player, hand);
|
||||
|
@ -136,11 +136,8 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileAltar) {
|
||||
TileAltar tileAltar = (TileAltar) world.getTileEntity(blockPos);
|
||||
if (tileAltar != null)
|
||||
tileAltar.dropItems();
|
||||
}
|
||||
if (tile instanceof TileAltar)
|
||||
((TileAltar) tile).dropItems();
|
||||
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -22,10 +21,8 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
|
||||
public static Minecraft mc = Minecraft.getMinecraft();
|
||||
public static ResourceLocation resource = new ResourceLocation("bloodmagic", "textures/blocks/lifeEssenceStill.png");
|
||||
public static float minHeight = 0.499f;
|
||||
public static float maxHeight = 0.745f;
|
||||
private static final float MIN_HEIGHT = 0.499f;
|
||||
private static final float MAX_HEIGHT = 0.745f;
|
||||
|
||||
@Override
|
||||
public void render(TileAltar tileAltar, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
|
@ -50,7 +47,7 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
|
|||
Fluid fluid = BlockLifeEssence.getLifeEssence();
|
||||
FluidStack fluidStack = new FluidStack(fluid, 1000);
|
||||
|
||||
GlStateManager.translate(0.5, minHeight + (fluidLevel) * (maxHeight - minHeight), 0.5);
|
||||
GlStateManager.translate(0.5, MIN_HEIGHT + (fluidLevel) * (MAX_HEIGHT - MIN_HEIGHT), 0.5);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder wr = tessellator.getBuffer();
|
||||
|
@ -81,7 +78,7 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
|
|||
}
|
||||
|
||||
private void renderItem(ItemStack stack) {
|
||||
RenderItem itemRenderer = mc.getRenderItem();
|
||||
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.translate(0.5, 1, 0.5);
|
||||
GlStateManager.pushMatrix();
|
||||
|
@ -103,7 +100,7 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
|
|||
}
|
||||
|
||||
private void renderHologram(TileAltar altar, AltarTier tier, float partialTicks) {
|
||||
EntityPlayerSP player = mc.player;
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().player;
|
||||
World world = player.world;
|
||||
|
||||
if (tier == AltarTier.ONE)
|
||||
|
|
|
@ -270,17 +270,15 @@ public class Utils {
|
|||
* otherwise
|
||||
*/
|
||||
public static boolean insertItemToTile(TileInventory tile, EntityPlayer player, int slot) {
|
||||
if (tile.getStackInSlot(slot).isEmpty() && !player.getHeldItemMainhand().isEmpty()) {
|
||||
ItemStack slotStack = tile.getStackInSlot(slot);
|
||||
if (slotStack.isEmpty() && !player.getHeldItemMainhand().isEmpty()) {
|
||||
ItemStack input = player.getHeldItemMainhand().copy();
|
||||
input.setCount(1);
|
||||
player.getHeldItemMainhand().shrink(1);
|
||||
tile.setInventorySlotContents(slot, input);
|
||||
return true;
|
||||
} else if (!tile.getStackInSlot(slot).isEmpty() && player.getHeldItemMainhand().isEmpty()) {
|
||||
if (!tile.getWorld().isRemote) {
|
||||
EntityItem invItem = new EntityItem(tile.getWorld(), player.posX, player.posY + 0.25, player.posZ, tile.getStackInSlot(slot));
|
||||
tile.getWorld().spawnEntity(invItem);
|
||||
}
|
||||
} else if (!slotStack.isEmpty() && player.getHeldItemMainhand().isEmpty()) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, slotStack);
|
||||
tile.clear();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue