Jump to content

Rivendark2013

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Rivendark2013's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. For some reason, copying and pasting a new isOpaqueCube is now getting it to render properly.... no clue why, was spelled right and all. *shrug*
  2. Finally got some time off to add a screenshot to show what i mean, this is looking through the side of my custom tile entity, which isnt solid on all the sides. I know this is possible to do, as i can think of quite a few mods with custom tile entities which dont cover up all of the blocks they touch, but still render the blocks behind and beside them. Any help or pointers would be much appreciated.
  3. Ive gotten my Custom Model in and working just fine right now, but any adjacent blocks next to it wont render the adjacent side, and as such i can see through the world around my block. I cant seem to find any answers for what needs to be set or done to fix this. Ive looked through multiple threads, and things like IronChests to see if they do anything im not or have something set different, but i cant seem to find anything. im going to go out on a limb and assume this is something thats handled with the block, not the TileEntity, but i could be horribly wrong. Here is both just in case. Block class package rivendark.mods.quantumassembly.machines; import java.util.Random; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import rivendark.mods.quantumassembly.QuantumAssembly; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockQuantumStorage extends BlockContainer { public BlockQuantumStorage(int ID, int RID, Class class1) { super(ID, RID, Material.iron); this.setTextureFile(QuantumAssembly.blockTextureFile); this.setBlockName("Rivendark_BlockQuantumStorage"); this.setHardness(5.0F); this.setResistance(150.0F); this.setStepSound(super.soundMetalFootstep); this.setCreativeTab(QuantumAssembly.tabMachine); this.setRequiresSelfNotify(); this.setLightOpacity(1); this.isOpaqueCube(); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are){ TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(tileEntity == null || player.isSneaking()){ return false; } //player.openGui(QuantumAssembly.instance, 0, world, x, y, z); return true; } @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { // dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } private void dropItems(World world, int x, int y, int z) { Random rand = new Random(); TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(!(tileEntity instanceof IInventory)){ return; } IInventory inv = (IInventory) tileEntity; for(int i = 0; i < inv.getSizeInventory(); i++){ ItemStack item = inv.getStackInSlot(i); if(item != null && item.stackSize > 0){ float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.itemID, item.stackSize, item.getItemDamage())); if(item.hasTagCompound()){ entityItem.func_92014_d().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); } float factor = 0.05F; entityItem.motionX = rand.nextGaussian() * factor; entityItem.motionY = rand.nextGaussian() * factor + 0.2F; entityItem.motionZ = rand.nextGaussian() * factor; world.spawnEntityInWorld(entityItem); item.stackSize = 0; } } } @SideOnly(Side.CLIENT) public int getBlockTextureFromSide(int i){ return QuantumAssembly.QuantumStorageBlock_TID; } @Override public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) { int var6 = world.getBlockId(i, j, k - 1); int var7 = world.getBlockId(i, j, k + 1); int var8 = world.getBlockId(i - 1, j, k); int var9 = world.getBlockId(i + 1, j, k); byte chestFacing = 0; int facing = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3; if (facing == 0) { chestFacing = 2; } if (facing == 1) { chestFacing = 5; } if (facing == 2) { chestFacing = 3; } if (facing == 3) { chestFacing = 4; } TileEntity te = world.getBlockTileEntity(i, j, k); if (te != null && te instanceof TileQuantumStorage) { ((TileQuantumStorage) te).setFacing(chestFacing); world.markBlockForUpdate(i, j, k); } } @Override public TileEntity createNewTileEntity(World var1) { return new TileQuantumStorage(); } public TileEntity getBlockEntity(){ return new TileQuantumStorage(); } @Override public int getRenderType(){ return QuantumAssembly.QuantumAssembly_RID; } public boolean isQpaqueCube(){ return false; } @Override public boolean renderAsNormalBlock(){ return false; } public boolean isNormalCube(boolean par1){ return false; } } TileEntity class package rivendark.mods.quantumassembly.machines; import net.minecraft.tileentity.TileEntity; public class TileQuantumStorage extends TileEntity { private byte facing; public TileQuantumStorage(){ } public void setFacing(byte chestFacing) { this.facing = chestFacing; } public byte getFacing(){ return facing; } }
  4. Anybody have any idea how he fixed this? im stuck at the same point, and i just dont understand minecraft coding well enough yet to see the fix for the invisible block.
  5. Thank you, that does help, esp with setting up the inventories and such, but the one thing not there that im having the hardest time with is custom block renders, and how to handle them. Example of what i mean would be the new blulectric motors from RP2.
  6. Ok, i know when im truly stumped. Im trying to figure out how to add a Custom Modeled Chest into the game. The only tutorials ive been able to find are outdated and or done for ModLoader. Ill post the mess i have, in hopes someone can either tell me what ive messed up, or point me to a tutorial or repository that can get me back on track. What i cant figure out is how to go from the outdated ML tutorials, to current forge, and whether i need to render my model as a block, tile entity, ect. Any help will be greatly appriciated. Ill also leave my github repo link here if that makes it easier for people to untangle this mess i have right now. https://github.com/Rivendark/quantumassembly my base file: QuantumAssembly.java public class QuantumAssembly { @Instance("quantumassembly") public static QuantumAssembly instance; public static CreativeTabs tabMachine = new QuantumAssemblyMachineTab(CreativeTabs.getNextID(), "Rivendark_QuantumAssemblyMachineTab"); public static String blockTextureFile = "/gfx/BlankSheet.png"; public static int QuantumStorageBlock_ID = 250; public static int QuantumStorageBlock_IID = -6; public static int QuantumStorageBlock_TID = 0; public static int QuantumStorageBlock_RID; public static Material QuantumStorageBlock_Material = Material.iron; public static Block QuantumStorageBlock = new BlockQuantumStorage(); //public static Item QuantumStorageItemBlock = (new ItemBlockQuantumStorage(QuantumStorageBlock_IID, QuantumStorageBlock) //.setItemName("ItemQuantumStorageBlock")); public static QuantumAssemblyProxy proxy; @Init public void load(FMLInitializationEvent event){ //NetworkRegistry.instance().registerGuiHandler(this, proxy); proxy.registerBlocks(); //proxy.registerTiles(); proxy.addNames(); proxy.addRecipes(); proxy.registerRenderThings(); QuantumStorageBlock.getBlockTextureFromSide(0); } Proxy file: public class QuantumAssemblyProxy implements IGuiHandler { @SidedProxy(clientSide = "rivendark.mods.quantumassembly.core.QuantumAssemblyProxyClient", serverSide = "rivendark.mods.quantumassembly.core.QuantumAssemblyProxy") public static QuantumAssemblyProxy proxy; public void registerRenderThings() { } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // TODO Auto-generated method stub return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { // TODO Auto-generated method stub return null; } public void registerTiles(){ } public void registerBlocks(){ GameRegistry.registerBlock(QuantumAssembly.QuantumStorageBlock, "rivendark_QuantumStorageBlock"); } public void addNames(){ LanguageRegistry.addName(QuantumAssembly.QuantumStorageBlock, "Quantum Storage Unit"); } public void addRecipes(){ } Client Proxy File: public class QuantumAssemblyProxyClient extends QuantumAssemblyProxy { @Override public void registerRenderThings(){ MinecraftForgeClient.preloadTexture(QuantumAssembly.blockTextureFile); //To Do. QuantumAssembly.QuantumStorageBlock_RID = RenderingRegistry.instance().getNextAvailableRenderId(); RenderingRegistry.instance().registerBlockHandler( QuantumAssembly.QuantumStorageBlock_RID,new QuantumStorageBlockRenderer()); } } Block File: public class BlockQuantumStorage extends BlockContainer { public BlockQuantumStorage() { super(QuantumAssembly.QuantumStorageBlock_ID, QuantumAssembly.QuantumStorageBlock_TID, Material.iron); //tileClass = class1; this.setTextureFile(QuantumAssembly.blockTextureFile); this.setBlockName("Rivendark_BlockQuantumStorage"); this.setHardness(5.0F); this.setResistance(150.0F); this.setStepSound(super.soundMetalFootstep); this.setCreativeTab(QuantumAssembly.tabMachine); this.setRequiresSelfNotify(); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are){ TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(tileEntity == null || player.isSneaking()){ return false; } player.openGui(QuantumAssembly.instance, 0, world, x, y, z); return true; } @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { // dropItems(world, x, y, z); super.breakBlock(world, x, y, z, par5, par6); } private void dropItems(World world, int x, int y, int z) { Random rand = new Random(); TileEntity tileEntity = world.getBlockTileEntity(x, y, z); if(!(tileEntity instanceof IInventory)){ return; } IInventory inv = (IInventory) tileEntity; for(int i = 0; i < inv.getSizeInventory(); i++){ ItemStack item = inv.getStackInSlot(i); if(item != null && item.stackSize > 0){ float rx = rand.nextFloat() * 0.8F + 0.1F; float ry = rand.nextFloat() * 0.8F + 0.1F; float rz = rand.nextFloat() * 0.8F + 0.1F; EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.itemID, item.stackSize, item.getItemDamage())); if(item.hasTagCompound()){ entityItem.func_92014_d().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); } float factor = 0.05F; entityItem.motionX = rand.nextGaussian() * factor; entityItem.motionY = rand.nextGaussian() * factor + 0.2F; entityItem.motionZ = rand.nextGaussian() * factor; world.spawnEntityInWorld(entityItem); item.stackSize = 0; } } } @SideOnly(Side.CLIENT) public int getBlockTextureFromSide(int i){ return QuantumAssembly.QuantumStorageBlock_TID; } @Override public TileEntity createNewTileEntity(World var1) { return new TileQuantumStorage(); } public TileEntity getBlockEntity(){ return new TileQuantumStorage(); } public int getRenderType(){ return QuantumAssembly.QuantumStorageBlock_RID; } public boolean isQpaqueCube(){ return false; } public boolean renderAsNormalBlock(){ return false; } TileEntityRenderer File: public class QuantumStorageTileEntityRenderer extends TileEntitySpecialRenderer { private QuantumStorageModel quantumStorageModel; public QuantumStorageTileEntityRenderer(){ quantumStorageModel = new QuantumStorageModel(); } @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { renderAModelAt((TileQuantumStorage) tile, x, y, z, f); } public void renderAModelAt(TileQuantumStorage tile, double x, double y, double z, float f){ bindTextureByName("../core/gfx/QuantumStorageTexture.png"); GL11.glPushMatrix(); GL11.glTranslatef((float)+x + 0.5F, (float)+y + 0.5F, (float)+z + 0.5F); GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.0F, -1F, -1F); quantumStorageModel.renderModel(0.0625F); GL11.glPopMatrix(); } } Tile File: public class TileQuantumStorage extends TileEntity implements IInventory { private ItemStack[] inv; public TileQuantumStorage(){ } @Override public int getSizeInventory() { // TODO Auto-generated method stub return 0; } @Override public ItemStack getStackInSlot(int var1) { // TODO Auto-generated method stub return null; } @Override public ItemStack decrStackSize(int var1, int var2) { // TODO Auto-generated method stub return null; } @Override public ItemStack getStackInSlotOnClosing(int var1) { // TODO Auto-generated method stub return null; } @Override public void setInventorySlotContents(int var1, ItemStack var2) { // TODO Auto-generated method stub } @Override public String getInvName() { // TODO Auto-generated method stub return null; } @Override public int getInventoryStackLimit() { // TODO Auto-generated method stub return 0; } @Override public boolean isUseableByPlayer(EntityPlayer var1) { // TODO Auto-generated method stub return false; } @Override public void openChest() { // TODO Auto-generated method stub } @Override public void closeChest() { // TODO Auto-generated method stub } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.