Jdb100
Members-
Posts
223 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
Creator of Jobo's ModLoader
Jdb100's Achievements
Creeper Killer (4/8)
17
Reputation
-
Ok i removed setting the default values even though I had no variables in the block besides the instance of the tile entity which I get with world.getTileEntity(). I never make the tile entity in the block it just contains the instance of it. The tile entity is created in the world with the createNewTileEntity(). All the other parts are working with multiple blocks down just not spawning the entity item on server.
-
That is set in the constructor. That variable seems to work fine as by default it is saved as false which I could see when debugging. Also a println in there saw it being called. All the other parts seem to work, I just provided them in case there was something wrong but the problematic section is: @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) if(player.inventory.getCurrentItem().getItem() instanceof ItemKnife && tileEntity.getEscapeTime() == -100) { tileEntity.setClicks(tileEntity.getClicks() + 1); if(tileEntity.getClicks() == 7) { System.out.println("7 clicks"); if(!world.isRemote) { System.out.println("is server"); ItemStack itemStack = new ItemStack(BaseMod.items.totem, 1); itemStack.setTagCompound(new NBTTagCompound()); itemStack.stackTagCompound.setInteger("Entity Id", tileEntity.getEntityId()); EntityItem item = new EntityItem(world, x, y + 1.2F, z, new ItemStack(itemStack.getItem(), itemStack.stackSize, itemStack.getItemDamage())); float f3 = 0.05F; item.motionX = (double)((float)this.rand.nextGaussian() * f3); item.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F); item.motionZ = (double)((float)this.rand.nextGaussian() * f3); if(itemStack.hasTagCompound()) { item.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); } world.setBlockToAir(x, y, z); world.spawnEntityInWorld(item); }
-
http://www.minecraftforge.net/wiki/Netty_Packet_Handling Literally the same website had the tutorial you needed. Please look before posting.
-
Sorry but I don't understand what you are trying to say as I think all the variables exist and they all have there data saved by nbt either in the tile entity or itemstack. Also I am not storing any data in the block all the data is stored in the tile entity and storing the item data in the item stack. Thanks for explaining the arguments I couldn't figure out even though I won't be needing them after I found what they do.
-
I have a block replacing itself with an item when clicked but it isn't called server side so any entities added would be client side and the blocks isn't set to air because it is only removed client side then syncs with the server and reappears. i should easily be able to make it spawn client side only with. if(!world.isRemote) however the onBlockActivated() seems to only be called client side even though it is supposed to be on both onBlockActivated() @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int what, float are, float these, float For) { if(player.inventory.getCurrentItem() == null || player.inventory.getCurrentItem().getItem() == null) { return false; } if(player.inventory.getCurrentItem().getItem() instanceof ItemKnife && !tileEntity.carved) { tileEntity.carved = true; return true; } if(player.inventory.getCurrentItem().getItem() instanceof ItemSoulJar) { if(player.inventory.getCurrentItem().stackTagCompound != null) { if(player.inventory.getCurrentItem().stackTagCompound.getInteger("Entity Id") != 0) { if(tileEntity.carved) { tileEntity.setEntityId(player.inventory.getCurrentItem().stackTagCompound.getInteger("Entity Id")); player.inventory.getCurrentItem().stackTagCompound.setInteger("Entity Id", 0); return true; } } } } if(player.inventory.getCurrentItem().getItem() instanceof ItemAsh && player.inventory.getCurrentItem().stackSize > 2 && tileEntity.getEntityId() != 0 && tileEntity.getEscapeTime() != 9600 && tileEntity.getEscapeTime() != -100) { tileEntity.addToEscapeTime(60); player.inventory.getCurrentItem().stackSize -= 2; return true; } if(player.inventory.getCurrentItem().getItem() instanceof ItemAsh && player.inventory.getCurrentItem().stackSize == 2 && tileEntity.getEntityId() != 0 && tileEntity.getEscapeTime() != 9600 && tileEntity.getEscapeTime() != -100) { tileEntity.addToEscapeTime(60); player.inventory.setInventorySlotContents(player.inventory.currentItem, null); return true; } if(player.inventory.getCurrentItem().getItem() instanceof ItemStickyIronCork && tileEntity.getEscapeTime() >= 7200) { tileEntity.setEscapeTime(-5); player.inventory.setInventorySlotContents(player.inventory.currentItem, null); return true; } if(player.inventory.getCurrentItem().getItem() instanceof ItemKnife && tileEntity.getEscapeTime() == -100) { tileEntity.setClicks(tileEntity.getClicks() + 1); if(tileEntity.getClicks() == 7) { System.out.println("7 clicks"); if(!world.isRemote) { System.out.println("is server"); ItemStack itemStack = new ItemStack(BaseMod.items.totem, 1); itemStack.setTagCompound(new NBTTagCompound()); itemStack.stackTagCompound.setInteger("Entity Id", tileEntity.getEntityId()); EntityItem item = new EntityItem(world, x, y + 1.2F, z, new ItemStack(itemStack.getItem(), itemStack.stackSize, itemStack.getItemDamage())); float f3 = 0.05F; item.motionX = (double)((float)this.rand.nextGaussian() * f3); item.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F); item.motionZ = (double)((float)this.rand.nextGaussian() * f3); if(itemStack.hasTagCompound()) { item.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); } world.setBlockToAir(x, y, z); world.spawnEntityInWorld(item); } } return true; } return false; }
-
[1.7.2][Solved]Getting all items and checking if player is in void?
Jdb100 replied to Nimbleguy's topic in Modder Support
First how are you getting sent to your dimension. Second p = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(pls); should be p = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(pls[i]); . Third if (itemDropped.getEntityItem().getItem().equals(VoidMod.nullVoidAlloy)) should be if (itemDropped.getEntityItem().getItem() instanceof ItemNullVoidAlloy)) -
I have been working on getting the id of the mob but for some reason when i check to see if the item is null or my item it crashes. @SubscribeEvent public void OnEntityDeath(LivingDeathEvent event) { if(event.source.getSourceOfDamage() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); int size = player.inventory.mainInventory.length; for(int i = 0; i < size; i++) { ItemStack itemStack = player.inventory.mainInventory[i]; if(itemStack.getItem() != null) { if(itemStack.getItem() instanceof ItemSoulJar) { //if(rand.nextInt(50) == 1) if(itemStack.stackTagCompound == null) { itemStack.setTagCompound(new NBTTagCompound()); itemStack.stackTagCompound.setInteger("Entity Id", event.entityLiving.getEntityId()); } } } } } } ---- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 16/05/14 1:05 AM Description: Ticking memory connection java.lang.NullPointerException: Ticking memory connection at com.jdb.base.events.ModEventHandler.OnEntityDeath(ModEventHandler.java:31) at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ModEventHandler_OnEntityDeath_LivingDeathEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.common.ForgeHooks.onLivingDeath(ForgeHooks.java:289) at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:992) at net.minecraft.entity.passive.EntityHorse.onDeath(EntityHorse.java:1018) at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:950) at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:224) at net.minecraft.entity.passive.EntityHorse.attackEntityFrom(EntityHorse.java:360) at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1401) at net.minecraft.network.NetHandlerPlayServer.processUseEntity(NetHandlerPlayServer.java:873) at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:51) at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:69) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:720) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:608) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:746) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.jdb.base.events.ModEventHandler.OnEntityDeath(ModEventHandler.java:31) at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ModEventHandler_OnEntityDeath_LivingDeathEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.common.ForgeHooks.onLivingDeath(ForgeHooks.java:289) at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:992) at net.minecraft.entity.passive.EntityHorse.onDeath(EntityHorse.java:1018) at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:950) at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:224) at net.minecraft.entity.passive.EntityHorse.attackEntityFrom(EntityHorse.java:360) at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1401) at net.minecraft.network.NetHandlerPlayServer.processUseEntity(NetHandlerPlayServer.java:873) at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:51) at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:69) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@71431492 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:720) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:608) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:746) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_21, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 924929440 bytes (882 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 2688 (150528 bytes; 0 MB) allocated, 2443 (136808 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.196.1082 Minecraft Forge 10.12.1.1082 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.196.1082} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1082.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.1.1082} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1082.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Totem{1.0} [Totem] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 339 (18984 bytes; 0 MB) allocated, 314 (17584 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player219'/145, l='New World', x=355.91, y=4.00, z=-808.66]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge'
-
Like San said you are emitting a light level of 15 and your block melts at light level of 14. See the problem?
-
Time in minecraft is static and not per dimension though the easiest way is to make a sky handler for your dimension.
-
I know the mob spawning would be fine but say you place a block that uses the time in always dark world it will still be at the power for the middle of the day well it appears to be night. Also if you get the time separate make sure that it doesn't mess up the clock.
-
When generating get the chunk it is in then when a new one tries to spawn check to see if it is within a certain amount of chunks to your other one.
-
This maybe incorrect because last time I did ore gen not in the overworld was 1.4 but from what I remember worldgenmineable finds stone and replaces it with the ore that is specified. In the end however there is no stone to replace so nothing happens. So you will need to create your own worldgen class to replace endstone with your ore.
-
Adding some null checks in getResult should work.
-
Post your code we need to see what you did to fix them.