Jump to content

Insane96MCP

Members
  • Posts

    211
  • Joined

  • Last visited

Everything posted by Insane96MCP

  1. This is the properties file: https://github.com/Insane-96/IguanaTweaksReborn/blob/master/common/net/insane96mcp/iguanatweaks/lib/Properties.java This is where I use the property: https://github.com/Insane-96/IguanaTweaksReborn/blob/master/common/net/insane96mcp/iguanatweaks/modules/ModuleDrops.java#L32 I've now changed it to Arrays.asList(Properties.config.drops.restrictedDrops).contains(itemName) The point was to prevent casting and things, since I needed lists and not arrays (I didn't need index), but since seems not possible (unless I "cast" the array to list) I'll change the loops to work for arrays and use the asList().contains (even if I'm not sure that's a good practice). Edit: Seems like I can use foreach for arrays in Java, then it's not a big deal
  2. I'm rewriting configs with the new annotation system. The problem is that I can't use Lists since I get a net.minecraftforge.fml.common.LoaderException: java.lang.RuntimeException: Can't handle field 'restrictedDrops' of class 'net.insane96mcp.iguanatweaks.lib.Properties.ConfigOptions.Drops': Unknown type. I'm forced to use Arrays or there's anyway to use lists?
  3. I just realized I don't need to do it for useless properties, only for things that may give problems from a client server prospective (e.g. mining speed for a tool, or similar)
  4. There's anyway to add main menu splash text (yellow text) without removing vanilla ones? I mean via mod obiviously.
  5. I'm trying to sync server config with client, and I've came up with this IMessage. https://github.com/Insane-96/NetherGoldOre/blob/1.12/common/net/insane96mcp/nethergoldore/network/ConfigSync.java package net.insane96mcp.nethergoldore.network; import io.netty.buffer.ByteBuf; import net.insane96mcp.nethergoldore.lib.Properties; import net.minecraft.client.Minecraft; import net.minecraft.util.IThreadListener; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class ConfigSync implements IMessage { int minNuggetsPerOre, maxNuggetsPerOre, minExperienceDrop, maxExperienceDrop, orePerVein, minY, maxY; float veinPerChunk, pigmanAggroChance, pigmanAggroRadius; @Override public void fromBytes(ByteBuf buf) { minNuggetsPerOre = buf.readInt(); maxNuggetsPerOre = buf.readInt(); minExperienceDrop = buf.readInt(); maxExperienceDrop = buf.readInt(); orePerVein = buf.readInt(); veinPerChunk = buf.readFloat(); minY = buf.readInt(); maxY = buf.readInt(); pigmanAggroChance = buf.readFloat(); pigmanAggroRadius = buf.readFloat(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(Properties.config.drops.minNuggetsPerOre); buf.writeInt(Properties.config.drops.maxNuggetsPerOre); buf.writeInt(Properties.config.drops.minExperienceDrop); buf.writeInt(Properties.config.drops.maxExperienceDrop); buf.writeInt(Properties.config.generation.orePerVein); buf.writeFloat(Properties.config.generation.veinPerChunk); buf.writeInt(Properties.config.generation.minY); buf.writeInt(Properties.config.generation.maxY); buf.writeFloat(Properties.config.oreProperties.pigmanAggroChance); buf.writeFloat(Properties.config.oreProperties.pigmanAggroRadius); } public class Handler implements IMessageHandler<ConfigSync, IMessage> { @Override public IMessage onMessage(ConfigSync message, MessageContext ctx) { IThreadListener iThreadListener = Minecraft.getMinecraft(); iThreadListener.addScheduledTask(new Runnable() { @Override public void run() { Properties.config.drops.minNuggetsPerOre = message.minNuggetsPerOre; Properties.config.drops.maxNuggetsPerOre = message.maxNuggetsPerOre; Properties.config.drops.minExperienceDrop = message.minExperienceDrop; Properties.config.drops.maxExperienceDrop = message.maxExperienceDrop; Properties.config.generation.orePerVein = message.orePerVein; Properties.config.generation.veinPerChunk = message.veinPerChunk; Properties.config.generation.minY = message.minY; Properties.config.generation.maxY = message.maxY; Properties.config.oreProperties.pigmanAggroChance = message.pigmanAggroChance; Properties.config.oreProperties.pigmanAggroRadius = message.pigmanAggroRadius; } }); return null; } } } The fact is that I think there's a better way to do so, I find this way clunky. Any advice is appreciated.
  6. Sorry, the image might have been misleading. I meant those small islands:
  7. There's any way to check when those small islands is generated and then do something with them? (E.g. generate ores, structures, etc. on them?)
  8. Ok, but right now remapping seems to use numerical ids, since there will be no more, and string ids get changed, when you need remapping, how can this work?
  9. Thanks this worked out thanks to numerical IDs, but the question now is, afaik in 1.13 they removed numerical IDs so how will remapping work?
  10. I'm in need of changing the id of an item but this would break the compatibility of current worlds. How should I deal with this?
  11. I've updated forge 1.12.2 (from ...1.2599 to ...4.2709) and mappings (to stable_39) and can't seem to find some methods / method names. Missing: EnumFacing#getFront(int meta); NBTTagList#hasNoTags(); Block#onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state); Edit: seems like NBTTagList#isEmpty() is the new NBTTagList#hasNoTags()
  12. Just put an hopper under my machine and it extracts from every slot. I've googled a bit but just got more and more confused on how I should do to make the hopper work only for the output slot Container: https://github.com/Insane-96/Smasher/blob/master/common/net/insane96mcp/smasher/tileentity/ContainerSmasher.java Tile Entity: https://github.com/Insane-96/Smasher/blob/master/common/net/insane96mcp/smasher/tileentity/TileEntitySmasher.java
  13. But I'm having some huge problems now. The ITickable#update is called twice on server. The real problem is that once the upgrade is true, the other one is false. I really don't know now wtf I'm doing wrong. System.out.println(world.isRemote + " " + hasPickUpUpgrade + " " + world.getTotalWorldTime()); Output: [14:39:07] [Server thread/INFO] [STDOUT]: [net.insane96mcp.xpholder.tileentity.TileEntityXpHolder:update:82]: false false 42711 [14:39:07] [Server thread/INFO] [STDOUT]: [net.insane96mcp.xpholder.tileentity.TileEntityXpHolder:update:82]: false true 42711 Full code: https://github.com/Insane-96/XpHolder/blob/master/common/net/insane96mcp/xpholder/tileentity/TileEntityXpHolder.java#L82
  14. I spawn wither skeletons during Wither battle, but I want those skeletons to have a different texture. Is that possible, or is much faster to create a new mob?
  15. Nevermind, world.isRemote calls it's both on client and server. The problem now is that the orbs don't move properly clientside Seems like that changing TE NBT via /blockdata doesn't update the TE data on the client.
  16. I've made a tile entity that pulls xp orbs towards it, sadly the ITickable#update runs on server only, so the client experiences 1 second only update for orbs. Should I send xp orbs position every tick to update the xp orb position client-side? If so, how can I send the entity?
  17. What I want to do is when config has default values from previous version of the mod, it gets changed to a new version default value. E.g. Version 1.0.0 general{ #This int does nothing (default: 7) I:dummyInt=7 } When I update the mod to 1.1.0, the default value for dummyInt changes to 9, so if the player has the default config on update the dummyInt value should change to 9
  18. Ok managed to make it. Now the only problem is updateCounter that is a timer decremented every tick. Sadly the RenderGameOverlayEvent is called every frame. How I can get this timer working with ticks instead of frames?
  19. So I must rewrite them? The GUI functions (e.g. drawTextureModal) are not static.
  20. How do I use the rendering functions in the Event?
  21. I have a strange problem. In LAN when a non-host opens the GUI, the GUI opens for the host too. EDIT: doesn't happen on SMP
×
×
  • Create New...

Important Information

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