Jump to content

FluffyDiscord

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

FluffyDiscord's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. When I register it and try to load world, I get the error with the wrong getQuads() is being called
  2. That's the one I have been following, but if I do follow it, I run into issue, where the IBakedModel's getQuads() is being called, instead of IForgeBakedModel's one. Which is a problem, right ?
  3. I tried to add a tile entity to the block, but I don't think it works properly. The tile entity I have seem to be missing read() function to overwrite for NBT tag data, so I tried deserializeNBT() and serializeNBT(), but I don't think that's the correct way. Also with that, my model class doesn't seems to be working - the block is not changing texture as it should. Do I need to register my IBakedModel somewhere ? SC is here: https://github.com/FluffyDiscord/blocks-mod The code is somewhat taken from some 1.15 example mod. Anyone who can take a bit of their time and help me out with explaining a bit (via PM here or Discord) ?
  4. Is this the optimal way? The blocks should be used as a normal/basic building block, so there may be hundreds or maybe even a thousands of them in a single chunk.
  5. Hello, I want to have a block, which will take on a texture of a block which player holds in hand if he right clicks on the block placed in the world. So far I got it to change as I like, but it changes all blocks instead of just the single one I clicked on. I suspect, it's because the blocks in game are all just a single object instance and world just has bunch on references to it. How can I then change the single blockstate (or rather, it's texture, if it helps) ? Do I need to create some kind of registry, which will remember block positions and their blockstates and load the blockstate based on the block position ? Is there something more optimal, because if I have a arraylist of, let's say, 2k block positions and their block states which I need update every so often, I think it's gonna get slow real quick. Or if this IS the best way, then how can I save the registry, so after server restarts, it's gonna remember them?
  6. No this definitely should be server sided too. I got it figured out eventually with the packet system. I was just confused with creating some class that would be sending and receiving my packets. Can I somehow mark this issue as solved ?
  7. Hello, I would like to make a mod, where player can swap items he is holding when he scrolls with mouse wheel and holds the right item from a predefined list in hand. So far I have made a prototype which works - kinda - it switches items on the client side as I understand this correctly. My question is, how do I send the item swap request to the server to validate (if it's a valid swap request) and then update player's inventory according to it ? I have found this page https://mcforge.readthedocs.io/en/1.15.x/networking/simpleimpl/ but I am kinda confused - what do I do with that information ? package com.mossshine.blocks.init; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.InputEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(Dist.CLIENT) public class Events { private static final double SCROLL_DOWN = -1.0; private static final double SCROLL_UP = 1.0; @SubscribeEvent public static void mouseScrolled(InputEvent.MouseScrollEvent event) { ClientPlayerEntity player = Minecraft.getInstance().player; if (player != null) { ItemStack currentItem = player.getHeldItemMainhand(); int index = BlocksList.LOG_ARRAY_LIST.indexOf(currentItem.getItem()); if (event.getScrollDelta() == SCROLL_DOWN && index != -1) { event.setCanceled(true); int slot = player.inventory.currentItem; Item prevItem; index--; if (index > -1) { prevItem = BlocksList.LOG_ARRAY_LIST.get(index); } else { prevItem = BlocksList.LOG_ARRAY_LIST.get(BlocksList.LOG_ARRAY_LIST.size() - 1); } ItemStack newItem = new ItemStack(prevItem, currentItem.getCount()); player.inventory.setInventorySlotContents(slot, newItem); player.container.detectAndSendChanges(); } } } }
×
×
  • Create New...

Important Information

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