Draco18s Posted August 21, 2019 Posted August 21, 2019 (edited) In 1.12 I had a block that used extended states in order to render flowing water over the top of its regular model. I managed this using the forge:fluid model: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/basic_sluice.json#L7 That model is no longer available in 1.14, so how would I go about doing this instead? Currently I get this error: Quote [20Aug2019 19:44:36.220] [Server-Worker-2/WARN] [net.minecraft.client.renderer.model.ModelBakery/]: Unable to load model: 'forge:fluid' referenced from: harderores:sluice#facing=north: java.io.FileNotFoundException: forge:models/fluid.json Expand Additionally, getExtendedState no longer exists and I don't see a replacement, even though the update notes mention it. More pictures of what it looks like can be found on the mod wiki. Edited August 21, 2019 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Choonster Posted August 21, 2019 Posted August 21, 2019 Forge's fluid system (including the forge:fluid model) was removed in 1.13 due to large changes in the Vanilla fluid system. Forge's new fluid system is still being worked on, you can see some of the progress in this PR and KingLemming's fork. Until then, you could look at Vanilla's waterloggable blocks (IWaterLoggable) where the block can exist in the same space as a fluid (usually water). Extended states were replaced by the model data system in this PR. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Draco18s Posted August 21, 2019 Author Posted August 21, 2019 (edited) On 8/21/2019 at 11:05 AM, Choonster said: Until then, you could look at Vanilla's waterloggable blocks (IWaterLoggable) where the block can exist in the same space as a fluid (usually water). Expand Already did, it is not sufficient for my needs. Waterlogged blocks can only be completely full of water ("source blocks") not flowing (as of the current version) and I specifically need flowing water (and that flow needs to "decay" twice as fast). I even attempted to return a different fluid state that contained level information, but it did not work. On 8/21/2019 at 11:05 AM, Choonster said: Extended states were replaced by the model data system in this PR. Expand Thanks. Edited August 21, 2019 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Draco18s Posted August 21, 2019 Author Posted August 21, 2019 What has world.markBlockRangeForRenderUpdate(pos, pos); been replaced by? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Choonster Posted August 22, 2019 Posted August 22, 2019 (edited) On 8/21/2019 at 4:34 PM, Draco18s said: What has world.markBlockRangeForRenderUpdate(pos, pos); been replaced by? Expand The closest equivalents I can see are World#func_225319_b or WorldRenderer#markBlockRangeForRenderUpdate, though a lot of places that used to call World#markBlockRangeForRenderUpdate don't seem to call anything in its place now. Edited August 22, 2019 by Choonster Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Draco18s Posted August 22, 2019 Author Posted August 22, 2019 func_225319_b looks like the one I want. Thanks. Still trying to work out the other stuff, but fortunately I found an example and will just have to beat my head against it for a while. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Draco18s Posted August 22, 2019 Author Posted August 22, 2019 (edited) Well, this is about as far as I can get. I can't get the color/transparency right. Both the int color variable (which is set by the TE as the biome water color) and the faceData[i + 6] = 0x7F00; have an effect on what renders. Changing the 7F00 value "too much" causes the quad to become opaque, but its more of a magic bitflag thing (I can't tell which bit(s) are involved, just that some values are Fine and some values are Not Fine). @Override public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { ArrayList<BakedQuad> list = new ArrayList<BakedQuad>(); float[] corners = new float[4]; corners[0] = extraData.getData(SluiceTileEntity.LEVEL_CORNERS_0);//NW corners[1] = extraData.getData(SluiceTileEntity.LEVEL_CORNERS_1);//SW corners[2] = extraData.getData(SluiceTileEntity.LEVEL_CORNERS_2);//NE corners[3] = extraData.getData(SluiceTileEntity.LEVEL_CORNERS_3);//SE int color = (0xFF000000) | extraData.getData(SluiceTileEntity.WATER_COLOR); int red = (color & 0xFF0000) >> 16; int green = (color & 0x00FF00) >> 8; int blue = color & 0x0000FF; color = (0xFF000000) | (blue << 16) | (green << 8) | red; FaceBakery faceBakery = new FaceBakery(); BlockFaceUV uvs = new BlockFaceUV(new float[] {0, 0, 8, 8}, 0); BlockPartFace partFace = new BlockPartFace(Direction.UP,0,"",uvs); ISprite isprite = new BasicState(ModelsCache.DEFAULTMODELSTATE,true); BlockPartRotation rotation = new BlockPartRotation(new Vector3f(0,0,0), Direction.Axis.Y, 0, false); boolean diffuseLight = true; BakedQuad q0 = faceBakery.makeBakedQuad(new Vector3f(0,corners[1]*16,0), new Vector3f(16,corners[1]*16,16), partFace, atlasSpritesWater[1], Direction.UP, isprite, rotation, diffuseLight); //list.addAll(waterFlow.getQuads(state, side, rand, null)); int[] data = new int[28]; bakeQuad(data, new Vector3f[] { new Vector3f(0,corners[0],0), new Vector3f(0,corners[1],1), new Vector3f(1,corners[2],1), new Vector3f(1,corners[3],0) }, atlasSpritesWater[1], uvs, color); /*int[] data = new int[]{ 0, 1063423836, 0, -1, 1023434916, 960579630, 32512, 0, 1063423836, 1065353216, -1, 1023434916, 1031749304, 32512, 1065353216, 1063423836, 1065353216, -1, 1031774044, 1031749304, 32512, 1065353216, 1063423836, 0, -1, 1031774044, 960579630, 32512};*/ q0 = new BakedQuad(data, 0, Direction.UP, atlasSpritesWater[1], diffuseLight, DefaultVertexFormats.BLOCK); list.addAll(basePlate.getQuads(state, side, rand, null)); list.add(q0); return list; } private void bakeQuad(int[] dataOut, Vector3f[] verts, TextureAtlasSprite sprite, BlockFaceUV faceUV, int tintIndex) { for(int i = 0; i < 4; i++) { storeVertexData(dataOut, i, i, verts[i], tintIndex, sprite, faceUV); } } private void storeVertexData(int[] faceData, int storeIndex, int vertexIndex, Vector3f position, int shadeColor, TextureAtlasSprite sprite, BlockFaceUV faceUV) { int i = storeIndex * 7; faceData[i] = Float.floatToRawIntBits(position.getX()); faceData[i + 1] = Float.floatToRawIntBits(position.getY()); faceData[i + 2] = Float.floatToRawIntBits(position.getZ()); faceData[i + 3] = shadeColor; faceData[i + 4] = Float.floatToRawIntBits(sprite.getInterpolatedU((double)faceUV.getVertexU(vertexIndex) * .999 + faceUV.getVertexU((vertexIndex + 2) % 4) * .001)); faceData[i + 5] = Float.floatToRawIntBits(sprite.getInterpolatedV((double)faceUV.getVertexV(vertexIndex) * .999 + faceUV.getVertexV((vertexIndex + 2) % 4) * .001)); faceData[i + 6] = 0x7F00; } Mainly it acts like its not taking into account light levels (at night it looks like a very pale cyan color!?), but setting diffuseLight to false doesn't change anything. Edited August 23, 2019 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Draco18s Posted August 25, 2019 Author Posted August 25, 2019 Finally figured out what was going on. I wasn't taking into account the side parameter, so all the faces I was generating were being rendered 6 times. I just didn't expect that to do that that way. Once I fixed that I figured out that the 7F00 value was affecting the transparency and was "too transparent" (despite having been the value that was returned when I told vanilla code to generate quads). End result: fucking beautiful Also made the wood part follow the angle, as I'd always wanted to have happen. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.