Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Fractangle

Members
  • Content Count

    10
  • Joined

  • Last visited

Everything posted by Fractangle

  1. Thanks! I had originally been off-put by the Javadoc on FMLLoadCompleteEvent due to it saying "Mods should not in general override or otherwise attempt to implement this event." Correct me if I'm wrong, but looking at the Javadoc for TagsUpdatedEvent, it appears that it could fire multiple times during the server's lifecycle? (e.g. after doing a /ct reload in a pack that includes CraftTweaker)
  2. I want to parse certain items out of a list of all registered items, so I need it to only run after all items have been registered. What event ought I subscribe to?
  3. Sixth time's the charm? šŸ¤£ public static final String FIREWORK_ITEM_SRG = "field_184566_a"; public static final Field FIREWORK_ITEM_FIELD = ObfuscationReflectionHelper.findField(FireworkRocketEntity.class, FIREWORK_ITEM_SRG); // [stuff] DataParameter<ItemStack> FIREWORK_ITEM; FIREWORK_ITEM_FIELD.setAccessible(true); try { FIREWORK_ITEM = (DataParameter<ItemStack>) FIREWORK_ITEM_FIELD.get(rocket); } catch(IllegalAccessException e) { throw new WTFException("I literally just called setAccessible(true)"); }
  4. Like this? public static final String FIREWORK_ITEM_SRG = "field_184566_a"; // [a bunch of unrelated stuff in the class] DataParameter<ItemStack> FIREWORK_ITEM = ObfuscationReflectionHelper.getPrivateValue(FireworkRocketEntity.class, null, FIREWORK_ITEM_SRG); CompoundNBT fireworkData = rocketDataManager.get(FIREWORK_ITEM).getTag();
  5. Whew, thanks for that one! I've got it using the SRG name now, and looking the field up only once. public static final DataParameter<ItemStack> FIREWORK_ITEM = ObfuscationReflectionHelper.getPrivateValue(FireworkRocketEntity.class, null, "field_184566_a");
  6. Good point! (I've never done that before, hence why I overlooked it. Back in a bit with cleaner code once I've done some Learningā„¢!) Edit: As promised, the working reflection-based code: double ax, ay, az, bx, by, bz; double range = 32; ax = player.getPosX() - range; ay = player.getPosY() - range; az = player.getPosZ() - range; bx = player.getPosX() + range; by = player.getPosY() + range; bz = player.getPosZ() + range; AxisAlignedBB boundingBox = new AxisAlignedBB(ax, ay, az, bx, by, bz); List<FireworkRocketEntity> rocketsLotsOfRockets = world.getEntitiesWithinAABB
  7. Ah okay, that makes sense! Thank you! I've got something that works, but it's a little gross (due to FireworkRocketEntity.FIREWORK_ITEM being private): double ax, ay, az, bx, by, bz; double range = 32; ax = player.getPosX() - range; ay = player.getPosY() - range; az = player.getPosZ() - range; bx = player.getPosX() + range; by = player.getPosY() + range; bz = player.getPosZ() + range; AxisAlignedBB boundingBox = new AxisAlignedBB(ax, ay, az, bx, by, bz); List<FireworkRocketEntity> rocketsLotsOfRockets = world.getEntitiesWithinAABB(FireworkRocketEntity.class, boundingBox, null)
  8. I'm not sure I understand what you mean by "replicate it" on the server side. For context, I only care about the firework data on the server side - my use case is for the presence of a correctly-colored-patterned-etc firework to trigger the spawning of a mob, hence why I ruled out sending a custom packet from client to server. (Don't want a client spoofing the firework presence!)
  9. I'm trying to determine if there's a firework with particular colors/effects/shapes near a player. This is what I have so far: double ax, ay, az, bx, by, bz; double range = 32; ax = player.getPosX() - range; ay = player.getPosY() - range; az = player.getPosZ() - range; bx = player.getPosX() + range; by = player.getPosY() + range; bz = player.getPosZ() + range; AxisAlignedBB boundingBox = new AxisAlignedBB(ax, ay, az, bx, by, bz); List<FireworkRocketEntity> rocketsLotsOfRockets = world.getEntitiesWithinAABB(FireworkRocketEntity.class, boundingBox, null); for(FireworkRocketEntit
  10. So I'm new to modding, and I've spent the last few hours trying to get a basic client-side-only GUI to open when an item is right-clicked. Right when the GUI was supposed to open, Minecraft crashed, complaining of a toothache or a NullPointerException or something. Googling around eventually led me to realize that I hadn't registered my GUI handler, so I created an init() method in CommonProxy, and added the GUI handler registration. Still crashes with a server-side NPE. I google more, do some searches specifically on this forum, and meticulously check every line of code to see why the server
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.