
shieldbug1
Forge Modder-
Posts
404 -
Joined
-
Last visited
Everything posted by shieldbug1
-
[1.7.10] [SOLVED] Every furnace/campfire burns
shieldbug1 replied to Bektor's topic in Modder Support
Your burning and burntime should not be static. This is basic Java - the reason it's affecting all of your fires is because they all share the same class field for burning and burnTime. And to check if something is burning you wouldn't have static methods (unless they're just convenience methods). So to check if it's burning would become TileEntityCampFire tileEntity = (TileEntityCampFire) world.getTileEntity(x, y, z); if(tileEntity.isBurning()) { ... } [/code -
[1.7.10] Best time to initialize Tile Entity
shieldbug1 replied to AtomicBlom's topic in Modder Support
Like you said, I think the best thing would be to have a simple 'initialised' boolean field, and just do it in the first updateEntity call. -
MinecraftForge isn't a mod though, it just has a dummy mod container. I don't think you can load before it.
-
[1.6.4]Not working with Java1.8.0_20?
shieldbug1 replied to iAm1nsaN3X's topic in Support & Bug Reports
You don't actually have to downgrade. This issue has been fixed for at least a month - you just have to update to the latest forge version. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
Your implementation of IMessage. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
1. Create two classes, a ClientProxy and a CommonProxy. ClientProxy must extend CommonProxy. You can additionaly create a ServerProxy to also extend CommonProxy. 2. In your main mod file: @SidedProxy(cilentSide = "com.somepackage.ClientProxyClassName", serverSide = "com.somepackage.ServerProxyClassName"); //Fully qualified name of your proxies. public static CommonProxy proxy; 3. Create a method in your CommonProxy that does nothing and takes in your IMessage implementation as a parameter and does nothing. 4. In your IMessageHandlerClass in the onMessage method: MainClass.proxy.yourMethodHere(message); 5. In your client proxy: @Override public void someMethod(YourPacket packet) { Entity entity = FMLClientHandler.instance().getWorldClient().getEntityById(packet.entityID); //Spawn particles here using entity.worldObj and entity.posX, posY and posZ. } Now as for sending the packet, rather than using the actual SimpleNetworkWrapper, what you do is this, in your event handler method if(!event.entityLiving.worldObj.isRemote) //Server! { YourPacket packet = new YourPacket(event.entityLiving.getEntityId()); ((WorldServer)event.entityLiving.worldObj).getEntityTracker().func_151247_a(event.entityLiving, packet); } -
Different Instances of Tile Entitys in Creative Tab
shieldbug1 replied to GamingAndStuffs's topic in Modder Support
Override getSubBlocks or getSubItems (can't remember what it's called) and add the ItemStacks you want to the List parameter you're given. -
[1.7.10] launchwrapper-1.9.jar no source attatchment
shieldbug1 replied to EmperorZelos's topic in Modder Support
I don think the launch wrapper automatically applies the source, but you can easily add it to the build path. It's where the launch wrapper itself is saved on your computer. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
What you want to do is: 1. Check your conditions on the server in the event. 2. If conditions are right, create a packet containing the entityLiving's entity id, and send it to any clients tracking it. There is a method for that in WorldServer, but I can't remember what it's called of the top of my head. 3. Through your proxy, handle the packet on the client proxy, by getting the entity through World#getEntityById(), and spawn the particles using the entity's posX, posY, and posZ values. -
That is a client only method, you have to call it through a proxy.
-
Alright, I've managed to do it, but it sure feels like a hack around something that could be done more elegantly. @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { if(event.gui instanceof GuiModList) { ModContainer container = Loader.instance().getIndexedModList().get(UtilModDummy.MOD_ID); ((List<ModContainer>)ReflectionHelper.getPrivateValue(GuiModList.class, (GuiModList)event.gui, "mods")).remove(container); } }
-
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
If the LivingHurtEvent is server only, like coolAlias says, then do your checks as usual (on the server), then if you meet the conditions you want, you will have to send packets. Then on the Client, when the packet is received, create your particles. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
That should be fine. Is the method being called at all? Put some SOUT statements in the beginning of the method. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
Your for-loop should increase to 5, since you want all 4 armour slots. Did you register your event handler? -
Update Forge. The latest version of forge is 1225. All version can be found here.
-
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
If you use MinecraftServer.getServer().worldServers[0] then it'll always be the overworld, regardless of what dimension you're in. So if you took damage in the Nether, it would try spawn the particles on the overworld - this would cause unexpected behaviour and most likely crashes. In this case, Minecraft.getMinecraft().theWorld is perfectly viable, because particles are only on the client - but every entity has a World object associated with it (Entity#worldObj) - so you don't even need to use Minecraft#theWorld, you can just use LivingHurtEvent#entityLiving.worldObj -
I'm not sure about your first question but I know I do this to make sure to prevent unlocalised name clashes: public static void nameItem(Item item, String name) { item.setUnlocalizedName(Reference.MOD_ID + "." + name); item.setTextureName(Reference.MOD_ID + ":" + name); } Same things for blocks too. So instead of item.something.name it's item.modid.something.name, and then I never have to worry about it. Now, for your next question I haven't tried it, but I'd assume you can do: if(GameData.getItemRegistry().contains(unlocalisedName)) { Item item = GameData.getItemRegistry().getObject(unlocalisedName); ItemStack stack = item != null ? new ItemStack(item) : null; String displayName = stack != null ? stack.getDisplayName() : ""; }
-
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
Why are you using the MinecraftServer? This is certain to crash on a client! Also why are you checking if it's an instance of EntityLivingBase - it has to be, you're given one! You want something like this: @SubscribeEvent public void onHurt(LivingHurtEvent event) { if(event.entityLiving.worldObj.isRemote) //Client only! { for(int i = 1; i<=4; i++) { ItemStack stack = event.entityLiving.getEquipmentInSlot(i); Item item = stack != null ? stack.getItem() : null; if(item instanceof HELMET || item instanceof BODY || item instanceof LEGGINGS || item instanceof BOOTS) { event.entityLiving.worldObj.spawnParticle(...); } } } } -
[1.7.2/1.7.10][SOLVED]Launch Error
shieldbug1 replied to ryancpexpert's topic in Support & Bug Reports
Update forge to the latest version. Next time, please read the EAQ before posting - there is a very high chance that your problem already has a solution. -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
You need to create a class to handle the event, and in it you need a method like this: @SubscribeEvent public void anyMethodName(EventTypeYouWant event) { } Then you find out which EventBus the event is posted on, in this case, it's the MinecraftForge event bus - so you register to it like this: MinecraftForge.EVENT_BUS.register(INSTANCE_OF_YOUR_HANDLER_CLASS); -
[1.7.10] Spawn Particles Around Armor When Hit
shieldbug1 replied to Izzy Axel's topic in Modder Support
Use the LivingHurtEvent, if the entityLiving is wearing your armour, spawn the particles. Just remember to only spawn the particles on the client. -
[1.7.10] Changing the maximum stack size for a block?
shieldbug1 replied to Pokechu22's topic in Modder Support
Not really. I'm pretty sure you'd have to make your own custom implementation of 'ItemStack' and your own custom Container/Inventory. -
Post your preInit method.