Fixed stuff an things.

This commit is contained in:
cp committed 2014-03-01 20:23:56 +08:00
1 parent dd5664e604
commit bbd1c54fd2
6 files changed
+91 -88

No files matched your search

@@ -23,10 +23,10 @@ public enum ModObject {
itemBasicCapacitor,
itemAlloy,
itemMaterial,
blockFusedQuartz,
itemFusedQuartzFrame,
itemMachinePart,
itemPowderIngot,
blockFusedQuartz,
itemFusedQuartzFrame,
// Machines
blockStirlingGenerator,
@@ -21,7 +21,7 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
//TODO:1.7
// if(!Tessellator.instance.isDrawing) {
// doDraw = true;
// Tessellator.instance.startDrawingQuads();
Tessellator.instance.startDrawingQuads();
// }
IIcon[] textures = new IIcon[6];
textures[0] = block.getBlockTextureFromSide(ForgeDirection.NORTH.ordinal());
@@ -33,9 +33,9 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
CubeRenderer.render(bb, textures, null);
if(doDraw) {
Tessellator.instance.draw();
}
//if(doDraw) {
Tessellator.instance.draw();
//}
}
@Override
@@ -40,7 +40,7 @@ public class BlockPaintedSlab extends BlockSlab implements ITileEntityProvider {
super(isDouble, new Material(MapColor.stoneColor));
this.isDouble = isDouble;
setCreativeTab(null);
setBlockName(ModObject.blockPaintedSlab.unlocalisedName + isDouble);
setBlockName(ModObject.blockPaintedSlab.unlocalisedName + (isDouble ? "Double" : ""));
setHardness(0.5F);
setResistance(5.0F);
setLightOpacity(0);
@@ -109,6 +109,14 @@ public class BlockFusedQuartz extends BlockEio {
return par1;
}
public static int func_150032_b(int p_150032_0_) {
return func_150031_c(p_150032_0_);
}
public static int func_150031_c(int p_150031_0_) {
return ~p_150031_0_ & 15;
}
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < Type.values().length; ++j) {
@@ -177,7 +185,7 @@ public class BlockFusedQuartz extends BlockEio {
if(te instanceof TileEntityPaintedBlock) {
TileEntityPaintedBlock tef = (TileEntityPaintedBlock) te;
ItemStack itemStack = createItemStackForSourceBlock(world.getBlockMetadata(x, y, z), tef.getSourceBlockId(), tef.getSourceBlockMetadata());
ItemStack itemStack = createItemStackForSourceBlock(world.getBlockMetadata(x, y, z), tef.getSourceBlock(), tef.getSourceBlockMetadata());
if(itemStack != null) {
float f = 0.7F;
double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D;
@@ -194,12 +202,12 @@ public class BlockFusedQuartz extends BlockEio {
super.breakBlock(world, x, y, z, par5, par6);
}
private ItemStack createItemStackForSourceBlock(int quartzBlockMeta, String sourceBlockId, int sourceBlockMetadata) {
if(sourceBlockId == null) {
private ItemStack createItemStackForSourceBlock(int quartzBlockMeta, Block sourceBlock, int sourceBlockMetadata) {
if(sourceBlock == null) {
return null;
}
ItemStack result = new ItemStack(EnderIO.instance.itemFusedQuartzFrame, 1, quartzBlockMeta);
PainterUtil.setSourceBlock(result, sourceBlockId, sourceBlockMetadata);
PainterUtil.setSourceBlock(result, sourceBlock, sourceBlockMetadata);
return result;
}
@@ -2,14 +2,19 @@ package crazypants.enderio.material;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import crazypants.render.ConnectedTextureRenderer;
import crazypants.render.ConnectedTextureRenderer.DefaultTextureCallback;
import crazypants.render.CustomCubeRenderer;
import crazypants.render.RenderUtil;
@@ -40,39 +45,35 @@ public class FusedQuartzRenderer implements ISimpleBlockRenderingHandler {
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = blockAccess.getBlockMetadata(x, y, z);
if((meta == 0 && renderPass != 0) || (meta == 1 && renderPass == 0)) {
//TODO:1.7
// TileEntityCustomBlock tecb = null;
// TileEntity te = blockAccess.getTileEntity(x, y, z);
// if(te instanceof TileEntityCustomBlock) {
// tecb = (TileEntityCustomBlock) te;
// }
//renderFrame(blockAccess, x, y, z, tecb, false, meta);
renderFrame(blockAccess, x, y, z, null, false, meta);
TileEntityPaintedBlock tecb = null;
TileEntity te = blockAccess.getTileEntity(x, y, z);
if(te instanceof TileEntityPaintedBlock) {
tecb = (TileEntityPaintedBlock) te;
}
renderFrame(blockAccess, x, y, z, tecb, false, meta);
}
return true;
}
public void renderFrameItem(ItemStack stack) {
//TODO:1.7
// RenderUtil.bindBlockTexture();
// Tessellator.instance.startDrawingQuads();
// TileEntityCustomBlock tecb = new TileEntityCustomBlock();
// tecb.setSourceBlockId(PainterUtil.getSourceBlockId(stack));
// tecb.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack));
// renderFrame(null, 0, 0, 0, tecb, true, stack.getItemDamage());
// Tessellator.instance.draw();
RenderUtil.bindBlockTexture();
Tessellator.instance.startDrawingQuads();
TileEntityPaintedBlock tecb = new TileEntityPaintedBlock();
tecb.setSourceBlock(PainterUtil.getSourceBlock(stack));
tecb.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack));
renderFrame(null, 0, 0, 0, tecb, true, stack.getItemDamage());
Tessellator.instance.draw();
}
//private void renderFrame(IBlockAccess blockAccess, int x, int y, int z, TileEntityCustomBlock tecb, boolean forceAllEdges, int meta) {
private void renderFrame(IBlockAccess blockAccess, int x, int y, int z, Object tecb, boolean forceAllEdges, int meta) {
private void renderFrame(IBlockAccess blockAccess, int x, int y, int z, TileEntityPaintedBlock tecb, boolean forceAllEdges, int meta) {
if(blockAccess == null) {
//No lighting
IIcon texture = EnderIO.blockFusedQuartz.getItemIcon(meta);
for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
// if(tecb != null && tecb.getSourceBlockId() > 0) {
// texture = tecb.getSourceBlock().getIcon(face.ordinal(), tecb.getSourceBlockMetadata());
// }
if(tecb != null && tecb.getSourceBlock() != null) {
texture = tecb.getSourceBlock().getIcon(face.ordinal(), tecb.getSourceBlockMetadata());
}
RenderUtil.renderConnectedTextureFace(blockAccess, x, y, z, face, texture, forceAllEdges);
}
return;
@@ -80,14 +81,14 @@ public class FusedQuartzRenderer implements ISimpleBlockRenderingHandler {
CustomCubeRenderer.instance.setOverrideTexture(EnderIO.blockFusedQuartz.getIcon(0, meta));
// if(tecb != null && tecb.getSourceBlock() != null) {
// connectedTextureRenderer.setEdgeTexureCallback(new DefaultTextureCallback(tecb.getSourceBlock(), tecb.getSourceBlockMetadata()));
// CustomCubeRenderer.instance.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z,
// connectedTextureRenderer);
// } else {
connectedTextureRenderer.setEdgeTexture(EnderIO.blockFusedQuartz.getDefaultFrameIcon(meta));
CustomCubeRenderer.instance.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
// }
if(tecb != null && tecb.getSourceBlock() != null) {
connectedTextureRenderer.setEdgeTexureCallback(new DefaultTextureCallback(tecb.getSourceBlock(), tecb.getSourceBlockMetadata()));
CustomCubeRenderer.instance.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z,
connectedTextureRenderer);
} else {
connectedTextureRenderer.setEdgeTexture(EnderIO.blockFusedQuartz.getDefaultFrameIcon(meta));
CustomCubeRenderer.instance.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
}
CustomCubeRenderer.instance.setOverrideTexture(null);
}
@@ -1,5 +1,7 @@
package crazypants.enderio.material;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -11,6 +13,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.painter.BasicPainterTemplate;
import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
public class ItemFusedQuartzFrame extends Item {
@@ -28,8 +34,7 @@ public class ItemFusedQuartzFrame extends Item {
protected void init() {
GameRegistry.registerItem(this, ModObject.itemFusedQuartzFrame.unlocalisedName);
//TODO:1.7
//MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new FramePainterRecipe());
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new FramePainterRecipe());
}
@Override
@@ -41,20 +46,19 @@ public class ItemFusedQuartzFrame extends Item {
float par9, float par10) {
if(world.getBlock(x, y, z) == EnderIO.blockFusedQuartz) {
//TODO:1.7
// TileEntityCustomBlock tecb = (TileEntityCustomBlock) world.getTileEntity(x, y, z);
// if(tecb == null) {
// return false;
// }
// tecb.setSourceBlockId(PainterUtil.getSourceBlockId(itemStack));
// tecb.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(itemStack));
// world.markBlockForUpdate(x, y, z);
// world.markBlockForRenderUpdate(x, y, z);
// if(!world.isRemote) {
// if(!player.capabilities.isCreativeMode) {
// itemStack.stackSize--;
// }
// }
TileEntityPaintedBlock tecb = (TileEntityPaintedBlock) world.getTileEntity(x, y, z);
if(tecb == null) {
return false;
}
tecb.setSourceBlock(PainterUtil.getSourceBlock(itemStack));
tecb.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(itemStack));
world.markBlockForUpdate(x, y, z);
world.markBlockForUpdate(x, y, z);
if(!world.isRemote) {
if(!player.capabilities.isCreativeMode) {
itemStack.stackSize--;
}
}
return true;
} else {
return false;
@@ -67,38 +71,28 @@ public class ItemFusedQuartzFrame extends Item {
return true;
}
// @Override
// public String getUnlocalizedName(ItemStack par1ItemStack) {
// System.out.println("ItemFusedQuartzFrame.getUnlocalizedName: ");
// return "john";
// }
//
// @Override
// public String getUnlocalizedName() {
// System.out.println("ItemFusedQuartzFrame.getUnlocalizedName: ");
// return super.getUnlocalizedName();
// }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) {
super.addInformation(item, par2EntityPlayer, list, par4);
list.add(PainterUtil.getTooltTipText(item));
}
//TODO:1.7
public static final class FramePainterRecipe extends BasicPainterTemplate {
// @Override
// @SideOnly(Side.CLIENT)
// public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) {
// super.addInformation(item, par2EntityPlayer, list, par4);
// list.add(PainterUtil.getTooltTipText(item));
// }
//
// public static final class FramePainterRecipe extends BasicPainterTemplate {
//
// public FramePainterRecipe() {
// super(ModObject.itemFusedQuartzFrame.actualId);
// }
//
// @Override
// public List<IEnderIoRecipe> getAllRecipes() {
// ItemStack is = new ItemStack(ModObject.itemFusedQuartzFrame.actualId, 1, 0);
// IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, is, is);
// return Collections.singletonList(recipe);
// }
// }
public FramePainterRecipe() {
}
@Override
public boolean isValidTarget(ItemStack target) {
return target != null && target.getItem() == EnderIO.itemFusedQuartzFrame;
}
// @Override
// public List<IEnderIoRecipe> getAllRecipes() {
// ItemStack is = new ItemStack(ModObject.itemFusedQuartzFrame.actualId, 1, 0);
// IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, is, is);
// return Collections.singletonList(recipe);
// }
}
}