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


  • Content Count

  • Joined

  • Last visited

Everything posted by Tieso2001

  1. I could create an if statement in the feature class so that it only places when next to water, but I don't think that is the proper way to do it. I think the proper way is to create a custom placement. Edit: Nevermind vanilla does the checks in the feature class itself, I checked in the feature from sugarcane and it does the check there.
  2. Okay now I understand how features and placements work. I created a feature which will place farmland with wheat on top of it. I am not sure yet how I tell a placement that it needs to place it near water.
  3. Do I need to register features as well, or just placements?
  4. I don't really know how this works, I'm trying to understand by looking at vanilla classes. For example, I'm looking at the Placement class. public static final Placement<> CROP = Are there any tutorials, examples or documentations for this? How do I register a placement object and is there an example of this?
  5. I would like to generate farmland with wheat crops near water, but I don't know how I can do that. I only know how to do this, but that can only generate wheat like grass is generated: public static void setupWorldGen() { for (Biome biome : ForgeRegistries.BIOMES) { biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Biome.createDecoratedFeature(Feature.BUSH, new BushConfig(Blocks.WHEAT.getDefaultState()), Placement.CHANCE_HEIGHTMAP, new ChanceConfig(4))); } } Could someone please explain to me how I can generate the wheat
  6. I want to know if there is event for register a fluid just like there is the event for registering blocks and items. RegistryEvent.Register<Fluid> isn't a thing so I am curious if there is one for registering fluids.
  7. You were right, there was another error with the BlockPos of the tileEntity being null. I didn't realise that because the log was spamming errors so I got that fixed now. Everything seems to work now and the packet works! Thanks a lot, you really helped me.
  8. Thanks I got that part working now, but now I got this error when I open the TileEntity: Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(1) exceeds writerIndex(0): UnpooledSlicedByteBuf(ridx: 0, widx: 0, cap: 0/0, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 1, cap: 256)) at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1396) ~[AbstractByteBuf.class:4.1.9.Final] at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:687) ~[AbstractByteBuf.class:4.1.9.Final] at net.minecraft.network.P
  9. @Override public void toBytes(ByteBuf buf) { NBTTagCompound compound = new NBTTagCompound(); fluidStack.writeToNBT(compound); } @Override public void fromBytes(ByteBuf buf) { } Okay so I wrote the FluidStack to NBTTagCompound, but now I don't know what to do. I have to write it to buf, but I don't know how exactly. It has to be a byte or an int. I can convert the compound to byte with compound.getId(), but I don't know how that can be converted back into a fluidstack in fromBytes(). I can also convert it to an int with compound.
  10. Brief summary: I'm trying to create a packet for sending a FluidStack from the server to the client, so that the GUI of my TileEntity can be updated on the client. I have tried some things and this is what I currently have: The packet & the handler for the packet: SimpleNetworkWrapper object: PacketBuffer class (for storing FluidStack & BlockPos): (the relevant) part of the container class for my TileEntity When I open my TileEntity ingame, I get the following error: Network Disconnect: A fatal error h
  11. Okay so I think I have figured out how to write and read a FluidStack from ByteBuf, Here is the code I have: Packet class: PacketHandler class: PacketBuffer class: According to the forge documentation I have to create PacketHandler class which implements IMessageHandler, so I created PacketHandlerFluidTankUpdate. I have no idea what I have to do so that the GUI in my TileEntity updates with the right fluid (amount).
  12. If somebody could explain me how this works that would be appreciated. I'm a little confused by the forge documentation because it only explains how this works with integers.
  13. So I created a packet for sending the FluidTank, but I have no idea how I should write and read it to ByteBuf, If it was an integer I could use buf.writeInt(), but how do I do that with a FluidTank. public class MessageFluidTank implements IMessage { private FluidTank fluidTank; public MessageFluidTank(FluidTank fluidTank) { this.fluidTank = fluidTank; } @Override public void toBytes(ByteBuf buf) { buf.writeBytes(fluidTank); // How do I write fluidTank to buf } @Override public void fromBytes(ByteBuf buf) { fluidTank =
  14. I have created a TileEntity that has a fluidtank. Now I am trying to draw the fluid that is in the tank in the TileEntity's gui. The problem is that I have no idea on how to communicate the fluidstack or fluidtank with the client. I know that I can send integers with detectAndSendChanges() in the container class using listeners, but I don't think I can send any other data like a fluidstack or a fluidtank with this method. How do I communicate a fluidtank or a fluidstack from my TileEntity on the server to the gui on the client?
  15. You need to inject your items or loottable in the vanilla fishing loot table. In the LootTableLoadEvent, check if the table that is being loaded is the fishing table and then inject your items into that table.
  16. Removing the spaces from the first file worked. Thank you.
  17. I am making a corn plant/crop that is two blocks high. I want the plant to use different textures depending on if it the the lower or upper half of the plant and depending on the age that half is. That is why I have made two different type of states: "age" & "half. "age" can be a value from 0-7 and "half" can be "upper" or "lower". The problem is that I can't get my blockstate file to work. Can someone explain me how I should do this, because the forge documentation only explains how to select a model with one state/variable. Here are some of the things I've tried. { "forge_ma
  18. I have created a tool that decreases it's durability by 1 everytime you use it to craft something. This works fine, except when you try to repair the tool by combining two damaged ones. This creates a new tool and leaves the other two tools in the crafting window. @Override public boolean hasContainerItem(ItemStack stack) { return true; } @Override public ItemStack getContainerItem(ItemStack stack) { ItemStack item = stack.copy(); item.setItemDamage(stack.getItemDamage() + 1); return item; } Is there anyway
  19. Thanks for the advice, I know basic java and I have made mods before, but this was something that I just didn't realise and thought that it was some other mistakes than importing the wrong class. Also I tried googling but that didn't really got me anywhere so I decided to see if someone could help me here. Anyways thanks for your help.
  20. Thanks! I accidentally imported the jdk.nashorn class instead of the minecaft one.
  21. Okay I will use if(block == Blocks.SAND) but I still have the error that the types are incompatible
  22. What do you mean by which Block I imported?
  23. I'm making a mod where if I right click with an empty hand on sand, it gives me a item. I use the onPlayerInteract(PlayerInteractEvent.RightClickBlock event) to do this, but when I try to get the block which is right clicked it returns the wrong type. Block block = event.getWorld().getBlockState(event.getPos()).getBlock(); It says incompatible types: required: jdk.nashorn.internal.ir.Block found: net.minecraft.block.Block The whole class: @SubscribeEvent public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) { I
  • Create New...

Important Information

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