TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
Hi Alpha blending (transparency) is difficult. You need to render all the opaque faces first, with depth-buffer writing turned on. eg RenderType SOLID, CUTOUT, CUTOUT_MIPPED Then you need to render the transparent faces next, with depth-buffer writing turned off, in the correct order (reverse sorted by depth - i.e. the faces which are furthest away get drawn first). TRANSLUCENT apparently does depth sorting but I think it might also write to the depth buffer as well, I'm not sure. If the sorting is done properly for all objects in the scene (not just your model's) then the depth buffer writing isn't critical. If you don't do that, you get all sorts of weird clipping issues happening. So I think the multi-layer approach might work ok - I'm not sure exactly how to code it because I've always used a TileEntityRenderer for this kind of block before. If you can't find an example of it, and don't have any luck contacting the forge guys who coded it, you could try tracing through the vanilla model loading & baking code. It's a bit of head damage but I've used it as the last resort a few times. I'm not sure why the internal faces are black. Something to do with lighting; but I don't understand why a west-facing quad on the inside of the block should be black when the west-facing quad on the outside of the block is not. I saw another post recently where the vertex order of the faces was important, perhaps it is something to do with that. There is also a flag in block model files to control ambientOcclusion, you could try messing with that. I don't think ambient occlusion should cause shadows that deep but I haven't studied it since 1.6.4 so I'm not sure... If you do crack it, please let me know? I'd like to include it (block with both solid and transparent parts) in a tutorial project I'm working on. Cheers TGG
-
[SOLVED] [1.15.2] Block model culling issue?
TheGreyGhost replied to IceMetalPunk's topic in Modder Support
Hi Perhaps try the notSolid() property, I think that's how glass does it. public static final Block GLASS = register("glass", new GlassBlock(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).notSolid())); -TGG -
howdy Sounds like it might be related to this question... could be a bug in Forge perhaps. Maybe the two of you could team up to figure it out; I think OBJModel and OBJLoader are the best place to start looking. If you fix it, you could generate a pull request and/or issue report on https://github.com/MinecraftForge/MinecraftForge -TGG
-
Help with directional block textures
TheGreyGhost replied to FlyingPerson23's topic in Modder Support
Hi Have you seen this tutorial example? https://github.com/TheGreyGhost/MinecraftByExample mbe03 has a block that can be placed in one of four different directions. The code you're using looks like it's from old versions of Forge, when blocks used to have integer metadata. That's not true anymore. Cheers TGG -
Custom Horse Armor Texture Location Syntax Problem
TheGreyGhost replied to BaconBombing's topic in Modder Support
Hi I'm not sure what you mean exactly. Vanilla has this public static final Item DIAMOND_HORSE_ARMOR = register("diamond_horse_armor", new HorseArmorItem(11, "diamond", (new Item.Properties()).maxStackSize(1).group(ItemGroup.MISC))); which uses this constructor public HorseArmorItem(int p_i50042_1_, String p_i50042_2_, Item.Properties p_i50042_3_) { this(p_i50042_1_, new ResourceLocation("textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"), p_i50042_3_); } but you need to use the other constructor with a suitable ResourceLocation("yourmod","full_path_to_texture_including_png) public HorseArmorItem(int p_i50042_1_, ResourceLocation texture, Item.Properties p_i50042_3_) { super(p_i50042_3_); this.field_219978_a = p_i50042_1_; this.texture = texture; } -TGG -
Hi Use a resourcepack to change the texture of water? Or do you mean - large bodies of water only? That would require custom in-game logic to decide which water blocks are seawater and which ones are rivers or ponds. World generation logic and custom block placement logic. Not impossible but probably a challenge unless you're quite experienced at Java and Minecraft modding. -TGG
-
Hi This tutorial project shows a working example of vanilla particles and a custom particle (mbe50) https://github.com/TheGreyGhost/MinecraftByExample -TGG
-
Hi Try setting a breakpoint in OBJModel or OBJLoader and watching what happens during the parsing of your obj file. The OBJ file format is very simple, you can open it in Notepad. A quick google will show you how to understand it. My first thoughts - Is your file a single object or four separate parts? Are the faces on the three arms inside out? -TGG
-
Render issue with custom block (1.14.4)
TheGreyGhost replied to Babelincoln1809's topic in Modder Support
Hi Without a screenshot it's hard to know exactly but there are two common problems which cause this: 1) Not setting the renderlayer properly in your clientsetup RenderTypeLookup.setRenderLayer(StartupCommon.blockPartial, RenderType.getSolid()); 2) Not using a proper blockshape in your block private static final VoxelShape BASE = Block.makeCuboidShape(BASE_MIN_CORNER.getX(), BASE_MIN_CORNER.getY(), BASE_MIN_CORNER.getZ(), BASE_MAX_CORNER.getX(), BASE_MAX_CORNER.getY(), BASE_MAX_CORNER.getZ()); @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return BASE ; } See here for an example (mbe02) https://github.com/TheGreyGhost/MinecraftByExample -TGG -
[Any] Does we can create Vector art textures in Minecraft?
TheGreyGhost replied to DragonITA's topic in Modder Support
Hi Yes, there is: use a custom renderer to draw your vector art. In a TileEntityRenderer for example you can draw pretty much whatever/however you want. -TGG -
Hi Yes it is. If you look at the Event class in net.minecraftforge.eventbus.api, then use your IDEA to show you all Events derived from Event, you'll find a long list of possible events which can do just about whatever you want. If you browse through the list for likely-looking names, it won't take you long to find the appropriate one. The documentation for Event classes is quite good. -TGG
-
HI This link might be useful, it talks about the major differences between 1.13/1.14 and previous versions. https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a -TGG
-
[1.15.2] Tile entity renderer does not see items
TheGreyGhost replied to grossik's topic in Modder Support
Hi Here's a tutorial project for TileEntityRenderers that you might find helpful https://github.com/TheGreyGhost/MinecraftByExample see MBE21 -TGG -
Howdy It does look like a fairly simple mod in terms of the amount of work needed to recreate it. I suggest you don't spend any time trying to find/decompile the source code, it would be easier for you to recreate from scratch. The basic algorithm I think you need is 1) Subscribe to the RenderWorldLastEvent 2) Iterate through all Entities within a desired distance from the player; eg using world::getEntitiesWithinAABB 3) Draw a circle around each one eg similar to vanilla's worldRenderer::drawSelectionBox or this code here. The hardest bit will be making the circle appear "real" in space - the original mod appears to drop the circle down onto the ground like a vertical shadow. You might need to play around quite a bit to make an effect that looks three-dimensional. Cheers TGG
-
ItemStackHandler not a direct replacement for IInventory?
TheGreyGhost replied to TheGreyGhost's topic in Modder Support
I guess we'll have to agree to differ then -TGG -
ItemStackHandler not a direct replacement for IInventory?
TheGreyGhost replied to TheGreyGhost's topic in Modder Support
Hi Anime Perhaps this page will explain what I mean better https://greyminecraftcoder.blogspot.com/2020/04/containers-1144.html I understand what you're saying about giving your client container a copy of the client TileEntity. The problem is that Vanilla doesn't do that, probably for a good reason (i.e. you then wind up with two independent synchronisation methods trying to fight each other: the vanilla tileentity synchronisation in parallel with the container directly poking around in the client's contents.) There's also no guarantee that the client side TileEntity will exist if the client and server worlds are slightly out of synch for some reason Here's an example of what I mean, from Container::mergeItemStack: int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize()); if (j <= maxSize) { stack.setCount(0); itemstack.setCount(j); slot.onSlotChanged(); flag = true; } else if (itemstack.getCount() < maxSize) { It looks to me like this vanilla code is directly manipulating the ItemStack, not via the Slot methods for changing/insertion/deletion. Hence the reason the vanilla code must call onSlotChanged directly. Seems to me that relying on ItemStackHandler::onContentsChanged for this situation may lead to data loss or mis-synchronisation because onContentsChanged is not triggered and hence the TileEntity has been altered but not marked as dirty. -TGG -
Hi Max I would approach this using the following algorithm: 1) Detect when the sword is being swung- if the sword is your own item, you can probably use onEntitySwing to tell your code "start watching this entity's swingProgress". Or you could subscribe to PlayerInteractEvent.LeftClickBlock. 2) In a tick event, you monitor the entity's swingProgress to time your effect for when the swing is completed (at the further extent). 3) At the right time, perform a ray trace to determine where the hit location is on the block. Vanilla code does this already - look at BlockRayTraceResult as a starting point for figuring out how you could leverage vanilla code to do that 4) Spawn particles at the hit location. (See this tutorial project for a working example of how to spawn vanilla particles or custom particles: https://github.com/TheGreyGhost/MinecraftByExample see mbe50) -TGG
-
[SOLVED] [1.15.2] Block model culling issue?
TheGreyGhost replied to IceMetalPunk's topic in Modder Support
Hi My guess: { "textures": { "particle": "scarlet_alchemy:block/scarlet_smoke_0", "inside": "scarlet_alchemy:block/scarlet_smoke_0" }, "elements": [ { "from": [ 2, 0, 2 ], "to": [ 14, 15, 14 ], "faces": { "up": { "texture": "#inside", "cullface": "up" } } } ] } If you are trying to look at the inside from the bottom of the composter instead of the top, then you should be using "down", not "up". An "up" face with "cullface:up" is invisible from the bottom. It's only visible from the top side of the face, which I'm guessing is inside your block. -TGG -
ItemStackHandler not a direct replacement for IInventory?
TheGreyGhost replied to TheGreyGhost's topic in Modder Support
Hi Anime Thanks for the suggestions. Re TileEntity can't exist with the TileEntity: yeah, I used to think that too, but after studying the vanilla code a bit more I realised that the TileEntity is only available on the server. On the client side, the container does not get a TileEntity, it gets a temporary IInventory instead that isn't linked to any TileEntity. Re override ItemStackHandler: I don't think that ItemStackHandler::onContentsChanged is called every time that the Slot::onSlotChanged is called. Many places in vanilla call Slot::onSlotChanged directly and it's not clear that ItemStackHandler::onContentsChanged would also be called in those situations (why would a manual call be needed if the other Slot methods had already marked as dirty?). SlotItemHandler::onSlotChanged just discards the notification without passing it to ItemStackHandler. Maybe it would be cleaner in some ways to separate a "notifications" interface from the more-general manipulation of a group of ItemStacks, or to code an adapter to convert ItemStackHandler to an IInventory with Notifications, but I'm thinking it really isn't worth the extra complexity. -TGG -
ItemStackHandler not a direct replacement for IInventory?
TheGreyGhost replied to TheGreyGhost's topic in Modder Support
Hi Thanks for the replies Yeah I just realised it's even worse than I thought because SlotItemHandler throws away / ignores the markDirty() notification, which vanilla appears to use to tell the TileEntity it needs to be saved/retransmitted to the client. I think I'll just stick with the vanilla TileEntity implements IInventory, it appears to be simpler to write a few composition wrappers for an itemStackHandler held in my TileEntity than to tightly couple my TileEntity to the container and to write a customised Slot which handles markDirty() properly. -TGG -
Howdy all I'm working on a Container based on a TileEntity and on the advice of more experienced folks than myself I have tried to avoid using MyTileEntity implements IInventory. But I find that IItemHandler (ItemStackHandler) is not a direct replacement for IInventory because IInventory is also used by the Container to communicate with its parent TileEntity For example openInventory(), closeInventory(), isUsableByPlayer(). Is there a drop-in Forge replacement for those methods? I can of course provide these to the Container as lambdas or a callback interface or give an Optional reference to the parent TileEntity directly, but it seems a bit clumsy. -TGG
-
Hi This working example (tutorial) project will show you how you can register TileEntities - see mbe20, mbe21 https://github.com/TheGreyGhost/MinecraftByExample -TGG
- 1 reply
-
- 1
-
Hi Glad you resolved it. I haven't see that problem before. BTW I'd recommend that you move from "recommended" to "latest". There are very many old mappings in recommended that are all fixed in "latest", it makes the vanilla code much easier to understand. It won't stop modders from using your code with "recommended". When using IDEA you'll probably need to manually exclude the older library from the project, otherwise every time you search for a method it will give two results- one from the old library and one from the newer. I think this is because of the Forge gradle code but I haven't figured out exactly why. -TGG