Everything posted by starwarsmace
-
Particle Spawn when Holding item?
I agree. Are you in eclipse? Because in eclipse it shows that green override symbol. Here is the correct code. public void onUpdate(ItemStack p_77663_1_, World world, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { EntityPlayer player=(EntityPlayer) p_77663_3_; if(player.getCurrentEquippedItem().getItem().equals(this)){ world.spawnParticle("portal", player.posX + 1, player.posY, player.posZ, 1.0D, 1.0D, 1.0D); } }
-
IExtendedEntityProperties not saving after death
Unfortanutly that didn't work. Should I try saving it with the saveNBTData in my extended player class?
-
IExtendedEntityProperties not saving after death
Hello people. For my mod I made an extended properties for a player and I store my properties in my common proxy for the players death.(Following CoolAlias's tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and ). But when the player does die and respawn it doesnt work. Extended Player Class: public class ExtendedPlayer implements IExtendedEntityProperties { public final static String EXT_PROP_NAME = "ExtendedPlayer"; private final EntityPlayer player; private int gold; private int elixer; private int gold_storage; private int elixer_storage; private boolean flag; public ExtendedPlayer(EntityPlayer player) { this.player = player; this.elixer=0; this.gold=0; this.gold_storage=0; this.elixer_storage=0; this.flag=false; } @Override public void init(Entity entity, World world) { } @Override public void saveNBTData(NBTTagCompound properties) { NBTTagCompound compound = new NBTTagCompound(); compound.setInteger("Elixer",this.elixer); compound.setInteger("Gold", this.gold); compound.setInteger("Gold_Storage", this.gold_storage); compound.setInteger("Elixer_Storage", this.elixer_storage); compound.setBoolean("Flag", this.flag); compound.setTag(EXT_PROP_NAME, compound); } @Override public void loadNBTData(NBTTagCompound properties) { NBTTagCompound compound = (NBTTagCompound) properties.getCompoundTag(EXT_PROP_NAME); this.gold=compound.getInteger("Gold"); this.elixer=compound.getInteger("Elixer"); this.gold_storage=compound.getInteger("Gold_Storage"); this.elixer_storage=compound.getInteger("Elixer_Storage"); this.flag=compound.getBoolean("Flag"); } public static final void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player)); } public static final ExtendedPlayer get(EntityPlayer player) { return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME); } public void changeResources(int id,int change){ if (id==0){ this.elixer=elixer+change; } if(id==1){ this.gold=gold+change; } } public void changeStorage(int id,int change){ if (id==0){ this.elixer_storage=change; } if(id==1){ this.gold_storage=change; } } public int getResources(int id){ int resource = 0; if (id==0){ resource=this.elixer; } if(id==1){ resource=this.gold; } return resource; } public int getStorage(int id){ int resource=0; if (id==0){ resource=this.elixer_storage; } if(id==1){ resource=this.gold_storage; } return resource; } public void changeFlag(boolean par1){ this.flag=par1; } public boolean getFlag(){ return this.flag; } private static final String getSaveKey(EntityPlayer player) { // no longer a username field, so use the command sender name instead: return player.getCommandSenderName() + ":" + EXT_PROP_NAME; } public static void saveProxyData(EntityPlayer player) { ExtendedPlayer playerData = ExtendedPlayer.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); // Note that we made the CommonProxy method storeEntityData static, // so now we don't need an instance of CommonProxy to use it! Great! CommonProxyCoc.storeEntityData(getSaveKey(player), savedData); } /** * This cleans up the onEntityJoinWorld event by replacing most of the code * with a single line: ExtendedPlayer.loadProxyData((EntityPlayer) event.entity)); */ public static void loadProxyData(EntityPlayer player) { ExtendedPlayer playerData = ExtendedPlayer.get(player); NBTTagCompound savedData = CommonProxyCoc.getEntityData(getSaveKey(player)); if(savedData != null) { playerData.loadNBTData(savedData); } ClashOfCraft.packetPipeline.sendTo(new SyncPlayerPropsPacket(player), (EntityPlayerMP) player); } } EventHandler: public class RegularEventHandler { // public boolean collect; // public EntityPlayer player; @SubscribeEvent public void onEntityConstructing(EntityConstructing event){ if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null){ ExtendedPlayer.register((EntityPlayer) event.entity); } } @SubscribeEvent public void onLivingDeathEvent(LivingDeathEvent event){ if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer){ ExtendedPlayer.saveProxyData((EntityPlayer) event.entity); } } // we already have this event, but we need to modify it some @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event){ if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer){ ExtendedPlayer.loadProxyData((EntityPlayer) event.entity); ClashOfCraft.packetPipeline.sendTo(new SyncPlayerPropsPacket(), (EntityPlayerMP) event.entity); } } CommonProxy: public class CommonProxyCoc implements IGuiHandler{ private static final Map<String, NBTTagCompound> extendedEntityData = new HashMap<String, NBTTagCompound>(); public void registerRenderers() { } public static void storeEntityData(String name, NBTTagCompound compound) { extendedEntityData.put(name, compound); } /** */ public static NBTTagCompound getEntityData(String name) { return extendedEntityData.remove(name); } @Override public Object getServerGuiElement(int ID, EntityPlayer player,World world, int x, int y, int z) { return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player,World world, int x, int y, int z) { if(ID==GuiBasic.GUI_ID){ EntityGoldMine mine =new EntityGoldMine(world); GuiBasic gui=new GuiBasic((EntityGoldMine) world.getEntityByID(x)); return gui; }else{ return null; } } }
-
First Gui help <SOLVED>
I had this same problem. All you have to do is make your texture file to 256 by 256 pixels. Also you have to delete all the white space around it.
-
[1.7.10]Entity disappearing on pause and going far away
1. Yes I mean after the entity gets spawned. EntityRegistry.registerModEntity(EntityGoldMine.class, "EntityGoldMine", 0 ,instance,64, 1, true); That is in my preInit. 2. Thats good.
-
[1.7.10]Entity disappearing on pause and going far away
1. Heres my code. And I mean how a zombie just moves his head to look around, the whole thing moves around sometimes. public class EntityGoldMine extends EntityLiving{ public int level; public int effeciancy; public int capacity; public int full; public int tick; public boolean isUpgrading; public String name; public EntityGoldMine(World p_i1582_1_) { super(p_i1582_1_); } public void setOwnerName(String par1){ this.name=par1; } public void entityInit(){ this.effeciancy=1; this.level=1; this.capacity=500; this.full=0; this.tick=0; this.isUpgrading=false; super.entityInit(); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); } public boolean canDespawn(){ return false; } public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); tag.setInteger("Level", this.level); tag.setInteger("Effeciany", this.effeciancy); tag.setInteger("Capacity", this.capacity); tag.setInteger("Full",this.full); tag.setString("Owner", this.name); } public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); this.level=tag.getInteger("Level"); this.effeciancy=tag.getInteger("Effeciany"); this.capacity=tag.getInteger("Capacity"); this.full=tag.getInteger("Full"); this.name=tag.getString("Owner"); } public void onEntityUpdate(){ System.out.println(this.full); switch(level){ case 1:this.capacity=500; this.effeciancy=1; break; case 2:this.capacity=1000; this.effeciancy=3; } if(this.full<this.capacity){ if(this.isUpgrading==false){ tick++; } if(tick==20){ this.full++; this.tick=0; } } super.onEntityUpdate(); } public void collect(EntityPlayer par1){ EntityPlayer player=par1; if(this.isUpgrading==false){ if(player.worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,this.full)); } this.full=0; } } protected boolean interact(EntityPlayer player) { player.openGui(ClashOfCraft.instance, 20, player.worldObj, (int)player.posX, (int)player.posY,(int) player.posZ); return true; } public boolean attackEntityFrom(DamageSource p_70097_1_, float damage){ if(p_70097_1_.getEntity().worldObj.isRemote==false){ if(p_70097_1_.getEntity()!= null && p_70097_1_.getEntity() instanceof EntityPlayer){ EntityPlayer player=(EntityPlayer) p_70097_1_.getEntity(); if(player.getGameProfile().getId().toString()==name){ this.heal(30.0F); } else{ if(this.full!=0 && this.full>damage*6 && damage!=2){ if(p_70097_1_.getEntity().worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,(int) (damage*6))); } this.full=(int) (this.full-damage*6); }else if(this.full>= 10 && this.full<damage*6){ int num=this.full-this.full/3; int num2=(int) (num/damage); this.full=num2; if(p_70097_1_.getEntity().worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,num2)); } } } } } return true; } } 2. But the player is not going to move with a gui so that shouldn't matter, right?
-
[1.7.10]Entity disappearing on pause and going far away
1.I said 0 and it just moves around randomly. 2.Wait so each entity that gets spawned has a unique Entity Id than all other entities of that same class?
-
[1.7.10]Entity disappearing on pause and going far away
I will try that. You are awesome! It worked! Only thing is that it rotates around. Can I stop this in any way? Also, how can my GUI interact with my entity. Since player.openGui only asks for a id, how would my gui do this? Thank you again.
-
[1.7.10]Entity disappearing on pause and going far away
I will try that.
-
[1.7.10]Entity disappearing on pause and going far away
No it does not keep on printing when I leave the area. And there are no errors.
-
[1.7.10]Entity disappearing on pause and going far away
Spawning Code: public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { EntityGoldMine mine=new EntityGoldMine(world); mine.posX=x; mine.posY=y; mine.posZ=z; mine.name=player.getGameProfile().getId().toString(); System.out.println(mine.name); if(world.isRemote==false){ world.spawnEntityInWorld(mine); } return false; }
-
[1.7.10]Entity disappearing on pause and going far away
Anyone?
-
[1.7.10]Entity disappearing on pause and going far away
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Also, I put the super.onEntityUpdate and nothing changed.
-
[1.7.10]Entity disappearing on pause and going far away
Well, I cant do anything without figuring out this stupid error which I have spent almost two nights to FIGURE OUT!!!!!!! My extended player thing is giving me a null pointer whenever I try to load it. public class ExtendedPlayer implements IExtendedEntityProperties { public final static String EXT_PROP_NAME = "ExtendedPlayer"; private final EntityPlayer player; private int gold; private int elixer; private int gold_storage; private int elixer_storage; public ExtendedPlayer(EntityPlayer player) { this.player = player; this.elixer=0; this.gold=0; this.gold_storage=0; this.elixer_storage=0; } @Override public void init(Entity entity, World world) { this.elixer=0; this.gold=0; this.gold_storage=0; this.elixer_storage=0; } @Override public void saveNBTData(NBTTagCompound properties) { NBTTagCompound compound = new NBTTagCompound(); compound.setInteger("Elixer",10); ///compound.setInteger("Gold", this.gold); //compound.setInteger("Gold_Storage", this.gold_storage); //compound.setInteger("Elixer_Storage", this.elixer_storage); compound.setTag(EXT_PROP_NAME, compound); } @Override public void loadNBTData(NBTTagCompound properties) { NBTTagCompound compound = (NBTTagCompound) properties.getTag(EXT_PROP_NAME); //this.gold=compound.getInteger("Gold"); this.elixer=compound.getInteger("Elixer"); //this.gold_storage=compound.getInteger("Gold_Storage"); // this.elixer_storage=compound.getInteger("Elixer_Storage"); } public static final void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player)); } public static final ExtendedPlayer get(EntityPlayer player) { return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME); } public void changeResources(int id,int change){ if (id==0){ this.elixer=change; } if(id==1){ this.gold=change; } } public void changeStorage(int id,int change){ if (id==0){ this.elixer_storage=change; } if(id==1){ this.gold_storage=change; } } public int getResources(int id){ int resource = 0; if (id==0){ resource=this.elixer; } if(id==1){ resource=this.gold; } return resource; } private static final String getSaveKey(EntityPlayer player) { // no longer a username field, so use the command sender name instead: return player.getCommandSenderName() + ":" + EXT_PROP_NAME; } public static void saveProxyData(EntityPlayer player) { ExtendedPlayer playerData = ExtendedPlayer.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); // Note that we made the CommonProxy method storeEntityData static, // so now we don't need an instance of CommonProxy to use it! Great! CommonProxyCoc.storeEntityData(getSaveKey(player), savedData); } /** * This cleans up the onEntityJoinWorld event by replacing most of the code * with a single line: ExtendedPlayer.loadProxyData((EntityPlayer) event.entity)); */ public static void loadProxyData(EntityPlayer player) { ExtendedPlayer playerData = ExtendedPlayer.get(player); NBTTagCompound savedData = CommonProxyCoc.getEntityData(getSaveKey(player)); if(savedData != null) { playerData.loadNBTData(savedData); } ClashOfCraft.packetPipeline.sendTo(new SyncPlayerPropsPacket(player), (EntityPlayerMP) player); } } Error from eclipse console [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NullPointerException [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at coc.handlers.ExtendedPlayer.loadNBTData(ExtendedPlayer.java:53) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.entity.Entity.readFromNBT(Entity.java:1616) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.readPlayerDataFromFile(ServerConfigurationManager.java:271) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:123) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:173) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeHandshake(NetworkDispatcher.java:446) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:17) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:11) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [00:28:16] [server thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [00:28:16] [server thread/INFO]: Player750[local:E:7632cf2c] logged in with entity id 469 at (89.69999998807907, 65.67482498052121, 263.2098831423323) [00:28:16] [server thread/INFO]: Player750 joined the game [00:28:18] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel Send io.netty.handler.codec.DecoderException: java.lang.NullPointerException at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:2141) [Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] Caused by: java.lang.NullPointerException at coc.handlers.ExtendedPlayer.loadNBTData(ExtendedPlayer.java:53) ~[ExtendedPlayer.class:?] at coc.packet.SyncPlayerPropsPacket.handleClientSide(SyncPlayerPropsPacket.java:32) ~[syncPlayerPropsPacket.class:?] at coc.packet.PacketPipeLine.decode(PacketPipeLine.java:82) ~[PacketPipeLine.class:?] at coc.packet.PacketPipeLine.decode(PacketPipeLine.java:1) ~[PacketPipeLine.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?] ... 19 more
-
[1.7.10]Entity disappearing on pause and going far away
Here it is. public class RenderGoldMine extends RendererLivingEntity{ public static int lvl; public RenderGoldMine(ModelBase modelMine) { super(modelMine, 0); //this.lvl=lvl; } private static final ResourceLocation Your_Texture = new ResourceLocation("rotten_flesh_mod:textures/entity/tamedZombie_"+lvl+".png"); //refers to:assets/yourmod/textures/entity/yourtexture.png @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return Your_Texture; } }
-
[1.7.10]Entity disappearing on pause and going far away
Still didn't work.
-
[1.7.10]Entity disappearing on pause and going far away
Do you mean super.onEntityUpdate?
-
[1.7.10]Entity disappearing on pause and going far away
Hello I made an entity and theres one problem with it.Whenever I pause the game or I go about 5 or so blocks away it disappears. Here's my code. And yes I did register my entity. public class EntityGoldMine extends EntityLiving{ public int level; public int effeciancy; public int capacity; public int full; public int tick; public boolean isUpgrading; public String playersName; public String name; public EntityGoldMine(World p_i1582_1_) { super(p_i1582_1_); } public void entityInit(){ this.effeciancy=1; this.level=1; this.capacity=500; this.full=0; this.tick=0; this.isUpgrading=false; super.entityInit(); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); } public boolean canDespawn(){ return false; } public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); tag.setInteger("Level", this.level); tag.setInteger("Effeciany", this.effeciancy); tag.setInteger("Capacity", this.capacity); tag.setInteger("Full",this.full); tag.setString("Owner", this.name); } public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); this.level=tag.getInteger("Level"); this.effeciancy=tag.getInteger("Effeciany"); this.capacity=tag.getInteger("Capacity"); this.full=tag.getInteger("Full"); this.name=tag.getString("Owner"); } public void onEntityUpdate(){ System.out.println(this.full); switch(level){ case 1:this.capacity=500; this.effeciancy=1; break; case 2:this.capacity=1000; this.effeciancy=3; } if(this.full<this.capacity){ if(this.isUpgrading==false){ tick++; } if(tick==20){ this.full++; this.tick=0; } } } public void collect(EntityPlayer player){ if(this.isUpgrading==false){ if(player.worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,this.full)); } this.full=0; } } protected boolean interact(EntityPlayer player) { collect(player); return true; } public boolean attackEntityFrom(DamageSource p_70097_1_, float damage){ if(p_70097_1_.getEntity()!= null && p_70097_1_.getEntity() instanceof EntityPlayer){ EntityPlayer player=(EntityPlayer) p_70097_1_.getEntity(); System.out.println(this.name); if(player.getGameProfile().getId().toString()==name){ this.heal(30.0F); } else{ if(this.full!=0 && this.full>damage*6 && damage!=2){ if(p_70097_1_.getEntity().worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,(int) (damage*6))); } this.full=(int) (this.full-damage*6); }else if(this.full>= 10 && this.full<damage*6){ int num=this.full-this.full/3; int num2=(int) (num/damage); if(p_70097_1_.getEntity().worldObj.isRemote==true){ player.inventory.addItemStackToInventory(new ItemStack(Items.gold_ingot,num2)); } } } } return true; } }
-
How do you render non-living entities
Anyone?
-
How do you render non-living entities
Alright I just ended up changing my entity to a living thing so now it works. But know another bug has come up. Whenever I pause the game the whole entity disappears. Why?
-
How do you render non-living entities
Is it possible to make tile entities more than one block wide. And make it like 3x3x3?
-
How do you render non-living entities
See I tried that but all that came up is a white rectangular prism. Renderer public class RenderGoldMine extends RenderEntity{ protected ModelBase modelMine = new ModelGold_lvl1(); public static int lvl; public RenderGoldMine(ModelBase modelMine) { super(); //this.lvl=lvl; } private static final ResourceLocation Your_Texture = new ResourceLocation("rotten_flesh_mod:textures/entity/tamedZombie_"+lvl+".png"); //refers to:assets/yourmod/textures/entity/yourtexture.png @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return Your_Texture; } public void doRender(EntityGoldMine p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.modelMine.render(p_76986_1_, 0.0F, 0.0F, 0F, 0.0F, 0.0F, 0F); } } Model public class ModelGold_lvl1 extends ModelBase { //fields ModelRenderer minePart1; ModelRenderer minePart2; ModelRenderer minePart3; ModelRenderer minePart4; ModelRenderer minePart5; ModelRenderer minePart6; ModelRenderer minePart7; ModelRenderer minePart8; ModelRenderer minePart9; ModelRenderer minePart10; ModelRenderer minePart11; ModelRenderer minePart12; ModelRenderer minePart13; ModelRenderer minePart14; ModelRenderer minePart15; ModelRenderer minePart16; ModelRenderer floor; ModelRenderer railPart1; ModelRenderer railPart2; ModelRenderer railPart3; ModelRenderer railPart4; ModelRenderer railPart5; ModelRenderer railPart6; ModelRenderer railPart7; ModelRenderer railPart8; ModelRenderer railPart9; ModelRenderer railPart10; ModelRenderer railPart11; ModelRenderer railPart12; ModelRenderer minecartWheel1; ModelRenderer minecratWheel2; ModelRenderer minecartWheel3; ModelRenderer minecartWheel4; ModelRenderer minecartPart1; ModelRenderer minecartPart2; ModelRenderer minecartPart3; ModelRenderer minecartPart4; ModelRenderer minecartPart5; ModelRenderer minecartPart6; ModelRenderer collectingBoxPart1; ModelRenderer collectingBoxPart2; ModelRenderer collectingBoxPart3; ModelRenderer collectingBoxPart4; public ModelGold_lvl1() { textureWidth = 512; textureHeight = 256; minePart1 = new ModelRenderer(this, 143, 0); minePart1.addBox(0F, 0F, 0F, 1, 5, 28); minePart1.setRotationPoint(18F, 19F, -14F); minePart1.setTextureSize(64, 32); minePart1.mirror = true; setRotation(minePart1, 0F, 0F, 0F); minePart2 = new ModelRenderer(this, 201, 0); minePart2.addBox(0F, 0F, 0F, 28, 5, 2); minePart2.setRotationPoint(-9F, 19F, -15F); minePart2.setTextureSize(64, 32); minePart2.mirror = true; setRotation(minePart2, 0F, 0F, 0F); minePart3 = new ModelRenderer(this, 201, 7); minePart3.addBox(0F, 0F, 0F, 30, 5, 2); minePart3.setRotationPoint(-4F, 0F, -15F); minePart3.setTextureSize(64, 32); minePart3.mirror = true; setRotation(minePart3, 0F, 0F, 0.6981317F); minePart4 = new ModelRenderer(this, 201, 14); minePart4.addBox(0F, 0F, 0F, 20, 5, 2); minePart4.setRotationPoint(-4F, 6F, -15F); minePart4.setTextureSize(64, 32); minePart4.mirror = true; setRotation(minePart4, 0F, 0F, 0.6981317F); minePart5 = new ModelRenderer(this, 201, 21); minePart5.addBox(0F, 0F, 0F, 10, 5, 2); minePart5.setRotationPoint(-4F, 13F, -15F); minePart5.setTextureSize(64, 32); minePart5.mirror = true; setRotation(minePart5, 0F, 0F, 0.6981317F); minePart6 = new ModelRenderer(this, 265, 0); minePart6.addBox(0F, 0F, 0F, 5, 24, 2); minePart6.setRotationPoint(-9F, 0F, -15F); minePart6.setTextureSize(64, 32); minePart6.mirror = true; setRotation(minePart6, 0F, 0F, 0F); minePart7 = new ModelRenderer(this, 225, 21); minePart7.addBox(0F, 0F, 0F, 12, 5, 2); minePart7.setRotationPoint(-4F, 12F, -15F); minePart7.setTextureSize(64, 32); minePart7.mirror = true; setRotation(minePart7, 0F, 0F, 0.6981317F); minePart8 = new ModelRenderer(this, 279, 0); minePart8.addBox(0F, 0F, 0F, 28, 5, 2); minePart8.setRotationPoint(-9F, 19F, 13F); minePart8.setTextureSize(64, 32); minePart8.mirror = true; setRotation(minePart8, 0F, 0F, 0F); minePart9 = new ModelRenderer(this, 339, 0); minePart9.addBox(0F, 0F, 0F, 5, 24, 2); minePart9.setRotationPoint(-9F, 0F, 13F); minePart9.setTextureSize(64, 32); minePart9.mirror = true; setRotation(minePart9, 0F, 0F, 0F); minePart10 = new ModelRenderer(this, 279, 7); minePart10.addBox(0F, 0F, 0F, 10, 5, 2); minePart10.setRotationPoint(-4F, 13F, 13F); minePart10.setTextureSize(64, 32); minePart10.mirror = true; setRotation(minePart10, 0F, 0F, 0.6981317F); minePart11 = new ModelRenderer(this, 279, 14); minePart11.addBox(0F, 0F, 0F, 20, 5, 2); minePart11.setRotationPoint(-4F, 6F, 13F); minePart11.setTextureSize(64, 32); minePart11.mirror = true; setRotation(minePart11, 0F, 0F, 0.6981317F); minePart12 = new ModelRenderer(this, 353, 0); minePart12.addBox(0F, 0F, 0F, 30, 5, 2); minePart12.setRotationPoint(-4F, 0F, 13F); minePart12.setTextureSize(64, 32); minePart12.mirror = true; setRotation(minePart12, 0F, 0F, 0.6981317F); minePart13 = new ModelRenderer(this, 303, 7); minePart13.addBox(0F, 0F, 0F, 12, 5, 2); minePart13.setRotationPoint(-4F, 12F, 13F); minePart13.setTextureSize(64, 32); minePart13.mirror = true; setRotation(minePart13, 0F, 0F, 0.6981317F); minePart14 = new ModelRenderer(this, 0, 40); minePart14.addBox(0F, 0F, 0F, 30, 1, 28); minePart14.setRotationPoint(-4F, 0F, -14F); minePart14.setTextureSize(64, 32); minePart14.mirror = true; setRotation(minePart14, 0F, 0F, 0.6981317F); minePart15 = new ModelRenderer(this, 0, 69); minePart15.addBox(0F, 0F, 0F, 5, 1, 28); minePart15.setRotationPoint(-9F, 0F, -14F); minePart15.setTextureSize(64, 32); minePart15.mirror = true; setRotation(minePart15, 0F, 0F, 0F); minePart16 = new ModelRenderer(this, 0, 98); minePart16.addBox(0F, 0F, 0F, 0, 14, 26); minePart16.setRotationPoint(7F, 10F, -13F); minePart16.setTextureSize(64, 32); minePart16.mirror = true; setRotation(minePart16, 0F, 0F, 0F); floor = new ModelRenderer(this, 0, 0); floor.addBox(0F, 0F, 0F, 43, 0, 28); floor.setRotationPoint(-24F, 24F, -13F); floor.setTextureSize(64, 32); floor.mirror = true; setRotation(floor, 0F, 0F, 0F); railPart1 = new ModelRenderer(this, 0, 28); railPart1.addBox(0F, 0F, 0F, 1, 1, 7); railPart1.setRotationPoint(-23F, 23F, -2F); railPart1.setTextureSize(64, 32); railPart1.mirror = true; setRotation(railPart1, 0F, 0F, 0F); railPart2 = new ModelRenderer(this, 16, 28); railPart2.addBox(0F, 0F, 0F, 1, 1, 7); railPart2.setRotationPoint(-20F, 23F, -2F); railPart2.setTextureSize(64, 32); railPart2.mirror = true; setRotation(railPart2, 0F, 0F, 0F); railPart3 = new ModelRenderer(this, 32, 28); railPart3.addBox(0F, 0F, 0F, 1, 1, 7); railPart3.setRotationPoint(-17F, 23F, -2F); railPart3.setTextureSize(64, 32); railPart3.mirror = true; setRotation(railPart3, 0F, 0F, 0F); railPart4 = new ModelRenderer(this, 48, 28); railPart4.addBox(0F, 0F, 0F, 1, 1, 7); railPart4.setRotationPoint(-14F, 23F, -2F); railPart4.setTextureSize(64, 32); railPart4.mirror = true; setRotation(railPart4, 0F, 0F, 0F); railPart5 = new ModelRenderer(this, 64, 28); railPart5.addBox(0F, 0F, 0F, 1, 1, 7); railPart5.setRotationPoint(-11F, 23F, -2F); railPart5.setTextureSize(64, 32); railPart5.mirror = true; setRotation(railPart5, 0F, 0F, 0F); railPart6 = new ModelRenderer(this, 80, 28); railPart6.addBox(0F, 0F, 0F, 1, 1, 7); railPart6.setRotationPoint(-8F, 23F, -2F); railPart6.setTextureSize(64, 32); railPart6.mirror = true; setRotation(railPart6, 0F, 0F, 0F); railPart7 = new ModelRenderer(this, 96, 28); railPart7.addBox(0F, 0F, 0F, 1, 1, 7); railPart7.setRotationPoint(-5F, 23F, -2F); railPart7.setTextureSize(64, 32); railPart7.mirror = true; setRotation(railPart7, 0F, 0F, 0F); railPart8 = new ModelRenderer(this, 112, 28); railPart8.addBox(0F, 0F, 0F, 1, 1, 7); railPart8.setRotationPoint(-2F, 23F, -2F); railPart8.setTextureSize(64, 32); railPart8.mirror = true; setRotation(railPart8, 0F, 0F, 0F); railPart9 = new ModelRenderer(this, 127, 36); railPart9.addBox(0F, 0F, 0F, 1, 1, 7); railPart9.setRotationPoint(1F, 23F, -2F); railPart9.setTextureSize(64, 32); railPart9.mirror = true; setRotation(railPart9, 0F, 0F, 0F); railPart10 = new ModelRenderer(this, 127, 44); railPart10.addBox(0F, 0F, 0F, 1, 1, 7); railPart10.setRotationPoint(4F, 23F, -2F); railPart10.setTextureSize(64, 32); railPart10.mirror = true; setRotation(railPart10, 0F, 0F, 0F); railPart11 = new ModelRenderer(this, 0, 36); railPart11.addBox(0F, 0F, 0F, 40, 1, 2); railPart11.setRotationPoint(-24F, 23F, 4F); railPart11.setTextureSize(64, 32); railPart11.mirror = true; setRotation(railPart11, 0F, 0F, 0F); railPart12 = new ModelRenderer(this, 417, 0); railPart12.addBox(0F, 0F, 0F, 40, 1, 2); railPart12.setRotationPoint(-24F, 23F, -3F); railPart12.setTextureSize(64, 32); railPart12.mirror = true; setRotation(railPart12, 0F, 0F, 0F); minecartWheel1 = new ModelRenderer(this, 84, 36); minecartWheel1.addBox(0F, 0F, 0F, 3, 3, 1); minecartWheel1.setRotationPoint(-18F, 20F, -2.5F); minecartWheel1.setTextureSize(64, 32); minecartWheel1.mirror = true; setRotation(minecartWheel1, 0F, 0F, 0F); minecratWheel2 = new ModelRenderer(this, 92, 36); minecratWheel2.addBox(0F, 0F, 0F, 3, 3, 1); minecratWheel2.setRotationPoint(-18F, 20F, 4.5F); minecratWheel2.setTextureSize(64, 32); minecratWheel2.mirror = true; setRotation(minecratWheel2, 0F, 0F, 0F); minecartWheel3 = new ModelRenderer(this, 100, 36); minecartWheel3.addBox(0F, 0F, 0F, 3, 3, 1); minecartWheel3.setRotationPoint(-23F, 20F, 4.5F); minecartWheel3.setTextureSize(64, 32); minecartWheel3.mirror = true; setRotation(minecartWheel3, 0F, 0F, 0F); minecartWheel4 = new ModelRenderer(this, 108, 36); minecartWheel4.addBox(0F, 0F, 0F, 3, 3, 1); minecartWheel4.setRotationPoint(-23F, 20F, -2.5F); minecartWheel4.setTextureSize(64, 32); minecartWheel4.mirror = true; setRotation(minecartWheel4, 0F, 0F, 0F); minecartPart1 = new ModelRenderer(this, 143, 33); minecartPart1.addBox(0F, 0F, 0F, 10, 0, 6); minecartPart1.setRotationPoint(-24F, 18F, -1.5F); minecartPart1.setTextureSize(64, 32); minecartPart1.mirror = true; setRotation(minecartPart1, 0F, 0F, 0F); minecartPart2 = new ModelRenderer(this, 143, 39); minecartPart2.addBox(0F, 0F, 0F, 10, 1, 6); minecartPart2.setRotationPoint(-24F, 21F, -1.5F); minecartPart2.setTextureSize(64, 32); minecartPart2.mirror = true; setRotation(minecartPart2, 0F, 0F, 0F); minecartPart3 = new ModelRenderer(this, 143, 46); minecartPart3.addBox(0F, 0F, 0F, 10, 5, 1); minecartPart3.setRotationPoint(-24F, 16F, 3.5F); minecartPart3.setTextureSize(64, 32); minecartPart3.mirror = true; setRotation(minecartPart3, 0F, 0F, 0F); minecartPart4 = new ModelRenderer(this, 117, 36); minecartPart4.addBox(0F, 0F, 0F, 1, 5, 4); minecartPart4.setRotationPoint(-24F, 16F, -0.5F); minecartPart4.setTextureSize(64, 32); minecartPart4.mirror = true; setRotation(minecartPart4, 0F, 0F, 0F); minecartPart5 = new ModelRenderer(this, 117, 45); minecartPart5.addBox(0F, 0F, 0F, 1, 5, 4); minecartPart5.setRotationPoint(-15F, 16F, -0.5F); minecartPart5.setTextureSize(64, 32); minecartPart5.mirror = true; setRotation(minecartPart5, 0F, 0F, 0F); minecartPart6 = new ModelRenderer(this, 201, 28); minecartPart6.addBox(0F, 0F, 0F, 10, 5, 1); minecartPart6.setRotationPoint(-24F, 16F, -1.5F); minecartPart6.setTextureSize(64, 32); minecartPart6.mirror = true; setRotation(minecartPart6, 0F, 0F, 0F); collectingBoxPart1 = new ModelRenderer(this, 133, 30); collectingBoxPart1.addBox(0F, 0F, 0F, 1, 2, 4); collectingBoxPart1.setRotationPoint(-23F, 22F, -10F); collectingBoxPart1.setTextureSize(64, 32); collectingBoxPart1.mirror = true; setRotation(collectingBoxPart1, 0F, 0F, 0F); collectingBoxPart2 = new ModelRenderer(this, 127, 52); collectingBoxPart2.addBox(0F, 0F, 0F, 10, 2, 1); collectingBoxPart2.setRotationPoint(-23F, 22F, -6F); collectingBoxPart2.setTextureSize(64, 32); collectingBoxPart2.mirror = true; setRotation(collectingBoxPart2, 0F, 0F, 0F); collectingBoxPart3 = new ModelRenderer(this, 245, 14); collectingBoxPart3.addBox(0F, 0F, 0F, 1, 2, 4); collectingBoxPart3.setRotationPoint(-14F, 22F, -10F); collectingBoxPart3.setTextureSize(64, 32); collectingBoxPart3.mirror = true; setRotation(collectingBoxPart3, 0F, 0F, 0F); collectingBoxPart4 = new ModelRenderer(this, 175, 33); collectingBoxPart4.addBox(0F, 0F, 0F, 10, 2, 1); collectingBoxPart4.setRotationPoint(-23F, 22F, -11F); collectingBoxPart4.setTextureSize(64, 32); collectingBoxPart4.mirror = true; setRotation(collectingBoxPart4, 0F, 0F, 0F); } 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); minePart1.render(f5); minePart2.render(f5); minePart3.render(f5); minePart4.render(f5); minePart5.render(f5); minePart6.render(f5); minePart7.render(f5); minePart8.render(f5); minePart9.render(f5); minePart10.render(f5); minePart11.render(f5); minePart12.render(f5); minePart13.render(f5); minePart14.render(f5); minePart15.render(f5); minePart16.render(f5); floor.render(f5); railPart1.render(f5); railPart2.render(f5); railPart3.render(f5); railPart4.render(f5); railPart5.render(f5); railPart6.render(f5); railPart7.render(f5); railPart8.render(f5); railPart9.render(f5); railPart10.render(f5); railPart11.render(f5); railPart12.render(f5); minecartWheel1.render(f5); minecratWheel2.render(f5); minecartWheel3.render(f5); minecartWheel4.render(f5); minecartPart1.render(f5); minecartPart2.render(f5); minecartPart3.render(f5); minecartPart4.render(f5); minecartPart5.render(f5); minecartPart6.render(f5); collectingBoxPart1.render(f5); collectingBoxPart2.render(f5); collectingBoxPart3.render(f5); collectingBoxPart4.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); } } And yes I registered my entities and I know they are rendering in the client proxy.
-
How do you render non-living entities
Hello people. For my mod I want to render a non-living entity. How would I do this?
-
[1.7]Rendering things on a players hand
1.I've look around the tutorials for a bit but I want to know what Minecraft uses from the Open Gl so I know what exactly to learn. 2. After I learn some OpenGl is there something that can point me in the right direction for actually rendering the item?
-
[1.7]Rendering things on a players hand
Ahh... Like in render living GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); Could you point me to some basic open gl tutorials? I would be very grateful for that. Also, what in open gl do I need to learn in order to render the items on the players arm. And after I learn open gl is there something that can steer me in the right direction. Like an example of someone else rendering something else on a players arm Thank you.
IPS spam blocked by CleanTalk.