mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 12:42:36 +00:00
Made travel anchors paintable.
This commit is contained in:
1 parent
948e478c6d
commit
40dbda715a
10 files changed
+307
-62
No files matched your search
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
@@ -71,6 +72,7 @@ import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstoneRenderer;
|
||||
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
|
||||
import crazypants.enderio.machine.painter.PaintedItemRenderer;
|
||||
import crazypants.enderio.machine.power.BlockCapacitorBank;
|
||||
import crazypants.enderio.machine.power.CapBankRenderer2;
|
||||
@@ -89,6 +91,7 @@ import crazypants.enderio.material.BlockFusedQuartz;
|
||||
import crazypants.enderio.material.FusedQuartzFrameRenderer;
|
||||
import crazypants.enderio.material.FusedQuartzRenderer;
|
||||
import crazypants.enderio.material.MachinePartRenderer;
|
||||
import crazypants.enderio.teleport.BlockTravelAnchor;
|
||||
import crazypants.enderio.teleport.TileTravelAnchor;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.enderio.teleport.TravelEntitySpecialRenderer;
|
||||
@@ -257,9 +260,14 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPaintedGlowstone), pir);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPaintedCarpet), pir);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockDarkSteelPressurePlate), pir);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTravelPlatform), pir);
|
||||
|
||||
BlockPaintedGlowstone.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new BlockPaintedGlowstoneRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new PaintedBlockRenderer(BlockPaintedGlowstone.renderId, Blocks.glowstone));
|
||||
|
||||
BlockTravelAnchor.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new PaintedBlockRenderer(BlockTravelAnchor.renderId, EnderIO.blockTravelPlatform));
|
||||
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
|
||||
|
||||
@@ -144,7 +144,7 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate implements I
|
||||
|
||||
@Override
|
||||
public List<IEnderIoRecipe> getAllRecipes() {
|
||||
IRecipeInput input = new RecipeInputClass<BlockGlowstone>(new ItemStack(Blocks.glowstone), BlockGlowstone.class);
|
||||
IRecipeInput input = new RecipeInputClass<BlockDarkSteelPressurePlate>(new ItemStack(EnderIO.blockDarkSteelPressurePlate), BlockDarkSteelPressurePlate.class);
|
||||
IRecipeOutput output = new RecipeOutput(new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 0));
|
||||
IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output);
|
||||
return Collections.singletonList(recipe);
|
||||
|
||||
+1
-50
@@ -6,10 +6,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.util.IBlockAccessWrapper;
|
||||
|
||||
public class BlockPaintedGlowstoneRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@@ -37,7 +34,7 @@ public class BlockPaintedGlowstoneRenderer implements ISimpleBlockRenderingHandl
|
||||
}
|
||||
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new PaintedAccessWrapper(origBa);
|
||||
rb.blockAccess = new PaintedBlockAccessWrapper(origBa);
|
||||
rb.renderBlockByRenderType(srcBlk, x, y, z);
|
||||
rb.blockAccess = origBa;
|
||||
|
||||
@@ -49,50 +46,4 @@ public class BlockPaintedGlowstoneRenderer implements ISimpleBlockRenderingHandl
|
||||
return true;
|
||||
}
|
||||
|
||||
private class PaintedAccessWrapper extends IBlockAccessWrapper {
|
||||
|
||||
public PaintedAccessWrapper(IBlockAccess ba) {
|
||||
super(ba);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
Block res = super.getBlock(x, y, z);
|
||||
if(res == EnderIO.blockPaintedGlowstone) {
|
||||
TileEntity te = getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntityPaintedBlock) {
|
||||
TileEntityPaintedBlock tcb = (TileEntityPaintedBlock) te;
|
||||
Block fac = tcb.getSourceBlock();
|
||||
if(fac != null) {
|
||||
res = fac;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLightBrightnessForSkyBlocks(int var1, int var2, int var3, int var4) {
|
||||
return wrapped.getLightBrightnessForSkyBlocks(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
Block block = super.getBlock(x, y, z);
|
||||
if(block == EnderIO.blockPaintedGlowstone) {
|
||||
TileEntity te = getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntityPaintedBlock) {
|
||||
TileEntityPaintedBlock tcb = (TileEntityPaintedBlock) te;
|
||||
Block fac = tcb.getSourceBlock();
|
||||
if(fac != null) {
|
||||
return tcb.getSourceBlockMetadata();
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package crazypants.enderio.machine.painter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.util.IBlockAccessWrapper;
|
||||
|
||||
public class PaintedBlockAccessWrapper extends IBlockAccessWrapper {
|
||||
|
||||
public PaintedBlockAccessWrapper(IBlockAccess ba) {
|
||||
super(ba);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
Block res = super.getBlock(x, y, z);
|
||||
TileEntity te = getTileEntity(x, y, z);
|
||||
if(te instanceof IPaintableTileEntity) {
|
||||
IPaintableTileEntity tcb = (IPaintableTileEntity) te;
|
||||
Block fac = tcb.getSourceBlock();
|
||||
if(fac != null) {
|
||||
res = fac;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLightBrightnessForSkyBlocks(int var1, int var2, int var3, int var4) {
|
||||
return wrapped.getLightBrightnessForSkyBlocks(var1, var2, var3, var4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
Block block = super.getBlock(x, y, z);
|
||||
TileEntity te = getTileEntity(x, y, z);
|
||||
if(te instanceof IPaintableTileEntity) {
|
||||
IPaintableTileEntity tcb = (IPaintableTileEntity) te;
|
||||
Block fac = tcb.getSourceBlock();
|
||||
if(fac != null) {
|
||||
return tcb.getSourceBlockMetadata();
|
||||
}
|
||||
}
|
||||
return super.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package crazypants.enderio.machine.painter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.render.CubeRenderer;
|
||||
|
||||
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private int renderId;
|
||||
private Block defaultBlock;
|
||||
|
||||
public PaintedBlockRenderer(int renderId, Block defaultBlock) {
|
||||
this.renderId = renderId;
|
||||
this.defaultBlock = defaultBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blk, int meta, int modelId, RenderBlocks arg3) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(blk, meta);
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess ba, int x, int y, int z, Block block, int arg5, RenderBlocks rb) {
|
||||
|
||||
TileEntity tile = ba.getTileEntity(x, y, z);
|
||||
if(!(tile instanceof IPaintableTileEntity)) {
|
||||
return false;
|
||||
}
|
||||
IPaintableTileEntity te = (IPaintableTileEntity) tile;
|
||||
Block srcBlk = te.getSourceBlock();
|
||||
if(srcBlk == null) {
|
||||
srcBlk = defaultBlock;
|
||||
}
|
||||
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new PaintedBlockAccessWrapper(origBa);
|
||||
if(srcBlk == block) {
|
||||
rb.renderStandardBlock(srcBlk, x, y, z);
|
||||
} else {
|
||||
rb.renderBlockByRenderType(srcBlk, x, y, z);
|
||||
}
|
||||
rb.blockAccess = origBa;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int arg0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,11 +47,13 @@ public class PaintedItemRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
public void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
|
||||
if(item.getItem() == Item.getItemFromBlock(EnderIO.blockPaintedGlowstone)) {
|
||||
if(item.getItem() == Item.getItemFromBlock(EnderIO.blockPaintedGlowstone) || item.getItem() == Item.getItemFromBlock(EnderIO.blockTravelPlatform) ) {
|
||||
Block block = PainterUtil.getSourceBlock(item);
|
||||
if(block != null) {
|
||||
RenderUtil.bindBlockTexture();
|
||||
RenderUtil.bindBlockTexture();
|
||||
if(block != null) {
|
||||
renderBlocks.renderBlockAsItem(block, PainterUtil.getSourceBlockMetadata(item), 1.0F);
|
||||
} else {
|
||||
renderBlocks.renderBlockAsItem(Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 1.0F);
|
||||
}
|
||||
} else {
|
||||
Block block = PainterUtil.getSourceBlock(item);
|
||||
|
||||
@@ -1,24 +1,46 @@
|
||||
package crazypants.enderio.teleport;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockGlowstone;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.block.BlockDarkSteelPressurePlate.PainterTemplate;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.crafting.IEnderIoRecipe;
|
||||
import crazypants.enderio.crafting.IRecipeInput;
|
||||
import crazypants.enderio.crafting.IRecipeOutput;
|
||||
import crazypants.enderio.crafting.impl.EnderIoRecipe;
|
||||
import crazypants.enderio.crafting.impl.RecipeInputClass;
|
||||
import crazypants.enderio.crafting.impl.RecipeOutput;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.packet.PacketAccessMode;
|
||||
import crazypants.enderio.teleport.packet.PacketConfigSync;
|
||||
@@ -26,9 +48,12 @@ import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
|
||||
public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEntityProvider, IResourceTooltipProvider {
|
||||
|
||||
public static int renderId = -1;
|
||||
|
||||
public static BlockTravelAnchor create() {
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(PacketAccessMode.class, PacketAccessMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
@@ -60,6 +85,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
|
||||
super.init();
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, this);
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_TRAVEL_AUTH, this);
|
||||
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,6 +94,18 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
|
||||
highlightOverlayIcon = iIconRegister.registerIcon("enderio:blockTravelAnchorHighlight");
|
||||
selectedOverlayIcon = iIconRegister.registerIcon("enderio:blockTravelAnchorSelected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor tef = (TileTravelAnchor) te;
|
||||
if(tef.getSourceBlock() != null) {
|
||||
return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata());
|
||||
}
|
||||
}
|
||||
return super.getIcon(world, x, y, z, blockSide);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
@@ -79,7 +117,11 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
|
||||
if(entity instanceof EntityPlayer) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
((TileTravelAnchor) te).setPlacedBy((EntityPlayer) entity);
|
||||
TileTravelAnchor ta = (TileTravelAnchor) te;
|
||||
ta.setPlacedBy((EntityPlayer) entity);
|
||||
Block b = PainterUtil.getSourceBlock(par6ItemStack);
|
||||
ta.setSourceBlock(b);
|
||||
ta.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(par6ItemStack));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -132,16 +174,94 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
|
||||
return null;
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_) {
|
||||
super.breakBlock(world, x, y, z, block, p_149749_6_);
|
||||
/**
|
||||
* Remove the tile entity too.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
|
||||
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor tef = (TileTravelAnchor) te;
|
||||
|
||||
ItemStack itemStack;
|
||||
Block srcBlk = tef.getSourceBlock();
|
||||
if(srcBlk != null) {
|
||||
itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata());
|
||||
} else {
|
||||
itemStack = new ItemStack(this);
|
||||
}
|
||||
|
||||
float f = 0.7F;
|
||||
double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
|
||||
double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
|
||||
double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, x + d0, y + d1, z + d2, itemStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0; // need to do custom dropping to maintain source metadata
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileTravelAnchor) {
|
||||
TileTravelAnchor tef = (TileTravelAnchor) te;
|
||||
if(tef.getSourceBlock() != null) {
|
||||
return tef.getSourceBlock().colorMultiplier(world, x, y, z);
|
||||
}
|
||||
}
|
||||
return super.colorMultiplier(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
public static ItemStack createItemStackForSourceBlock(Block block, int damage) {
|
||||
ItemStack result = new ItemStack(EnderIO.blockTravelPlatform, 1, damage);
|
||||
PainterUtil.setSourceBlock(result, block, damage);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class PainterTemplate extends BasicPainterTemplate {
|
||||
|
||||
public PainterTemplate(Block ta) {
|
||||
super(ta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) {
|
||||
ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs);
|
||||
if(paintSource == null) {
|
||||
return new ResultStack[0];
|
||||
}
|
||||
return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IEnderIoRecipe> getAllRecipes() {
|
||||
IRecipeInput input = new RecipeInputClass<BlockTravelAnchor>(new ItemStack(EnderIO.blockTravelPlatform), BlockTravelAnchor.class);
|
||||
IRecipeOutput output = new RecipeOutput(new ItemStack(EnderIO.blockTravelPlatform, 1, 0));
|
||||
IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output);
|
||||
return Collections.singletonList(recipe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,24 +4,35 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.machine.painter.IPaintableTileEntity;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable {
|
||||
public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable, IPaintableTileEntity {
|
||||
|
||||
public enum AccessMode {
|
||||
PUBLIC,
|
||||
PRIVATE,
|
||||
PROTECTED
|
||||
}
|
||||
|
||||
private static final String KEY_SOURCE_BLOCK_ID = "sourceBlock";
|
||||
private static final String KEY_SOURCE_BLOCK_META = "sourceBlockMeta";
|
||||
|
||||
private Block sourceBlock;
|
||||
private int sourceBlockMetadata;
|
||||
|
||||
private AccessMode accessMode = AccessMode.PUBLIC;
|
||||
|
||||
@@ -160,6 +171,26 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
public boolean shouldRenderInPass(int pass) {
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSourceBlock() {
|
||||
return sourceBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSourceBlock(Block sourceBlock) {
|
||||
this.sourceBlock = sourceBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceBlockMetadata() {
|
||||
return sourceBlockMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSourceBlockMetadata(int sourceBlockMetadata) {
|
||||
this.sourceBlockMetadata = sourceBlockMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readCustomNBT(NBTTagCompound root) {
|
||||
@@ -198,6 +229,10 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
itemLabel = null;
|
||||
}
|
||||
|
||||
String sourceBlockStr = root.getString(KEY_SOURCE_BLOCK_ID);
|
||||
sourceBlock = Block.getBlockFromName(sourceBlockStr);
|
||||
sourceBlockMetadata = root.getInteger(KEY_SOURCE_BLOCK_META);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,6 +264,11 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
itemLabel.writeToNBT(labelRoot);
|
||||
root.setTag("itemLabel", labelRoot);
|
||||
}
|
||||
|
||||
if(sourceBlock != null) {
|
||||
root.setString(KEY_SOURCE_BLOCK_ID, Block.blockRegistry.getNameForObject(sourceBlock));
|
||||
}
|
||||
root.setInteger(KEY_SOURCE_BLOCK_META, sourceBlockMetadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -14,6 +15,14 @@ public final class CubeRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void render(Block block, int meta) {
|
||||
IIcon[] icons = new IIcon[6];
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
icons[dir.ordinal()] = block.getIcon(dir.ordinal(), meta);
|
||||
}
|
||||
render(BoundingBox.UNIT_CUBE, icons, true);
|
||||
}
|
||||
|
||||
public static void render(BoundingBox bb, IIcon tex) {
|
||||
render(bb, tex, null, false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user