Everything posted by Jdb100
-
[1.7.2]Entity Item spawns client side
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.
-
[1.7.2]Entity Item spawns client side
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); }
-
[1.7.2] listen for packet250
http://www.minecraftforge.net/wiki/Netty_Packet_Handling Literally the same website had the tutorial you needed. Please look before posting.
-
[1.7.2]Entity Item spawns client side
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.
-
[1.7.2]Entity Item spawns client side
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?
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))
-
[1.7.2] LivingDeath event crash
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'
-
[1.7.2][Fixed]New Crust Block won't stop melting
Like San said you are emitting a light level of 15 and your block melts at light level of 14. See the problem?
-
[1.7.2][Solved]Keep dimension dark
Time in minecraft is static and not per dimension though the easiest way is to make a sky handler for your dimension.
-
[SOLVED][1.6.4]Large Oak Tree Generation In Custom Dimension !!HELP NEEDED!!
Easiest way would be to copy the large oak tree generation and remove the leaf spawning code then set the trees that spawn in your biome to be your new tree without leaves.
-
[1.7.2] Time Manipulation
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.
-
Structure Spawning in 1.7.2
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.
-
Ore doesn't spawn in the end.
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.
-
[1.7.2]Two Slot input crash
Adding some null checks in getResult should work.
-
[1.7.4] Need Help With Guns
Post your code we need to see what you did to fix them.
-
[1.7.2] Time Manipulation
The way time works in minecraft is kind of tricky which is why mods just create a custom provider to remove the sky and change with their own however the side effect of this is time still passes.If you had something that required a certain time of day even though it might look like noon in the dimension well the actual time is midnight so whatever you are trying to do won't work. I have had lots of people contact me reporting a bug where the sun dial in my mod says it is midnight in their constant day age of mystcraft.
-
3D item animations
Make A Boolean and when the item is used set it true then add in the render to do a certain thing if that Boolean is true
-
[1.7.2] Teleporting to where your cursor is at?
I made a similar item and this worked for me. I also didn't want the y to increase but I think you can figure that out In onItemRightClick double distance = 128; double a = Math.toRadians(player.rotationYaw); double dx = -Math.sin(a) * distance; double dz = Math.cos(a) * distance; player.setPositionAndUpdate(player.posX + dx, player.posY, player.posZ + dz);// takes in account for collisions with blocks.
-
[1.6.4] World Gen chance?
Save the random ex. Say random is 1 set previous random with 1. Next time it tries to generate check to see if random is within a range of 2 and if it is cancel generation.
-
Mob invisible, makes sounds, has shadow, has hitbox, just can't see it.
1 question does the white block take the shape of your model but just white or is it just a white cuboid? If it is the first then it can't find your texture so it is using the missing texture icon
-
Render buttons on screen?
Just so you know RenderGameOverlayEvent is what let's you draw on the screen without a tickhandler
-
[1.6.4] Rendering container stuff into a model
You can do this by creating a method in your tile entity to check for the item in the slot like so public boolean hasBook(int slot) { // on phone so can't remember method but there is a method in IInventory to check for items in slot if(items.unknownMethod[slot] instanceof ItemBook) return items.unknownMethod[slot]; Then do a check in your renderer and if so render that part of the model.
-
[1.7.2][SOLVED]Custom crop drops wheat seeds and wheat(Not what I want it to)
How are you telling it that you want quartz block dropped every time with 50% to drop 2 and 50% to drop seeds?
-
[1.7.2]Multi-Item only showing one in creative tab
Depends on how you register it I assume you give it 1 Id so it just makes one in creative tab with all the default options.
-
[1.7.2]IItemRenderer
In 1.6.4 I was using an IItemRenderer to make my block model in my hand but now to register an IItemRenderer it wants an Item so I can't use a block. Wait is the way around this?
IPS spam blocked by CleanTalk.