Jump to content

ninjapancakes87

Members
  • Posts

    81
  • Joined

  • Last visited

Everything posted by ninjapancakes87

  1. No I bound my texture with this.func_110628_a(texture); in my renderTileEntityAt method before I load my model.
  2. Ok I will try doing that. In the meantime, do you know how to fix the particle glitch I mentioned?
  3. The first public release that LexManos made a page for, I believe it is 9.10.0 Edit: 9.10.0.789, to be specific
  4. I called func111022_d to set field_111026_f, and that fixed that error message. As for initializing my block too soon, I thought with the new @EventHandler notation you were supposed to initialize blocks and items in your PreInit stage (or so the javadocs say)
  5. I have a block with a custom model, and when I hit the block the particles are purple and black checkers. The texture renders just fine on my block. I saw the methods addBlockHitEffects and addBlockBreakEffects, do those control the texture? Also, I saw in my console it says: 2013-08-08 17:33:00 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_3921_null.png which leads me into my second topic: I get this error message: 2013-08-08 17:33:01 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: civil war:textures/items/*item name*.png This error prints even though my textures load just fine. Does anybody know how to fix either or both of these problems? Thanks Ninjapancakes87
  6. How do you attach a block to another block? Do you just set the block in front of it to be an invisible block? Edit: never mind, going through the code for the bed now. They map the two blocks together apparently
  7. I know the door spawns itself in two seperate blocks. Could it be possible to shrink it to 2x1x1 (two long, one wide, one tall) and spawn the two blocks together? Edit: Oh yeah, duh, the bed does that.
  8. So I've been working on a mod for a while, and it adds a new block, a cannon. The block is 2x1x2, or two wide, two long and one high. In my constructor I called this.setBlockBounds(minX,minY,minZ,maxX,maxY,maxZ). However, this doesnt change the collision bounding box, only the outline of the box when you select it. I had a look at BlockDoor, BlockWall, BlockFence, but copying and modifying their methods doesnt seem to be doing anything for me. Does anybody know how to properly go about this?
  9. Im getting the unable to load console spam, but my textures work so I will just stick with it
  10. That does not solve my issue... it actually makes it worse. Is this in 1.6.2? I believe both of those classes were added as of the 1.6.2 update
  11. How did you register your dispenser behavior? I see a putObject method in RegistrySimple, but I don't know what the second object is for. Apologies for commenting on the solved thread, I'm just curious as to how you did it.
  12. Does your annotation look like this? It doesnt matter if you have either one set differently @NetworkMod(clientSideRequired = true, serverSideRequired = false) Post your main mod file please
  13. The way I would do it is I would create just one class, and have the constructor be something like public int whichSword public Item Sword; public ItemSwords(int par1, EnumToolMaterial par2EnumToolMaterial, int par3){ this.whichSword = par3 this.getSword(par3) = this.sword super (par1, par2EnumToolMaterial) } You could then have getSword return which sword you wanted, and then make a method that sets the attributes of that sword based on what getSword returned. As for that other method, it looks like it already exists, so you could just call it and say you want the sword to have that attribute. You could copy it into your mod_XXX file and call it from there if you wanted.
  14. Two questions: 1: have you done .setUnlocalizedName("Mod:block.png") when you initialized the block? 2: did you use a tile entity in that block? if so what line did you put in your main mod file to register the renderer to the tile entity?
  15. Define "editable". Do you mean you can eat it? You can't eat nether wart but you would probably have to make a netherwart class and have it extend ItemFood. If you want to be required to shift click, just say if(par1EntityPlayer.isSneaking) or whatever it is. For the gunpowder you have to make it extend ItemFood, and then you could start a timer lasting for a certain amount of ticks, and then at the end you would stop the timer, do par1World.createExplosion(x,y,z) where x y and z are the coordinates of the player. Then you would probably have to do .setDead, or maybe it will already do that when you explode.
  16. Thanks guys I tried both of your methods (pun intended ) but neither of them changed anything. I have in my main mod file now ClientRegistry.registerTileEntity(TileEntityCannon.class, "ninjapancakes87.civilwar.common.block.cannon", new TileEntityCannonRenderer()); And all I have is the TileEntityCannonRenderer file. package ninjapancakes87.civilwar.common.block.cannon; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Calendar; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.client.model.ModelChest; import net.minecraft.client.model.ModelLargeChest; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.world.IBlockAccess; import ninjapancakes87.civilwar.common.CivilWar; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class TileEntityCannonRenderer extends TileEntitySpecialRenderer { /** The normal small chest model. */ private ModelCannon model; private TileEntityCannon cannonTE = new TileEntityCannon(); public TileEntityCannonRenderer() { this.model = new ModelCannon(); } public void renderAModelAt(TileEntityCannon tileentity1, double d, double d1, double d2, float f) { GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.52F, (float)d2 + 0.5F); GL11.glRotatef(180F, 0F, 0F, 1F); bindTextureByName("/mods/Civil War/textures/blocks/cannon.png"); GL11.glPushMatrix(); this.model.render((Entity)null, 0.0F, 0.0F, 0.0F,0.0F,0.0F,0.0F); GL11.glPopMatrix(); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { renderAModelAt((TileEntityCannon)tileentity, d, d1, d2, f); } } I got rid of my two render files and just have this
  17. I am making a mod and am finding I can't get my custom block model to render correctly. I have all the correct classes, but instead of showing my custom model (made in techne) it just shows the texture I have for it as each side of a block. BlockCannon: package ninjapancakes87.civilwar.common.block.cannon; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.DataWatcher; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import ninjapancakes87.civilwar.common.CivilWar; import ninjapancakes87.civilwar.common.Registry; import ninjapancakes87.civilwar.common.item.EntityCannonBall; public class BlockCannon extends BlockContainer { public BlockCannon(int id) { super(id, Material.iron); this.setCreativeTab(CivilWar.tabCivilWar); } public TileEntityCannon te; public ChunkCoordinates coord; public DataWatcher dataWatcher; public World worldObj; public boolean isLoaded = false; protected static int x; protected static int y; protected static int z; @Override public void onBlockAdded(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 4); } } public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { int item = par5EntityPlayer.getCurrentEquippedItem().itemID; if(item == Registry.cannonball.itemID){ if(par1World.isRemote){ setLoaded(par5EntityPlayer); par5EntityPlayer.inventory.consumeInventoryItem(Registry.cannonball.itemID); return true; } } else if(getIsLoaded().equals("true") && item == Item.gunpowder.itemID){ fire(getCoord(1), getCoord(2), getCoord(3)); setUnLoaded(); return true; } else{ return false; } return false; } public TileEntity createNewTileEntity(World var1) { return new TileEntityCannon(); } @Override public int getRenderType() { return Registry.renderId; } @Override public boolean renderAsNormalBlock() { return false; } @Override public boolean isOpaqueCube() { return false; } public void setLoaded(EntityPlayer player){ this.isLoaded = true;; player.addChatMessage(getIsLoaded()); } public void setUnLoaded(){ this.isLoaded = false; } public String getIsLoaded(){ //return this.isLoaded; if(this.isLoaded = true){ return "true"; } if(this.isLoaded = false){ return "false"; } return ""; } public double getCoord(int par1){ switch(par1){ case 1: return coord.posX; case 2: return coord.posY; case 3: return coord.posZ; default: return 1; } } public void fire(double x, double y, double z){ EntityCannonBall entity = new EntityCannonBall(worldObj); entity.setLocationAndAngles(x,y,z, 0.0F, 0.0F); worldObj.spawnEntityInWorld(entity); worldObj.spawnParticle("smoke", getCoord(1), getCoord(2), getCoord(3), 1,1,1); setUnLoaded(); } } TileEntityCannon: package ninjapancakes87.civilwar.common.block.cannon; import net.minecraft.entity.DataWatcher; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.common.ForgeDirection; import ninjapancakes87.civilwar.common.item.EntityCannonBall; public class TileEntityCannon extends TileEntity{ public ForgeDirection rotation = null; protected DataWatcher dataWatcher; public NBTTagCompound nbt = new NBTTagCompound(); public BlockCannon cannon; @Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); //tag.setBoolean("loaded", isLoaded); tag.setByte("Direction", (byte)rotation.ordinal()); } @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); rotation = ForgeDirection.VALID_DIRECTIONS[tag.getByte("direction")]; //isLoaded = tag.getBoolean("loaded"); } public void getDescriptionForClient(NBTTagCompound nbt) { nbt.setByte("direction", (byte) rotation.ordinal()); } public void onUpdatePacket(NBTTagCompound nbt) { if(nbt.hasKey("direction")) rotation = ForgeDirection.VALID_DIRECTIONS[nbt.getByte("direction")]; } public void onDescriptionPacket(NBTTagCompound nbt) { rotation = ForgeDirection.VALID_DIRECTIONS[nbt.getByte("direction")]; } @Override public void updateEntity() { } static{ addMapping(TileEntityCannon.class, "Cannon"); } } TileEntityCannonRenderer: package ninjapancakes87.civilwar.common.block.cannon; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import ninjapancakes87.civilwar.common.Registry; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import java.util.Random; public class TileEntityCannonRenderer extends TileEntitySpecialRenderer { private ModelCannon model; public TileEntityCannonRenderer() { model = new ModelCannon(); } public void renderAModelAt(TileEntityCannon tile, double d, double d1, double d2, float f) { bindTextureByName("/mods/Civil War/textures/blocks/cannon.png"); /*GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); //size GL11.glRotatef(0, 0.0F, 1.0F, 0.0F);// change the first 0 in like 90 to make it rotate 90 degrees. GL11.glScalef(1.0F, -1F, -1F); // to make your Block have a normal positioning. comment out to see what happens GL11.glPopMatrix();*/ } public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { renderAModelAt((TileEntityCannon) tileentity, d, d1, d2, f); } } RenderCannon: package ninjapancakes87.civilwar.common.block.cannon; import org.lwjgl.opengl.GL11; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import ninjapancakes87.civilwar.common.Registry; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderCannon implements ISimpleBlockRenderingHandler{ @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { TileEntityRenderer.instance.renderTileEntityAt(new TileEntityCannon(), 0.0D, 0.0D, 0.0D, 0.0F); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { TileEntity tempTile = world.getBlockTileEntity(x, y, z); if(tempTile!=null) { renderTileEntityAt(tempTile,(double)x,(double)y,(double)z,1.0F); return true; } return false; } @Override public boolean shouldRender3DInInventory() { return true; } public int getRenderId() { return 0; } public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) { renderAModelAt((TileEntityCannon)tileentity, d, d1, d2, f); } public void renderAModelAt(TileEntityCannon tileentity1, double d, double d1, double d2, float f) { GL11.glPushMatrix(); { Minecraft.getMinecraft().renderEngine.bindTexture("/mods/Civil War/textures/blocks/cannon.png"); GL11.glTranslatef((float) d + 1.F, (float) d1 + 1.5F, (float) d2 + 1.5F); GL11.glPushMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); } } ModelCannon: package ninjapancakes87.civilwar.common.block.cannon; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelCannon extends ModelBase { ModelRenderer Bwheel2; ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape31; ModelRenderer Shape4; ModelRenderer Shape5; ModelRenderer Shape6; ModelRenderer Shape7; ModelRenderer Shape8; ModelRenderer Shape9; ModelRenderer Shape10; ModelRenderer Shape11; ModelRenderer Bwheel1; ModelRenderer Shape12; ModelRenderer Shape13; ModelRenderer Shape14; ModelRenderer Shape15; ModelRenderer Shape16; ModelRenderer Shape17; ModelRenderer Shape18; ModelRenderer Shape19; ModelRenderer Shape20; ModelRenderer Shape21; ModelRenderer Shape22; ModelRenderer Shape23; ModelRenderer Shape24; ModelRenderer Shape25; ModelRenderer Shape26; ModelRenderer Shape27; ModelRenderer Shape28; ModelRenderer Shape29; ModelRenderer Shape30; ModelRenderer Shape301; ModelRenderer Shape291; ModelRenderer Shape292; ModelRenderer Shape271; ModelRenderer Shape311; ModelRenderer Shape32; ModelRenderer Shape322; ModelRenderer Shape33; ModelRenderer Shape331; ModelRenderer Shape34; public ModelCannon() { textureWidth = 64; textureHeight = 64; Bwheel2 = new ModelRenderer(this, 4, 0); Bwheel2.addBox(0F, 0F, 0F, 4, 1, 1); Bwheel2.setRotationPoint(-1F, 23F, -6F); Bwheel2.setTextureSize(64, 64); Bwheel2.mirror = true; setRotation(Bwheel2, 0F, 0F, 0F); Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 1, 1, 1); Shape1.setRotationPoint(3F, 22F, -6F); Shape1.setTextureSize(64, 64); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 0); Shape2.addBox(0F, 0F, 0F, 1, 1, 1); Shape2.setRotationPoint(-2F, 22F, -6F); Shape2.setTextureSize(64, 64); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 8, 2); Shape3.addBox(0F, 0F, 0F, 1, 4, 1); Shape3.setRotationPoint(-3F, 18F, -6F); Shape3.setTextureSize(64, 64); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape31 = new ModelRenderer(this, 8, 2); Shape31.addBox(0F, 0F, 0F, 1, 4, 1); Shape31.setRotationPoint(4F, 18F, -6F); Shape31.setTextureSize(64, 64); Shape31.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 0, 0); Shape4.addBox(0F, 0F, 0F, 1, 1, 1); Shape4.setRotationPoint(-2F, 17F, -6F); Shape4.setTextureSize(64, 64); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0F); Shape5 = new ModelRenderer(this, 0, 0); Shape5.addBox(0F, 0F, 0F, 1, 1, 1); Shape5.setRotationPoint(3F, 17F, -6F); Shape5.setTextureSize(64, 64); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 4, 12); Shape6.addBox(0F, 0F, 0F, 4, 1, 1); Shape6.setRotationPoint(-1F, 16F, -6F); Shape6.setTextureSize(64, 64); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape7 = new ModelRenderer(this, 0, 2); Shape7.addBox(0F, 0F, 0F, 1, 1, 1); Shape7.setRotationPoint(2F, 18F, -6F); Shape7.setTextureSize(64, 64); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); Shape8 = new ModelRenderer(this, 0, 2); Shape8.addBox(0F, 0F, 0F, 1, 1, 1); Shape8.setRotationPoint(-1F, 18F, -6F); Shape8.setTextureSize(64, 64); Shape8.mirror = true; setRotation(Shape8, 0F, 0F, 0F); Shape9 = new ModelRenderer(this, 0, 17); Shape9.addBox(0F, 0F, 0F, 2, 2, 1); Shape9.setRotationPoint(0F, 19F, -6F); Shape9.setTextureSize(64, 64); Shape9.mirror = true; setRotation(Shape9, 0F, 0F, 0F); Shape10 = new ModelRenderer(this, 0, 2); Shape10.addBox(0F, 0F, 0F, 1, 1, 1); Shape10.setRotationPoint(2F, 21F, -6F); Shape10.setTextureSize(64, 64); Shape10.mirror = true; setRotation(Shape10, 0F, 0F, 0F); Shape11 = new ModelRenderer(this, 0, 2); Shape11.addBox(0F, 0F, 0F, 1, 1, 1); Shape11.setRotationPoint(-1F, 21F, -6F); Shape11.setTextureSize(64, 64); Shape11.mirror = true; setRotation(Shape11, 0F, 0F, 0F); Bwheel1 = new ModelRenderer(this, 4, 0); Bwheel1.addBox(0F, 0F, 0F, 4, 1, 1); Bwheel1.setRotationPoint(-1F, 23F, 5F); Bwheel1.setTextureSize(64, 64); Bwheel1.mirror = true; setRotation(Bwheel1, 0F, 0F, 0F); Shape12 = new ModelRenderer(this, 0, 0); Shape12.addBox(0F, 0F, 0F, 1, 1, 1); Shape12.setRotationPoint(3F, 22F, 5F); Shape12.setTextureSize(64, 64); Shape12.mirror = true; setRotation(Shape12, 0F, 0F, 0F); Shape13 = new ModelRenderer(this, 0, 0); Shape13.addBox(0F, 0F, 0F, 1, 1, 1); Shape13.setRotationPoint(-2F, 22F, 5F); Shape13.setTextureSize(64, 64); Shape13.mirror = true; setRotation(Shape13, 0F, 0F, 0F); Shape14 = new ModelRenderer(this, 8, 2); Shape14.addBox(0F, 0F, 0F, 1, 4, 1); Shape14.setRotationPoint(4F, 18F, 5F); Shape14.setTextureSize(64, 64); Shape14.mirror = true; setRotation(Shape14, 0F, 0F, 0F); Shape15 = new ModelRenderer(this, 8, 2); Shape15.addBox(0F, 0F, 0F, 1, 4, 1); Shape15.setRotationPoint(-3F, 18F, 5F); Shape15.setTextureSize(64, 64); Shape15.mirror = true; setRotation(Shape15, 0F, 0F, 0F); Shape16 = new ModelRenderer(this, 0, 0); Shape16.addBox(0F, 0F, 0F, 1, 1, 1); Shape16.setRotationPoint(3F, 17F, 5F); Shape16.setTextureSize(64, 64); Shape16.mirror = true; setRotation(Shape16, 0F, 0F, 0F); Shape17 = new ModelRenderer(this, 0, 0); Shape17.addBox(0F, 0F, 0F, 1, 1, 1); Shape17.setRotationPoint(-2F, 17F, 5F); Shape17.setTextureSize(64, 64); Shape17.mirror = true; setRotation(Shape17, 0F, 0F, 0F); Shape18 = new ModelRenderer(this, 4, 12); Shape18.addBox(0F, 0F, 0F, 4, 1, 1); Shape18.setRotationPoint(-1F, 16F, 5F); Shape18.setTextureSize(64, 64); Shape18.mirror = true; setRotation(Shape18, 0F, 0F, 0F); Shape19 = new ModelRenderer(this, 0, 2); Shape19.addBox(0F, 0F, 0F, 1, 1, 1); Shape19.setRotationPoint(-1F, 18F, 5F); Shape19.setTextureSize(64, 64); Shape19.mirror = true; setRotation(Shape19, 0F, 0F, 0F); Shape20 = new ModelRenderer(this, 0, 2); Shape20.addBox(0F, 0F, 0F, 1, 1, 1); Shape20.setRotationPoint(2F, 18F, 5F); Shape20.setTextureSize(64, 64); Shape20.mirror = true; setRotation(Shape20, 0F, 0F, 0F); Shape21 = new ModelRenderer(this, 0, 2); Shape21.addBox(0F, 0F, 0F, 1, 1, 1); Shape21.setRotationPoint(2F, 21F, 5F); Shape21.setTextureSize(64, 64); Shape21.mirror = true; setRotation(Shape21, 0F, 0F, 0F); Shape22 = new ModelRenderer(this, 0, 2); Shape22.addBox(0F, 0F, 0F, 1, 1, 1); Shape22.setRotationPoint(-1F, 21F, 5F); Shape22.setTextureSize(64, 64); Shape22.mirror = true; setRotation(Shape22, 0F, 0F, 0F); Shape23 = new ModelRenderer(this, 0, 17); Shape23.addBox(0F, 0F, 0F, 2, 2, 1); Shape23.setRotationPoint(0F, 19F, 5F); Shape23.setTextureSize(64, 64); Shape23.mirror = true; setRotation(Shape23, 0F, 0F, 0F); Shape24 = new ModelRenderer(this, 0, 20); Shape24.addBox(0F, 0F, 0F, 1, 1, 10); Shape24.setRotationPoint(0F, 19F, -5F); Shape24.setTextureSize(64, 64); Shape24.mirror = true; setRotation(Shape24, 0F, 0F, 0F); Shape25 = new ModelRenderer(this, 0, 20); Shape25.addBox(0F, 0F, 0F, 1, 1, 10); Shape25.setRotationPoint(1F, 20F, -5F); Shape25.setTextureSize(64, 64); Shape25.mirror = true; setRotation(Shape25, 0F, 0F, 0F); Shape26 = new ModelRenderer(this, 0, 31); Shape26.addBox(0F, 0F, 0F, 5, 1, 2); Shape26.setRotationPoint(2F, 20F, -1F); Shape26.setTextureSize(64, 64); Shape26.mirror = true; setRotation(Shape26, 0F, 0F, 0.7330383F); Shape27 = new ModelRenderer(this, 36, 0); Shape27.addBox(0F, 0F, 0F, 13, 1, 2); Shape27.setRotationPoint(-10F, 18F, -1F); Shape27.setTextureSize(64, 64); Shape27.mirror = true; setRotation(Shape27, 0F, 0F, 0F); Shape28 = new ModelRenderer(this, 38, 4); Shape28.addBox(0F, 0F, 0F, 13, 1, 1); Shape28.setRotationPoint(-10F, 17F, -2F); Shape28.setTextureSize(64, 64); Shape28.mirror = true; setRotation(Shape28, 0F, 0F, 0F); Shape29 = new ModelRenderer(this, 38, 4); Shape29.addBox(0F, 0F, 0F, 13, 1, 1); Shape29.setRotationPoint(-10F, 17F, 1F); Shape29.setTextureSize(64, 64); Shape29.mirror = true; setRotation(Shape29, 0F, 0F, 0F); Shape30 = new ModelRenderer(this, 38, 7); Shape30.addBox(0F, 0F, 0F, 13, 2, 1); Shape30.setRotationPoint(-10F, 15F, 2F); Shape30.setTextureSize(64, 64); Shape30.mirror = true; setRotation(Shape30, 0F, 0F, 0F); Shape301 = new ModelRenderer(this, 38, 7); Shape301.addBox(0F, 0F, 0F, 13, 2, 1); Shape301.setRotationPoint(-10F, 15F, -3F); Shape301.setTextureSize(64, 64); Shape301.mirror = true; setRotation(Shape30, 0F, 0F, 0F); Shape291 = new ModelRenderer(this, 38, 4); Shape291.addBox(0F, 0F, 0F, 13, 1, 1); Shape291.setRotationPoint(-10F, 14F, 1F); Shape291.setTextureSize(64, 64); Shape291.mirror = true; setRotation(Shape29, 0F, 0F, 0F); Shape292 = new ModelRenderer(this, 38, 4); Shape292.addBox(0F, 0F, 0F, 13, 1, 1); Shape292.setRotationPoint(-10F, 14F, -2F); Shape292.setTextureSize(64, 64); Shape292.mirror = true; setRotation(Shape29, 0F, 0F, 0F); Shape271 = new ModelRenderer(this, 36, 0); Shape271.addBox(0F, 0F, 0F, 13, 1, 2); Shape271.setRotationPoint(-10F, 13F, -1F); Shape271.setTextureSize(64, 64); Shape271.mirror = true; setRotation(Shape27, 0F, 0F, 0F); Shape311 = new ModelRenderer(this, 58, 12); Shape311.addBox(0F, 0F, 0F, 1, 2, 2); Shape311.setRotationPoint(2F, 15F, -1F); Shape311.setTextureSize(64, 64); Shape311.mirror = true; setRotation(Shape31, 0F, 0F, 0F); Shape32 = new ModelRenderer(this, 58, 17); Shape32.addBox(0F, 0F, 0F, 1, 1, 2); Shape32.setRotationPoint(2F, 14F, -1F); Shape32.setTextureSize(64, 64); Shape32.mirror = true; setRotation(Shape32, 0F, 0F, 0F); Shape322 = new ModelRenderer(this, 58, 17); Shape322.addBox(0F, 0F, 0F, 1, 1, 2); Shape322.setRotationPoint(2F, 17F, -1F); Shape322.setTextureSize(64, 64); Shape322.mirror = true; setRotation(Shape32, 0F, 0F, 0F); Shape33 = new ModelRenderer(this, 60, 21); Shape33.addBox(0F, 0F, 0F, 1, 2, 1); Shape33.setRotationPoint(2F, 15F, -2F); Shape33.setTextureSize(64, 64); Shape33.mirror = true; setRotation(Shape33, 0F, 0F, 0F); Shape331 = new ModelRenderer(this, 60, 21); Shape331.addBox(0F, 0F, 0F, 1, 2, 1); Shape331.setRotationPoint(2F, 15F, 1F); Shape331.setTextureSize(64, 64); Shape331.mirror = true; setRotation(Shape33, 0F, 0F, 0F); Shape34 = new ModelRenderer(this, 56, 25); Shape34.addBox(0F, 0F, 0F, 3, 1, 1); Shape34.setRotationPoint(2F, 15F, 0F); Shape34.setTextureSize(64, 64); Shape34.mirror = true; setRotation(Shape34, 0F, 0F, -0.5061455F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Bwheel2.render(f5); Shape1.render(f5); Shape2.render(f5); Shape3.render(f5); Shape3.render(f5); Shape4.render(f5); Shape5.render(f5); Shape6.render(f5); Shape7.render(f5); Shape8.render(f5); Shape9.render(f5); Shape10.render(f5); Shape11.render(f5); Bwheel1.render(f5); Shape12.render(f5); Shape13.render(f5); Shape14.render(f5); Shape15.render(f5); Shape16.render(f5); Shape17.render(f5); Shape18.render(f5); Shape19.render(f5); Shape20.render(f5); Shape21.render(f5); Shape22.render(f5); Shape23.render(f5); Shape24.render(f5); Shape25.render(f5); Shape26.render(f5); Shape27.render(f5); Shape28.render(f5); Shape29.render(f5); Shape30.render(f5); Shape30.render(f5); Shape29.render(f5); Shape29.render(f5); Shape27.render(f5); Shape31.render(f5); Shape32.render(f5); Shape32.render(f5); Shape33.render(f5); Shape33.render(f5); Shape34.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } here is the code I used to register the renderer in my main mod class: GameRegistry.registerTileEntity(TileEntityCannon.class, "ninjapancakes87.civilwar.common.block.cannon"); RenderingRegistry.instance().registerBlockHandler(new RenderCannon());
  18. Hi I am making a mod and using some wolf code for a "tameable soldier." I am using the exact same code the wolf uses to save and load it's "isAngry" data. However, for me it throws an error saying cannot convert from an Integer to a Byte. Help? EntitySoldier_Union code: package ninjapancakes87.civilwar.common.campUnion.soldier; import cpw.mods.fml.common.registry.VillagerRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockCloth; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.IMerchant; import net.minecraft.entity.INpc; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAvoidEntity; import net.minecraft.entity.ai.EntityAIFollowGolem; import net.minecraft.entity.ai.EntityAILookAtTradePlayer; import net.minecraft.entity.ai.EntityAIMoveIndoors; import net.minecraft.entity.ai.EntityAIMoveTwardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIOpenDoor; import net.minecraft.entity.ai.EntityAIPlay; import net.minecraft.entity.ai.EntityAIRestrictOpenDoor; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITradePlayer; import net.minecraft.entity.ai.EntityAIVillagerMate; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.EntityAIWatchClosest2; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathEntity; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.Tuple; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.village.Village; import net.minecraft.world.World; import ninjapancakes87.civilwar.common.CivilWar; import ninjapancakes87.civilwar.common.campConfederate.soldierConF.EntitySoldier_Rebel; import ninjapancakes87.civilwar.common.item.EntityMusketBall; public class EntitySoldier_Union extends EntityTameable implements INpc, IRangedAttackMob { private int randomTickDivider; /** addDefaultEquipmentAndRecipies is called if this is true */ private boolean needsInitilization; /** Last player to trade with this villager, used for aggressivity. */ private String lastBuyingPlayer; private boolean field_82190_bM; private float field_82191_bN; public Class EntitySoldier_Rebel; public EntitySoldier_Union(World par1World) { this(par1World, 0); } public EntitySoldier_Union(World par1World, int par2) { super(par1World); this.randomTickDivider = 0; this.setProfession(par2); this.texture = "/mods/Civil War/textures/mob/UnionSoldier.png"; this.moveSpeed = 0.5F; this.addDefaultEquipment(); this.setSize(0.6F, 1.8F); this.getNavigator().setBreakDoors(true); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntitySoldier_Union.class, 5.0F, 0.02F)); this.tasks.addTask(9, new EntityAIWander(this, 0.3F)); this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); //this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntitySoldier_Rebel, 50, 100, true)); //this.targetTasks.addTask(2, new EntityAIArrowAttack(this, field_82191_bN, par2, field_82191_bN)); } public boolean isAIEnabled() { return true; } /** * Sets the active target the Task system uses for tracking */ public void setAttackTarget(EntityLiving par1EntityLiving) { super.setAttackTarget(par1EntityLiving); if (par1EntityLiving instanceof EntityPlayer) { this.setAngry(true); } } /** * main AI tick function, replaces updateEntityActionState */ protected void updateAITick() { this.dataWatcher.updateObject(18, Integer.valueOf(this.getHealth())); } public int getMaxHealth() { return this.isTamed() ? 20 : 8; } protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, new Integer(this.getHealth())); this.dataWatcher.addObject(19, new Byte((byte)0)); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); par1NBTTagCompound.setInteger("Profession", this.getProfession()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); this.setProfession(par1NBTTagCompound.getInteger("Profession")); } /** * Determines if an entity can be despawned, used on idle far away entities */ protected boolean canDespawn() { return this.isAngry() && !this.isTamed(); } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } /** * Returns the item ID for the item the mob drops on death. */ protected int getDropItemId() { return -1; } /** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (this.isEntityInvulnerable()) { return false; } else { Entity entity = par1DamageSource.getEntity(); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1) / 2; } return super.attackEntityFrom(par1DamageSource, par2); } } public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), i); } @SideOnly(Side.CLIENT) public void handleHealthUpdate(byte par1) { super.handleHealthUpdate(par1); } /** * Determines whether this wolf is angry or not. */ public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } /** * Sets whether this wolf is angry or not. */ public void setAngry(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); } } public void func_70918_i(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(19); if (par1) { this.dataWatcher.updateObject(19, Byte.valueOf((byte)1)); } else { this.dataWatcher.updateObject(19, Byte.valueOf((byte)0)); } } /** * Returns true if the mob is currently able to mate with the specified mob. */ public boolean canMateWith(EntityAnimal par1EntityAnimal) { return false; } public boolean func_70922_bv() { return this.dataWatcher.getWatchableObjectByte(19) == 1; } @Override public void attackEntityWithRangedAttack(EntityLiving par1EntityLiving, float par2) { EntityMusketBall entityarrow = new EntityMusketBall(this.worldObj, this, par1EntityLiving, 1.6F, (float)(14 - this.worldObj.difficultySetting * 4)); this.playSound("Civil War.gunshot", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.worldObj.spawnEntityInWorld(entityarrow); } @Override public EntityAgeable createChild(EntityAgeable entityageable) { return null; } public int getMaxSpawnedInChunk() { return 16; } public boolean isBreedingItem(ItemStack par1ItemStack) { return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat()); } public String getProfessionName(int par1){ switch(par1){ case 0: return "Commander"; case 1: return "Captain"; case 2: return "Doctor"; case 3: return "Barracks Master"; case 4: return "Soldier"; default: return "Soldier"; } } private void addDefaultEquipment() { switch (this.getProfession()) { case 0: this.setCurrentItemOrArmor(1,new ItemStack(setArmor(1))); this.setCurrentItemOrArmor(2,new ItemStack(setArmor(2))); this.setCurrentItemOrArmor(3,new ItemStack(setArmor(3))); this.setCurrentItemOrArmor(4,new ItemStack(setArmor(4))); case 1: this.setCurrentItemOrArmor(1,new ItemStack(setArmor(1))); this.setCurrentItemOrArmor(2,new ItemStack(setArmor(2))); this.setCurrentItemOrArmor(3,new ItemStack(setArmor(3))); this.setCurrentItemOrArmor(4,new ItemStack(setArmor(4))); case 2: this.setCurrentItemOrArmor(0, new ItemStack(Item.appleRed)); case 3: this.setCurrentItemOrArmor(1,new ItemStack(setArmor(1))); this.setCurrentItemOrArmor(2,new ItemStack(setArmor(2))); this.setCurrentItemOrArmor(3,new ItemStack(setArmor(3))); this.setCurrentItemOrArmor(4,new ItemStack(setArmor(4))); case 4: this.setCurrentItemOrArmor(1,new ItemStack(setArmor(1))); this.setCurrentItemOrArmor(2,new ItemStack(setArmor(2))); this.setCurrentItemOrArmor(3,new ItemStack(setArmor(3))); this.setCurrentItemOrArmor(4,new ItemStack(setArmor(4))); } } protected Item setArmor(int par1){ Item i = null; if(par1 == 1){ i = CivilWar.clothhelmet; } else if(par1 == 2){ i = CivilWar.clothchestplate; } else if(par1 == 3){ i = CivilWar.clothlegs; } else if(par1 == 4){ i = CivilWar.clothboots; } return i; } public void setProfession(int par1) { this.dataWatcher.updateObject(16, Integer.valueOf(par1)); } public int getProfession() { return this.dataWatcher.getWatchableObjectInt(16); } protected String getLivingSound() { return "mob.villager.default"; } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "Civil War.hurt"; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "Civil War.hurt"; } public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); if (this.isTamed()) { if (itemstack != null) { if (Item.itemsList[itemstack.itemID] instanceof ItemFood) { ItemFood itemfood = (ItemFood)Item.itemsList[itemstack.itemID]; if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < 20) { if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal(itemfood.getHealAmount()); if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); } return true; } } } if (par1EntityPlayer.username.equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) { this.isJumping = false; this.setPathToEntity((PathEntity)null); } } else if (itemstack != null && itemstack.itemID == CivilWar.coin.itemID && !this.isAngry()) { if (!par1EntityPlayer.capabilities.isCreativeMode) { --itemstack.stackSize; } if (itemstack.stackSize <= 0) { par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); } if (!this.worldObj.isRemote) { if (this.rand.nextInt(3) == 0) { this.setTamed(true); par1EntityPlayer.addChatMessage("You have recruited a soldier with the profession" + this.getProfessionName(this.getProfession())); this.setPathToEntity((PathEntity)null); this.setAttackTarget((EntityLiving)null); this.setEntityHealth(20); this.setOwner(par1EntityPlayer.username); this.playTameEffect(true); } else { this.playTameEffect(false); } } return true; } return super.interact(par1EntityPlayer); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ @SideOnly(Side.CLIENT) /** * Returns the texture's file path as a String. */ public String getTexture() { switch (this.getProfession()) { case 0: return "/mods/Civil War/textures/mob/UnionCommander.png"; case 1: return "/mods/Civil War/textures/mob/UnionCaptain.png"; case 2: return "/mods/Civil War/textures/mob/UnionDoctor.png"; case 3: return "/mods/Civil War/textures/mob/UnionWeaponsMaster.png"; case 4: return "/mods/Civil War/textures/mob/UnionSoldier.png"; default: return this.texture; } } }
  19. Well, there is a line in EnumArmorMaterial that says public int customCraftingMaterial = null, and above it is a comment saying added by forge. but i found out thats not the problem, the damage reduce amount this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4); in ItemArmor is throwing a null for some reason. When you get home, could you post your armor code?
  20. I'm working on an armor myself, and I sort've have an irrelevant question how did you set the custom Crafting Material? the default is null, and so I keep getting null pointer exceptions, but I don't know where to change this =D This is my getArmorTextureFile: public String getArmorTextureFile(ItemStack par1){ if(par1.itemID == mod_MoreStuff.RubyHelmet.itemID||par1.itemID == mod_MoreStuff.RubyChestplate.itemID||par1.itemID == mod_MoreStuff.RubyBoots.itemID){ return "/mods/Water World/textures/armor/ruby_1.png"; } if(par1.itemID == mod_MoreStuff.RubyLegs.itemID){ return "/mods/Water World/textures/armor/ruby_2.png"; } return "/mods/Water World/textures/armor/ruby_2.png"; }
  21. How did you get a custom biome in your dimension? Just wondering, because whenever I put my custom biome in my World Provider file, it throws an error.
  22. I am adding another dimension, and the portal is made out of snow blocks. How do you edit the BlockFire.class to allow it to light this second portal as well? I created a second block that was just like the original fire block, but the same error popped up when I mentioned the BlockWWP.tryToCreatePortal. It says "cannot make a static reference to the non-static method tryToCreatePortal in type BlockWWP Original fire code: public void onBlockAdded(World par1World, int par2, int par3, int par4) { if (par1World.provider.dimensionId > 0 || par1World.getBlockId(par2, par3 - 1, par4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(par1World, par2, par3, par4)) { if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, 0); } else { par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate() + par1World.rand.nextInt(10)); } } } edited fire code: public void onBlockAdded(World par1World, int par2, int par3, int par4) { if (par1World.provider.dimensionId > 0 || par1World.getBlockId(par2, par3 - 1, par4) != Block.blockSnow.blockID || !BlockWWP.tryToCreatePortal(par1World, par2, par3, par4)) { if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) { par1World.setBlockWithNotify(par2, par3, par4, 0); } else { par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate() + par1World.rand.nextInt(10)); } } } } Both methods tryToCreatePortal methods are the same, but it gives me the error when i change it to my portal block's method
×
×
  • Create New...

Important Information

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