Jump to content

JimiIT92

Members
  • Posts

    867
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JimiIT92

  1. Oh, that's why i didn't find the code, it was in the entity class. Also i tried do "Search in file" in eclipse but it gives me an error i don't know why I'll try working with that parameters and let you know, thanks
  2. I tried before looking the code for the Haste effect but i didn't find that
  3. This is the updated code Rendering package blaze.entities.renderer; import blaze.core.BL; import blaze.entities.EntityPaintingEB; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderPaintingEB extends Render { private static final ResourceLocation paintings = new ResourceLocation(BL.MODID + ":" + "textures/painting/paintings.png"); public RenderPaintingEB(RenderManager mgr) { super(mgr); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityPaintingEB entity, double x, double y, double z, float par5, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.rotate(180.0F - par5, 0.0F, 1.0F, 0.0F); GlStateManager.enableRescaleNormal(); this.bindEntityTexture(entity); EntityPaintingEB.EnumArt enumart = entity.art; float f2 = 0.0625F; GlStateManager.scale(f2, f2, f2); this.func_77010_a(entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, par5, partialTicks); } protected ResourceLocation func_180562_a(EntityPaintingEB entity) { return paintings; } private void func_77010_a(EntityPaintingEB entity, int par2, int par3, int par4, int par5) { float f = (float)(-par2) / 2.0F; float f1 = (float)(-par3) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < par2 / 16; ++i1) { for (int j1 = 0; j1 < par3 / 16; ++j1) { float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.func_77008_a(entity, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(par4 + par2 - i1 * 16) / 256.0F; float f20 = (float)(par4 + par2 - (i1 + 1) * 16) / 256.0F; float f21 = (float)(par5 + par3 - j1 * 16) / 256.0F; float f22 = (float)(par5 + par3 - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.startDrawingQuads(); worldrenderer.setNormal(0.0F, 0.0F, -1.0F); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); worldrenderer.setNormal(0.0F, 0.0F, 1.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); worldrenderer.setNormal(0.0F, 1.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); worldrenderer.setNormal(0.0F, -1.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); worldrenderer.setNormal(-1.0F, 0.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); worldrenderer.setNormal(1.0F, 0.0F, 0.0F); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void func_77008_a(EntityPaintingEB entity, float par2, float par3) { int i = MathHelper.floor_double(entity.posX); int j = MathHelper.floor_double(entity.posY + (double)(par3 / 16.0F)); int k = MathHelper.floor_double(entity.posZ); EnumFacing enumfacing = entity.field_174860_b; if (enumfacing == EnumFacing.NORTH) { i = MathHelper.floor_double(entity.posX + (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.WEST) { k = MathHelper.floor_double(entity.posZ - (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.SOUTH) { i = MathHelper.floor_double(entity.posX - (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.EAST) { k = MathHelper.floor_double(entity.posZ + (double)(par2 / 16.0F)); } int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GlStateManager.color(1.0F, 1.0F, 1.0F); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity entity) { return this.func_180562_a((EntityPaintingEB)entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(Entity entity, double x, double y, double z, float par5, float partialTicks) { this.doRender((EntityPaintingEB)entity, x, y, z, par5, partialTicks); } } Entity package blaze.entities; import java.util.ArrayList; import com.google.common.collect.Lists; import blaze.core.BLItems; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityPaintingEB extends EntityHanging { public EntityPaintingEB.EnumArt art; public EntityPaintingEB(World worldIn) { super(worldIn); } public EntityPaintingEB(World worldIn, BlockPos pos, EnumFacing side) { super(worldIn, pos); ArrayList arraylist = Lists.newArrayList(); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; this.art = enumart; this.func_174859_a(side); if (this.onValidSurface()) { arraylist.add(enumart); } } if (!arraylist.isEmpty()) { this.art = (EntityPaintingEB.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size())); } this.func_174859_a(side); } @SideOnly(Side.CLIENT) public EntityPaintingEB(World worldIn, BlockPos pos, EnumFacing side, String name) { this(worldIn, pos, side); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; if (enumart.title.equals(name)) { this.art = enumart; break; } } this.func_174859_a(side); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound tagCompound) { tagCompound.setString("Motive", this.art.title); super.writeEntityToNBT(tagCompound); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound tagCompund) { String s = tagCompund.getString("Motive"); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; if (enumart.title.equals(s)) { this.art = enumart; } } if (this.art == null) { this.art = EntityPaintingEB.EnumArt.KEBAB; } super.readEntityFromNBT(tagCompund); } public int getWidthPixels() { return this.art.sizeX; } public int getHeightPixels() { return this.art.sizeY; } /** * Called when this entity is broken. Entity parameter may be null. */ public void onBroken(Entity entity) { if (this.worldObj.getGameRules().getGameRuleBooleanValue("doTileDrops")) { if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)entity; if (entityplayer.capabilities.isCreativeMode) { return; } } this.entityDropItem(new ItemStack(BLItems.painting_eb), 0.0F); } } /** * Sets the location and Yaw/Pitch of an entity in the world */ public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) { BlockPos blockpos = new BlockPos(x - this.posX, y - this.posY, z - this.posZ); BlockPos blockpos1 = this.hangingPosition.add(blockpos); this.setPosition((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); } @SideOnly(Side.CLIENT) public void func_180426_a(double par1, double par2, double par3, float par4, float par5, int par6, boolean par7) { BlockPos blockpos = new BlockPos(par1 - this.posX, par2 - this.posY, par3 - this.posZ); BlockPos blockpos1 = this.hangingPosition.add(blockpos); this.setPosition((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); } public static enum EnumArt { KEBAB("Kebab", 16, 16, 0, 0), AZTEC("Aztec", 16, 16, 16, 0), ALBAN("Alban", 16, 16, 32, 0), AZTEC_2("Aztec2", 16, 16, 48, 0), BOMB("Bomb", 16, 16, 64, 0), PLANT("Plant", 16, 16, 80, 0), WASTELAND("Wasteland", 16, 16, 96, 0), POOL("Pool", 32, 16, 0, 32), COURBET("Courbet", 32, 16, 32, 32), SEA("Sea", 32, 16, 64, 32), SUNSET("Sunset", 32, 16, 96, 32), CREEBET("Creebet", 32, 16, 128, 32), WANDERER("Wanderer", 16, 32, 0, 64), GRAHAM("Graham", 16, 32, 16, 64), MATCH("Match", 32, 32, 0, 128), BUST("Bust", 32, 32, 32, 128), STAGE("Stage", 32, 32, 64, 128), VOID("Void", 32, 32, 96, 128), SKULL_AND_ROSES("SkullAndRoses", 32, 32, 128, 128), WITHER("Wither", 32, 32, 160, 128), FIGHTERS("Fighters", 64, 32, 0, 96), POINTER("Pointer", 64, 64, 0, 192), PIGSCENE("Pigscene", 64, 64, 64, 192), BURNING_SKULL("BurningSkull", 64, 64, 128, 192), SKELETON("Skeleton", 64, 48, 192, 64), DONKEY_KONG("DonkeyKong", 64, 48, 192, 112), EB("EB", 32, 32, 96, 80), SUBSCRIBE("Subscribe", 64, 16, 96, 64); public static final int field_180001_A = "SkullAndRoses".length(); /** Painting Title. */ public final String title; public final int sizeX; public final int sizeY; public final int offsetX; public final int offsetY; private EnumArt(String name, int par1, int par2, int par3, int par4) { this.title = name; this.sizeX = par1; this.sizeY = par2; this.offsetX = par3; this.offsetY = par4; } } } Item package blaze.items; import blaze.core.BLTabs; import blaze.entities.EntityPaintingEB; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemHangingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; public class ItemCustomPainting extends ItemHangingEntity { private final Class hangingEntityClass; public ItemCustomPainting(Class entityClass) { super(entityClass); this.hangingEntityClass = entityClass; this.setCreativeTab(CreativeTabs.tabDecorations); } /** * Called when a Block is right-clicked with this Item * * @param pos The block being right-clicked * @param side The side being right-clicked */ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (side == EnumFacing.DOWN) { return false; } else if (side == EnumFacing.UP) { return false; } else { BlockPos blockpos1 = pos.offset(side); if (!playerIn.canPlayerEdit(blockpos1, side, stack)) { return false; } else { EntityPaintingEB entityhanging = this.createEntity(worldIn, blockpos1, side); if (entityhanging != null && entityhanging.onValidSurface()) { if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityhanging); } --stack.stackSize; } return true; } } } private EntityPaintingEB createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide) { return new EntityPaintingEB(worldIn, pos, clickedSide); } }
  4. I do some debug try. As i said i'm sure the painting is placed and spawned (checked this with a print), also place some breakpoints in rendering class and they are being reached, so the rendering class is called. Quick update: I removed this check from my item class if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityhanging); } [code] and replacing it with only this [code] worldIn.spawnEntityInWorld(entityhanging); spawn the painting in the world, but when i break the supporting block it doesn't disappear but it also drop me the painting item
  5. Well, it's not my fault if here in Italy the courses about programming sucks and don't goes into compiler stuff. I answered like this because that is what my teacher tells us in our course of Java programming. I learned a new thing, good to know! EDIT: Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.[1] The version of a method that is executed will be determined by the object that is used to invoke it. If an object of a parent class is used to invoke the method, then the version in the parent class will be executed, but if an object of the subclass is used to invoke the method, then the version in the child class will be executed.[2] Some languages allow a programmer to prevent a method from being overridden. Source: Wikipedia Maybe in Minecraft code works like this but in "standard" Java i'm totally sure i'm not wrong
  6. Override allows you to redefine a method of the superclass. Because i didn't notice before the error in his definition of class i suggested him to try that (beacuse i was thinking he was extending another class, not the base Item class)
  7. yes, this is sure. But not spotting an error in the code, in a place not mentioned before, doesn't mean that you don't know java. As you can see in my post above, as soon as i noticed that i report that, because THAT is the error that clearly come by not knowing the language too much
  8. Oh my god.... i've just noticed what is the OBVIOUS problem and i was like hitting the wall with my head. WHAT THE HELL IS THIS? public class itemJoint{ public itemJoint(){} static class smokeJoint extends Item{ ... } why don't you just do public class ItemJoint extends Item { .... //onItemRightClick method -> return --stack; .... } This will work for sure! PS: To who says "java experts at works", i didn't notice that before, he was asking for a method in particular so i don't look the entire class, i wanna say that "knowing how to mod minecraft" doesn't make you a java expert. Also myself is not an expert with a graduation in programming, so stop being "superior", everyone can make mistakes or oversights.
  9. try adding the @Override annotation above your function Also, no constructor?
  10. First at all, why you do this check? if(player instanceof EntityPlayer) Your variable player is yet an EntityPlayer, so it's useless. Second, after the if statement you do this return null; so whatever the condition is true or false it will ALWAYS return null (and so your item does nothing) So your function will looks like this: public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player){ player.inventory.consumeInventoryItem(CannaCraft.itemJoint); return item }
  11. Nobody? I really really need help with this
  12. Ok, so i've change this painting_eb = new ItemCustomPainting(EntityPaintingEB.class); with this painting_eb = new ItemCustomPainting(EntityPainting.class); and also changed this private EntityHanging createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide) { return (EntityHanging)(new EntityPaintingEB(worldIn, pos, clickedSide)); } with this private EntityHanging createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide) { return (EntityHanging)(new EntityPainting(worldIn, pos, clickedSide)); } and everything works fine, so i believe that the problem is with my custom EntityPainting. This is how i register my entity -> Called from preInit method, before adding the custom painting item public static EntityPaintingEB painting_eb; painting_eb = new EntityPaintingEB(null); -> Called from the init method, before registering the custom painting item EntityRegistry.registerModEntity(EntityPaintingEB.class, "paintingEB", starting_id, BL.instance, 128, 1, true); So what's wrong with this entity? It's just a copy of the normal EntityPainting, so why it doesn't work?
  13. ops, missed that ahahahahah my bad! Anyway post the error log (if any)
  14. Where did he does? I have read his code and found any lines similar to that. He's only said that he have the json files, but i don't see where he "register" them
  15. Have you registered the item rendering model file? I mean, you have this line of code? RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(MODID + ":" + name, "inventory")); Of course change "block", "MODID" and "name" with your block (blockFurnaceC), your modID and the blockFurnaceC unlocalized name
  16. Time ago i started writing a tool that do thats but since diesieben told me it was deprecated i've never finished it
  17. As by title, i have a custom Item painting. I do a print in the code to see if spawns the paint and it actually does, also when i break the supporting blocks it drops the item as well, but the painting itself is not rendering in world. This is my ItemCustomPainting class package blaze.items; import blaze.core.BLTabs; import blaze.entities.EntityPaintingEB; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; public class ItemCustomPainting extends Item { private final Class hangingEntityClass; public ItemCustomPainting(Class entityClass) { this.hangingEntityClass = entityClass; this.setCreativeTab(BLTabs.tabBlocks); } /** * Called when a Block is right-clicked with this Item * * @param pos The block being right-clicked * @param side The side being right-clicked */ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (side == EnumFacing.DOWN) { return false; } else if (side == EnumFacing.UP) { return false; } else { BlockPos blockpos1 = pos.offset(side); if (!playerIn.canPlayerEdit(blockpos1, side, stack)) { return false; } else { EntityPaintingEB entityhanging = this.createEntity(worldIn, blockpos1, side); if (entityhanging != null && entityhanging.onValidSurface()) { if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityhanging); System.out.println("SPAWNED"); } --stack.stackSize; } return true; } } } private EntityPaintingEB createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide) { return new EntityPaintingEB(worldIn, pos, clickedSide); } } And this is the EntityPainting package blaze.entities; import java.util.ArrayList; import com.google.common.collect.Lists; import blaze.core.BLItems; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityPaintingEB extends EntityHanging { public EntityPaintingEB.EnumArt art; public EntityPaintingEB(World worldIn) { super(worldIn); } public EntityPaintingEB(World worldIn, BlockPos pos, EnumFacing side) { super(worldIn, pos); ArrayList arraylist = Lists.newArrayList(); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; this.art = enumart; this.func_174859_a(side); if (this.onValidSurface()) { arraylist.add(enumart); } } if (!arraylist.isEmpty()) { this.art = (EntityPaintingEB.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size())); } this.func_174859_a(side); } @SideOnly(Side.CLIENT) public EntityPaintingEB(World worldIn, BlockPos pos, EnumFacing side, String name) { this(worldIn, pos, side); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; if (enumart.title.equals(name)) { this.art = enumart; break; } } this.func_174859_a(side); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound tagCompound) { tagCompound.setString("Motive", this.art.title); super.writeEntityToNBT(tagCompound); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound tagCompund) { String s = tagCompund.getString("Motive"); EntityPaintingEB.EnumArt[] aenumart = EntityPaintingEB.EnumArt.values(); int i = aenumart.length; for (int j = 0; j < i; ++j) { EntityPaintingEB.EnumArt enumart = aenumart[j]; if (enumart.title.equals(s)) { this.art = enumart; } } if (this.art == null) { this.art = EntityPaintingEB.EnumArt.EB; } super.readEntityFromNBT(tagCompund); } public int getWidthPixels() { return this.art.sizeX; } public int getHeightPixels() { return this.art.sizeY; } /** * Called when this entity is broken. Entity parameter may be null. */ public void onBroken(Entity entity) { if (this.worldObj.getGameRules().getGameRuleBooleanValue("doTileDrops")) { if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)entity; if (entityplayer.capabilities.isCreativeMode) { return; } } this.entityDropItem(new ItemStack(BLItems.painting_eb), 0.0F); } } /** * Sets the location and Yaw/Pitch of an entity in the world */ public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) { BlockPos blockpos = new BlockPos(x - this.posX, y - this.posY, z - this.posZ); BlockPos blockpos1 = this.hangingPosition.add(blockpos); this.setPosition((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); } @SideOnly(Side.CLIENT) public void func_180426_a(double d1, double d2, double d3, float par4, float par5, int par6, boolean par7) { BlockPos blockpos = new BlockPos(d1 - this.posX, d2 - this.posY, d3 - this.posZ); BlockPos blockpos1 = this.hangingPosition.add(blockpos); this.setPosition((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); } public static enum EnumArt { EB("EB", 32, 32, 0, 0), SUBSCRIBE("SUBSCRIBE", 64, 16, 32, 0); public static final int field_180001_A = "SkullAndRoses".length(); /** Painting Title. */ public final String title; public final int sizeX; public final int sizeY; public final int offsetX; public final int offsetY; private EnumArt(String name, int width, int height, int x, int y) { this.title = name; this.sizeX = width; this.sizeY = height; this.offsetX = x; this.offsetY = y; } } } And the EntityPainting Render class package blaze.entities.renderer; import blaze.core.BL; import blaze.entities.EntityPaintingEB; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderPaintingEB extends Render { private static final ResourceLocation textures = new ResourceLocation(BL.MODID + ":" + "textures/painting/painting_eb.png"); public RenderPaintingEB(RenderManager manager) { super(manager); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityPaintingEB entity, double x, double y, double z, float par5, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.rotate(180.0F - par5, 0.0F, 1.0F, 0.0F); GlStateManager.enableRescaleNormal(); this.bindEntityTexture(entity); EntityPaintingEB.EnumArt enumart = entity.art; float f2 = 0.0625F; GlStateManager.scale(f2, f2, f2); this.func_77010_a(entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, par5, partialTicks); } protected ResourceLocation func_180562_a(EntityPaintingEB entity) { return textures; } private void func_77010_a(EntityPaintingEB painting, int par2, int par3, int par4, int par5) { float f = (float)(-par2) / 2.0F; float f1 = (float)(-par3) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < par2 / 16; ++i1) { for (int j1 = 0; j1 < par3 / 16; ++j1) { float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.func_77008_a(painting, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(par4 + par2 - i1 * 16) / 256.0F; float f20 = (float)(par4 + par2 - (i1 + 1) * 16) / 256.0F; float f21 = (float)(par5 + par3 - j1 * 16) / 256.0F; float f22 = (float)(par5 + par3 - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.startDrawingQuads(); worldrenderer.setNormal(0.0F, 0.0F, -1.0F); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); worldrenderer.setNormal(0.0F, 0.0F, 1.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); worldrenderer.setNormal(0.0F, 1.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); worldrenderer.setNormal(0.0F, -1.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); worldrenderer.setNormal(-1.0F, 0.0F, 0.0F); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); worldrenderer.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); worldrenderer.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); worldrenderer.setNormal(1.0F, 0.0F, 0.0F); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); worldrenderer.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); worldrenderer.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void func_77008_a(EntityPaintingEB painting, float par2, float par3) { int i = MathHelper.floor_double(painting.posX); int j = MathHelper.floor_double(painting.posY + (double)(par3 / 16.0F)); int k = MathHelper.floor_double(painting.posZ); EnumFacing enumfacing = painting.field_174860_b; if (enumfacing == EnumFacing.NORTH) { i = MathHelper.floor_double(painting.posX + (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.WEST) { k = MathHelper.floor_double(painting.posZ - (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.SOUTH) { i = MathHelper.floor_double(painting.posX - (double)(par2 / 16.0F)); } if (enumfacing == EnumFacing.EAST) { k = MathHelper.floor_double(painting.posZ + (double)(par2 / 16.0F)); } int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GlStateManager.color(1.0F, 1.0F, 1.0F); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity entity) { return this.func_180562_a((EntityPaintingEB)entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(Entity entity, double x, double y, double z, float par5, float partialTicks) { this.doRender((EntityPaintingEB)entity, x, y, z, par5, partialTicks); } } The entity is registered as well and in Client Proxy is binded to it's rendering RenderManager mgr = Minecraft.getMinecraft().getRenderManager(); RenderingRegistry.registerEntityRenderingHandler(EntityPaintingEB.class, new RenderPaintingEB(mgr)); So what am i missing? Why this painting is invisible?
  18. I was just posting that it doesn't change the animation speed
  19. Hi guys I'm trying to make a Katana, wich will basically be a sword but faster, but i don't know how to change it's speed. This is the code for my katana (it's just a copy of the ItemSword class), how can i make it faster (i mean if you click with a sword it does an animation to attack, so you can't attack every second until the animation is over, how can i speed up this animation?) package blaze.items; import com.google.common.collect.Multimap; import com.sun.webkit.SharedBuffer; import blaze.core.BLItems; import blaze.core.BLTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import sun.corba.SharedSecrets; public class ItemKatana extends Item { private float attackDamage; private final Item.ToolMaterial material; public ItemKatana(Item.ToolMaterial material) { this.material = material; this.maxStackSize = 1; this.setMaxDamage(material.getMaxUses()); this.setCreativeTab(BLTabs.tabCombat); this.attackDamage = 2.0F + material.getDamageVsEntity(); } /** * Returns the amount of damage this item will deal. One heart of damage is equal to 2 damage points. */ public float getDamageVsEntity() { return this.material.getDamageVsEntity(); } public float getStrVsBlock(ItemStack stack, Block block) { Material material = block.getMaterial(); return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F; } /** * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. * * @param target The Entity being hit * @param attacker the attacking entity */ public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { stack.damageItem(1, attacker); return true; } /** * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. */ public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) { if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D) { stack.damageItem(2, playerIn); } return true; } /** * Returns True is the item is renderer in full 3D when hold. */ @SideOnly(Side.CLIENT) public boolean isFull3D() { return true; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BLOCK; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack stack) { return 72000; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); return itemStackIn; } /** * Return the enchantability factor of the item, most of the time is based on material. */ public int getItemEnchantability() { return this.material.getEnchantability(); } /** * Return the name for this tool's material. */ public String getToolMaterialName() { return this.material.toString(); } public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if(this.material.equals("ruby") && repair.getItem().equals(BLItems.ruby)) return true; else return false; } /** * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage. */ public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", (double)this.attackDamage, 0)); return multimap; } }
  20. Try doing a block model file like this: { "parent": "block/cube", "textures": { "particle": "blocks/gold_block" } } Also if you have probelms rendering a chest i remind you to my previous post wich has been solved http://www.minecraftforge.net/forum/index.php/topic,32858
  21. Thanks I'll check it out
  22. Ok, i've done this tests and the results are: The shooter is set to be the player (wich is right) Extending the ticksInAir check from >= 5 to >=100 doesn't change, still hits the player
  23. Could you please link it?
×
×
  • Create New...

Important Information

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