-
Posts
151 -
Joined
-
Last visited
Everything posted by Simon_kungen
-
Umm... ok, so I changed the 4 to 0.1: buffer.pos(0,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(0,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(0.1,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(0.1,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); But I can't seem to get them to all stick together, I tried a bunch of combinations but there are about 64 different combinations. What order were you thinking? None of the combinations I tried gave any hints on what order they should be in.
-
Alright, I added this to the code, and you can see the result that happened: TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMap().getAtlasSprite("minecraft:water_still"); float u1 = sprite.getMinU(), v1 = sprite.getMinV(), u2 = sprite.getMaxU(), v2 = sprite.getMaxV(); buffer.pos(0,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(4,0,0).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(0,0,4).color(1,1,1,1).tex(u1, v2).endVertex(); buffer.pos(4,0,4).color(1,1,1,1).tex(u1, v2).endVertex();
-
Some more details: I have found other pieces of code where a cuboid was rendered, but I feel like it would be a big waste to render all that when only a tiny part of the "fluid" is visible at any time. A square has four (4) vertices while a cuboid has twelve (12) vertices, so it's pretty obvious which one to chose. Another problem I'm facing is that even the cluttered mess visible on the second image is still black, which is not at all what I'm expecting out of a blue liquid.
-
Hi I never really got an actual answer on my last question, so I'm going to ask again: I would like to render a TileEntity Special Render to render fluids in my bucket model: The problem is that I don't know how to "stitch" everything together, and the colour doesn't seem to change either. I realized instead of rendering a whole cuboid I could only render a square only visible from the top, which would reduce the number of vertexes to only four (4). I got something to render in-game, but I couldn't really find any way to have them render as I wanted: The idea was to make a visual illustration of how full the bucket is. So changing the y value of the square would give the effect of the bucket filling up. The class with the TESR Fast:
-
Alright, I got some help getting something to render, but as they said you have to keep in mind what direction it is supposed to render it from, which I have no idea how to do. buffer.pos(0,0,0).color(0,0,1,1).endVertex(); buffer.pos(4,0,0).color(0,0,1,1).endVertex(); buffer.pos(0,0,4).color(0,0,1,1).endVertex(); buffer.pos(4,0,4).color(0,0,1,1).endVertex(); Something I realized was that the fluid level is only going to be seen from the top, which would mean I only need to render a single side (top) and then change the y value to represent the fluid level.
-
If anyone could tell me what I'm doing wrong, I would gladly accept any answer: @Override public void renderTileEntityFast(TreeTapTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { // *Confusion sound* BlockPos pos = te.getPos(); net.minecraft.world.IEnviromentBlockReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos); BlockState state = world.getBlockState(pos); if (state.get(BlockProperties.BUCKET) != BucketType.NONE) { buffer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); buffer.pos(1,1,1).color(1,1,1,1); } } Here I don't really expect much except for absolutely anything to happen.
-
Alright, that worked pretty well. I added this to my TileEntity; but when I tried to add a block update mechanic to it it wouldn't update: I would like to add my own packet message to only send the data needed for that particular moment, but for now, a quick and dirty method would probably suffice for the time being. Something I do wonder more is how I'm supposed to do the TileEntityRendererFast. I registered this to the client, but the problem is that I have no idea how to work with this. @Override public void renderTileEntityFast(TreeTapTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { // *Confusion sound* //buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); } A 3D cuboid with varying texture and height and of course what axis it should align to (in my blockstate). I tried to search for some example online how to work with this, but none of the uses was sufficient to me. https://github.com/search?l=&q=TileEntityRendererFast+language%3AJava&type=Code
-
Hi I got my TileEntity working good now, now I want to add a type of render to it, and looking through the wiki the optimal way of doing it would be to use a TileEntityRendererFast. I would not say my TileEntity would be hard to render as it would only have to render a cuboid with varying alpha and texture depending on the TileEntity variables. The issue I'm facing is that I have no idea how to do that, and better yet how to send the data to the client efficiently. I have it do stuff every tick, which is only changing one variable out of the three variables it stores, so I'm pretty sure using a custom message protocol is needed. The other two is what texture to use and whenever it should do a particle effect at the block (same texture). But I'm a bit lost about all this, going to write a summary and what little code I have on the TileEntityRendererFast and the actul TileEntity below: A Tree Tap you place on a tree, I got the bucket and actual Tree Tap model working fine. The TileEntity stores what type of liquid it is (resin, water or none), whenever it can make the "bucket" start filling up with a particle effect and what volume there is in the bucket. Something I was wondering is if there is a way to have a if statement that would only pass like every other tick or less, to simulate viscosity of different fluids and have the "drip" animation only happen that tick or something. That would also free up some of the network if I only need to send new information that particular tick. TreeTapTileEntityRenderer.java TreeTapTileEntity.java
-
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
Yup, totally missed that, thanks! -
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
Oh, sorry, what I meant is that it keeps setting back to the default value 0 every time I re-loads the game/world. I added the ITickableTileEntity interface to it as I'm going to need it. public class TreeTapTileEntity extends TileEntity implements ITickableTileEntity { private int volume = 0; private boolean canFill = false; public TreeTapTileEntity() { super(IntercraftTileEntities.TREETAP); } @Override public void tick() { if (canFill) { volume++; } } @Override public CompoundNBT write(CompoundNBT compound) { compound.putInt("volume", this.volume); compound.putBoolean("can_fill",this.canFill); return compound; } @Override public void read(CompoundNBT compound) { this.volume = compound.getInt("volume"); this.canFill = compound.getBoolean("can_fill"); } public int getVolume() { return this.volume; } public void setCanFill(boolean bool) { canFill = bool; } } -
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
Like this? @Override public boolean hasTileEntity(BlockState state) { return true; } It doesn't appear to crash anymore. But I don't seem to get my value out of that particular block. TreeTapTileEntity.java public class TreeTapTileEntity extends TileEntity { private int volume = 0; public TreeTapTileEntity() { super(IntercraftTileEntities.TREETAP); } @Override public CompoundNBT write(CompoundNBT compound) { compound.putInt("volume", this.volume); return compound; } @Override public void read(CompoundNBT compound) { this.volume = compound.getInt("volume"); } public int getVolume() { return this.volume; } } TreeTap.java public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { TreeTapTileEntity tile = (TreeTapTileEntity) worldIn.getTileEntity(pos); System.out.println(tile.getVolume()); } -
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
What'd you mean with "sensitive version"? -
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
What do you mean? -
[1.14.2] TileEntity (+TileEntityRenderer )
Simon_kungen replied to Simon_kungen's topic in Modder Support
Oh, whoops. Here it is: crash-2019-08-12_18.32.59-client.txt -
Hi I'm trying to do a TileEntity on one of my blocks which is only supposed to store a single value and then, later on, attach a TileEntityRenderer to display that value (and of course do stuff depending on that value). I've created the TileEntityType without any errors in the log, added the override functions in my block class, but whenever I try and get the data it crashes on a NullPointerException and doing exceptions such as creating a new one only results in it creating a new TileEntity. TreeTapTileEntity.java TreeTap.java IntercraftTileEntites.java
-
Alright, don't think I would ever do that consciously, but just in case I got the repo here where I placed the files. Take a look at them if you want and if you think I copied too much.
-
Oh wow, thanks! This was driving me crazy! I pretty much copied your loot function code and changed the names and did a few adjustments to fit my ores, is that ok with you?
-
Hi Losing the ability to specify block drops in code was a hard blow, I'm really struggling with Loot Tables. I got a few blocks I've failed to get working. One (or rather many identical ones) is not that complicated, but one block has multiple Block Properties. I got the blockstate working fine, but Loot Tables is what's giving me the biggest issue. Going to summarise what the two types of blocks are supposed to drop depending on the blockstate: Tin Ore: Has property; density (0-3) Should drop 2(density+1) intercraftcore:sn_chunk. With Silktouch it should drop 1 intercraftcore:sn_ore with NBT density = blockstate density. Current JSON: Tree Tap: Has property; volume (0-4), bucket (none ,metal_iron, wood_oak) Should drop intercraftcore:treetap. When it has bucket = metal_iron drops minecraft:bucket as an extra and if volume = 4 drops a minecraft:water_bucket instead. It should drop something I'm going to call intercraftcore:wood_oak_bucket when bucket = wood_oak, but I haven't added that yet so it would be redundant to add now to it. This doesn't drop anything at all right, which I can only presume is a syntax error I've missed. But I have no idea how to figure it out as the logs don't say anything: latest.log
-
Alright, so that wasn't so hard. The problem now is that I don't know how to apply the other blockstates to it with the same rotation. I can copy-paste it a bunch of times, but that feels extremely inefficient.
-
Oh wow, totally forgot about that. How do I make it a nested model then? Like having it work after direction and such.
-
Here's all the block properties I'm adding to it: https://github.com/IntercraftMC/IntercraftCore/blob/1.14.2/src/main/java/net/intercraft/intercraftcore/block/TreeTap.java#L32-L39 them: https://github.com/IntercraftMC/IntercraftCore/blob/1.14.2/src/main/java/net/intercraft/intercraftcore/api/BlockProperties.java Sorry for the long delay, I had to play taxi driver for my parents to drive them to a few friends of ours.
-
-
Alright, so I copied this from the brewing stand blockstate, but this doesn't render anything at all: { "multipart": [ { "apply": { "model": "intercraftcore:block/treetap/treetap" }}, { "when": { "bucket": "wooden_bucket" }, "apply": { "model": "intercraftcore:block/treetap/wooden_bucket" } } ] }
-
The idea was to render a bucket model when my block property is "wooden_bucket". I want it to be rotatable which the old file could while this one doesn't render at all.
-
Hi I have probably missed a step, but I can't get my blockstate model to work. It is supposed to always render the main model, then change the orientation and if has a bucket in it, render that as a sub-model. But right now it doesn't render anything at all, I got the orientation part working but when adding the sub-model condition it broke apart: New blockstate model (not working): Old blockstate model (working):