Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi A working example is here https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe08_itemgroup -TGG
  2. Howdy I'd suggest your entity unloading is the way to go - perhaps Entity.remove() or Entity.onRemovedFromWorld() override, perhaps you can mark the Entity in some way to kill it permanently, and respawn a new one to emerge from the hive. Or after the entity unloads your hive block could track a virtual bee for a while and then respawn it with some logic to make it head towards the hive for a while. I'm not sure that there is an "unload event", but perhaps PlayerEvent.StopTracking will work how you need. I think the only way to make it truly seamless is to have a central bee controller instance which comes into existence whenever a hive or one of its bees loads. Every few server ticks, the bee controller reviews its list of virtual bees, calculates their movement and location, and spawns or despawns them as necessary within a given radius of the player (eg the render distance). Might not be worth the effort from a gameplay point of view. -TGG
  3. Do you know what's wrong with it? It looks like it should work fine. I use the same recipe format in one of my mods with such problem. Do you have a link for how to use datagenerators? -TGG
  4. Hi Have a look at this working example project, it uses a wavefront obj model https://github.com/TheGreyGhost/MinecraftByExample See mbe21 - it uses TileEntityRender but the principles are basically the same for blocks, items, and even entities as well. Try to keep your blender models quite simple otherwise Minecraft can really struggle with them. I'd also suggest that you start with something extremely simple- take baby steps and test often, because some parts of the import are quite finicky. There are some tricks about meshing especially quads, normals, textures, and groups that you have to be careful with. Cheers TGG
  5. Howdy There could be lots of possible reasons for that. Probably your item model doesn't have "builtin/entity" as the parent type. (see the "Item" section of https://minecraft.gamepedia.com/Model) If that doesn't work, I'd suggest trying some breakpoints in strategic locations, eg: - inside your lambda for supplying the ItemStackTileEntityRenderer - inside the render method of vanilla ItemStackTileEntityRenderer - inside ItemRenderer::renderItem(ItemStack itemStackIn ....) -TGG
  6. Howdy Ah, my bad. It's actually in Item.Properties nested class Item.java: It's in the nested class Properties public Item.Properties setISTER(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer>> ister) { this.ister = ister; return this; } --> is Right at the very end of the class -TGG
  7. Howdy Item.setISTER lets you use a TileEntityRenderer for rendering your item. You can take the rendering functionality from the map rendering class(es) and copy them into your own renderer. Or you can add a custom model and do the same thing, i.e. copy the rendering functionality from the map rendering class(es) (see eg mbe15 in https://github.com/TheGreyGhost/MinecraftByExample) The basic idea is: 1) generate a custom dynamic texture 2) bind the texture 3) draw one or more quads -TGG
  8. Howdy Look at the Map and the DynamicTexture class. You could also @Jayzx535 for help, he has done some work with dynamic textures recently -TGG
  9. I've seen some descriptions of the world generation algorithms dating all the way back to 1.6.4. It's pretty damn abstruse and unless you know what the algorithm is doing it's probably going to be very hard to reverse engineer. It was hard enough for me to understand even when written in plain English (well - Mathematical notation actually).
  10. Dude, I have absolutely no idea. But if you figure it out and make a couple of example codes out of it, I'd be very keen to incorporate into a tutorial project! -TGG
  11. Howdy Check out CampfireTileEntityRenderer vanilla class, it does the same thing. The transform type is related to where the item is being rendered (eg in a GUI, in the player's hand, etc). FIXED means in a picture frame. https://greyminecraftcoder.blogspot.com/2020/04/item-rendering-1144.html has some more detailed info -TGG
  12. Hi Here's a working example of a TileEntityRenderer using line drawing, that might help. It's a TER not a particle renderer but the code is very similar. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe21_tileentityrenderer The project also has an example of custom particle (using quads not line, however) - see mbe50 -TGG
  13. Hello What is your question? Does it work? If it does not work, what are the symptoms? Cheers TGG
  14. Howdy You could get some clues from the Botania mod, it uses ItemStackHandlers and Capabilities instead of IInventory eg ItemFlowerBag. https://github.com/Vazkii/Botania/blob/master/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java The only potential problem with SlotItemHandler and ItemStackhandler instead of IInventory is that IInventory is also used by vanilla to tell the source container (typically TileEntity) that the GUI has modified the slot contents (marked it as "dirty"). But SlotItemHandler and ItemStackhandler don't do that. There are some knowledgeable folks on this forum who think that it doesn't matter because the source container is marked as dirty in other ways; they might be right although I'm not convinced yet. I haven't tested it empirically yet (on my to-do list). Up until now I've played it safe and wrapped the ItemStackHandler in an IInventory. If you decide to test it yourself, please let me know... -TGG
  15. Howdy Looks like old rendering code!! I suggest updating to 1.15.2, it's much better. https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e The example custom particle generation in here might be useful https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe50_particle Some suggestions 1) Refactor that code to have meaningful names - it's almost impossible to understand otherwise. 2) f, f1, f2, f3 are the u,v, coordinates corresponding to the opposite corners of the quad being rendered. The quad is always drawn the same size regardless of the texture size. If you make the texture bigger, the detail in the quad gets better (the texels are drawn smaller) but the quad does not get larger. There are lots of possible reasons, eg the texture is wrong, you're drawing to the wrong buffer, you're drawing in completely the wrong place, your render code is not being called. Some general tips I've found useful: Take baby steps. Start with drawing a simple quad. Move to near [0,0,0] in the world. Sometimes you will see your quad being rendered close to the origin -TGG
  16. howdy There's a working tutorial example of custom container here (furnace) https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace It uses a similar method to what David M said, i.e. a custom OutputSlot for the GUI, which stops the player adding but not your code. -TGG
  17. Howdy you might find this example project useful; it shows generation of vanilla particles or custom particles. It also shows how to use packets to communicate information from server to client if necessary. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe50_particle see also mbe60 -TGG
  18. Ah, yeah you're right. Vanilla does have a few of these dirty "quick fixes" hidden away in the guts of the code. @Deprecated public static RenderType getChunkRenderType(BlockState blockStateIn) { Block block = blockStateIn.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? RenderType.getCutoutMipped() : RenderType.getSolid(); } else { RenderType rendertype = TYPES_BY_BLOCK.get(block); return rendertype != null ? rendertype : RenderType.getSolid(); } } and public static boolean canRenderInLayer(BlockState state, RenderType type) { Block block = state.getBlock(); if (block instanceof LeavesBlock) { return fancyGraphics ? type == RenderType.getCutoutMipped() : type == RenderType.getSolid(); } else { java.util.function.Predicate<RenderType> rendertype; synchronized (RenderTypeLookup.class) { rendertype = blockRenderChecks.get(block.delegate); } return rendertype != null ? rendertype.test(type) : type == RenderType.getSolid(); } }
  19. Howdy I looked at your github repo but it doesn't compile. -TGG eg C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: class StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: class StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:77: error: cannot find symbol INSTANCE.<StructureIDPacket>registerMessage(disc++, StructureIDPacket.class, StructureIDPacket::encodeAtServer, StructureIDPacket::decodeAtClient, StructureIDPacket::handleAtClient); ^ symbol: variable StructureIDPacket location: class DeepnetherMain C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:97: error: cannot find symbol RenderTypeLookup.setRenderLayer(BlockInit.ANCIENT_LEAVES, RenderType.getTranslucent()); ^ symbol: variable ANCIENT_LEAVES location: class BlockInit C:\Users\Richard\Documents\IntellijProjects\Deepnether-Mod-master\src\main\java\de\budschie\deepnether\main\DeepnetherMain.java:98: error: cannot find symbol RenderTypeLookup.setRenderLayer(BlockInit.ANCIENT_WITHERED_LEAVES, RenderType.getTranslucent()); ^ symbol: variable ANCIENT_WITHERED_LEAVES location: class BlockInit
  20. no worries you're welcome! Thanks for the feedback
  21. Hi Perhaps have a look at this code for inspiration https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/usefultools/debugging/DebugBlockVoxelShapeHighlighter.java you will also need MinecraftForge.EVENT_BUS.register(DebugBlockVoxelShapeHighlighter.class); -TGG
  22. You may find this info helpful https://greyminecraftcoder.blogspot.com/2020/04/block-rendering-1144.html Flickering normally means that you're trying to render two quads directly on top of each other (called 'z-fighting'). Remove one of the quads or move it slightly (say 0.001) Is your block supposed to be translucent (like ice) or have holes (like glass block or leaves)? The first one needs transparent layer, the second needs cutout layer. -TGG
  23. Rendering is difficult to debug because there are many different ways it can go wrong without any specific symptoms. Taking baby steps is the best way to troubleshoot it, in my experience. If you post your code on GitHub I can take a look if you like. -TGG
  24. BTW block properties don't work like that; each block still has a blockstate for every possible combination of the properties that you attach to it, it just assigns a unique integer to each blockstate combination behind the scenes. So for example - a block with a FACING (four directions), a POWERED (on or off), and a SPEED (slow, medium, fast, ludicrous) would have 4*2*4 = 32 different combinations. If you tried to store a BlockPos it would try to make X * Y * Z combinations i.e. 2^32 * 256 * 2^32. But you could for sure make each space on the chess board into a chess piece using blockstates (no tileentities) and have the master control the blockstate at each chess board location. If you don't need animated figures then that's quite a bit simpler than using TileEntity and TileEntityRenderer
  25. Howdy Your chess piece is a block with tileEntity? Your master knows the location of each chess piece, so the basic algorithm is 1) Master places the chess piece at [x,y,z] using setBlockState 2) Master then retrieves the tileentity at [x,y,z] by asking the world for it (world.getTileEntity()) and casting it to the known entity type 3) Master sets the tileentity properties (I imagine - telling each slave what type of piece it is, as well as the [x,y,z] of the master) by calling the appropriate method in the tileentity. Vanilla uses late initialisation for TileEntities anyway via read (from NBT) so constructing an empty TileEntity isn't a problem -TGG
×
×
  • Create New...

Important Information

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