Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. Warning: StateMapperBase is marked @SideOnly(Client). You cannot operate with it in common code.
  2. if(jar.itemStored == null) { //do something } ?
  3. jar.itemStored = heldItem.getItem(); //make the stored item the held item if(jar.itemStored == heldItem.getItem()) { //now check if they're the same (of course they are!)
  4. There's a few things you might be looking for. There's the @Optional annotation, which removes methods/fields/classes/interfaces if the mod isn't present There's also the Loader.isModLoaded(...) method which checks to see if the mod is available.
  5. Or...New Random().nextInt(10) - 5 (not that "New Random().nextInt(...)" will actually compile)
  6. You didn't override getRequiredPermissionLevel, so odds are the value returned by it is not what you want.
  7. So, none of this relates to your problem, but they're more general "you haven't broken it yet, but it could in the future" sort of things. 1) I would make all of the static FoodBase fields static Item fields. There's no reason to keep them more specific. 2) This: if (item instanceof ItemModelProvider) { ((FoodBase)item).registerItemModel(item); } Don't case to FoodBase, you didn't check to see if the item was FoodBase, you checked to see if it was ItemModelProvider. Cast to that. Yes, you can still invoke registerItemModel, as the interface has that method declared. 3) Not sure why you pass the item back to it, and then not use it though (instead you use this which would be the same object, so...why?) 4) Why did you define the setCreativeTab method? Isn't one already supplied by the Item class? Why did you change the return type? Why do you call this post-constructor, when you call setRegistryName and setUnlocalizedName in the constructor (which also return this )? 5) Don't use protected String name; the only place you use it is for the item model, which you should be using .getRegistryName() for anyway Anyway, I can't see what's wrong. Looks like something might going sour inside ShapelessRecipes#getRemainingItems that isn't your fault.
  8. I did not need the ItemStack class, I will however need your ModItems class.
  9. You need to refactor things so that your "firstvalidoutputslot" variable isn't based on checking "is it this one? is it this one? is it this one?" You need to write a function to do that, rather than encapsulating it inside the smelt method.
  10. Then what is this loop for? for (int inputSlot = FIRST_INPUT_SLOT; inputSlot < FIRST_INPUT_SLOT + INPUT_SLOTS_COUNT; inputSlot++) {...}
  11. Oh, you put "or" and I read it as "and." Thanks diesieben07.
  12. I haven't messed with them yet myself. Here's how Lex does it: https://github.com/LexManos/VoidUtils/blob/master/src/main/java/net/minecraftforge/lex/voidutils/VoidUtils.java#L96-L120 But the point remains:
  13. Even if you think you need one, you likely don't, and even then if you do, don't. ASM is a dark abyss that looks back into your soul.
  14. Gosh. What ever could the problem be? Given that I've seen people (try to) pass the item to their block, and the block to their item...I'm not so sure. You can't do that. Your crop class must reference ModItems.seed directly, it cannot take it as a parameter to its constructor.
  15. You register your items before your blocks, so you pass null to your item's constructor. There's literally 4000 posts on this forum about this issue.
  16. Sorry, that's too dense for me to figure out what your intentions are. I assumed you had a 1-input, multi-output furnace. It looks like you actually have multi-(1-input:1-output) furnace. The idea I had in my head was that you had one input, you would get its list of outputs, and iterate over that list, checking to see if the probabilistic result item was outputted or not.
  17. No, you subscribe to the LootTableLoadEvent, and when the gameplay.fishing.fish loot table is loaded, you get it's loot table and call addItemToTable(...) passing the appropriate arguments. e.g.: https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/farming/FarmingEventHandler.java#L428
  18. The note there is basically saying "BlockContainer does a bunch of bad things, either don't use it, or override the things it changes to change them back." You should just make your Crate extend Block.
  19. That would be correct. Packets are easy. https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/industry/network/CtoSMessage.java https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/industry/network/PacketHandlerServer.java
  20. public List<OutputWrapper> getMultiResult(ItemStack stack) { return multismeltList.get(stack); } You don't need to iterate over the entry set.
  21. Each bit sounds pretty straight forward. If I knew more I could probably encode it into a loot table modification. (the tricky bit is writing your own loot conditions) Or at least, enough to be able to copy/paste and modify a few values for the other items.
  22. I wondered about that with the BlockPos, I hadn't seen anywhere a good way to encode it in packets (and vanilla decomposes it, or at least does for SPacketSpawnObject packet; see line 58). Also, good to know about the read/write enum values. Much handy. Makes things @Override public void writeSpawnData(ByteBuf buffer) { PacketBuffer pack = new PacketBuffer(buffer); pack.writeBlockPos(getHangingPosition()); pack.writeEnumValue(this.getHorizontalFacing()); } @Override public void readSpawnData(ByteBuf buffer) { PacketBuffer pack = new PacketBuffer(buffer); hangingPosition = pack.readBlockPos(); updateFacingWithBoundingBox(pack.readEnumValue(EnumFacing.class)); }
  23. Arbitrary prime number. Its the number I have in my HashUtils class. It's probably not the best number, but there is no "perfect" hash formula, I just needed one that was "good enough." The return object from .get(...) will be that Output wrapper you wrote. You should absolutely return that to your furnace. Because it needs to decide what to do with the two values it contains.
  24. As there are very few posts about IEntityAdditionalSpawnData... (Not that it was hard, but having the reference is nice!) Make the custom entity implement it and then write this: @Override public void writeSpawnData(ByteBuf buffer) { BlockPos p = getHangingPosition(); buffer.writeInt(p.getX()); buffer.writeInt(p.getY()); buffer.writeInt(p.getZ()); buffer.writeInt(this.getHorizontalFacing().getIndex()); } @Override public void readSpawnData(ByteBuf buffer) { BlockPos p = new BlockPos(buffer.readInt(),buffer.readInt(),buffer.readInt()); this.hangingPosition = p; int f = buffer.readInt(); updateFacingWithBoundingBox(EnumFacing.values()[f]); }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.