Everything posted by TheUnlocked
-
[1.11.2] Client and Server are sent different Tile Entity NBT
Thanks!
-
[1.11.2] Client and Server are sent different Tile Entity NBT
My client refused to sync with my server with loaded TileEntity NBT data, and so after I couldn't find anything new to try online, I eventually added some world.isRemote breakpoints in my TileEntity's readFromNBT method. I found that none of my code was wrong, it was just that the client and server were being fed different NBTTagCompounds. Now this can of course be fixed using packets to synchronize the client and server, but there has to be a better way than that. It seems like such a common thing to want to synchronize a TileEntity that you shouldn't need to explicitly make a packet and packet handler to sync them. If I do need to, that's fine, but I want to see if there's a better way first.
-
[1.11.2] How to make variable water level in a block
Thanks for all the help! It works now! For others who are looking for examples, here's my complete RenderExample class public class RenderExample extends FastTESR<BlockExample.TileEntityExample>{ @Override public void renderTileEntityFast(@Nonnull BlockExample.TileEntityExample te, double x, double y, double z, float partialTicks, int destroyStage, @Nonnull VertexBuffer vertexBuffer) { final float PX = 1f / 16f; final float YOFF = 1 * PX; final float BORDER = 1.9f * PX; final float MAXHEIGHT = 10 * PX; final float LOW = 5.9f * PX; float actualHeight = (MAXHEIGHT * te.waterLevel) + YOFF; BlockModelShapes bm = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); TextureAtlasSprite still = bm.getTexture(Blocks.WATER.getDefaultState()); TextureAtlasSprite flow = bm.getTexture(Blocks.FLOWING_WATER.getDefaultState()); // Lightmap calculations int upCombined = getWorld().getCombinedLight(te.getPos().up(), 0); int upLMa = upCombined >> 16 & 65535; int upLMb = upCombined & 65535; int northCombined = getWorld().getCombinedLight(te.getPos().add(new BlockPos(0,0,1)), 0); int northLMa = northCombined >> 16 & 65535; int northLMb = northCombined & 65535; int southCombined = getWorld().getCombinedLight(te.getPos().add(new BlockPos(0,0,-1)), 0); int southLMa = southCombined >> 16 & 65535; int southLMb = southCombined & 65535; int westCombined = getWorld().getCombinedLight(te.getPos().add(new BlockPos(-1,0,0)), 0); int westLMa = westCombined >> 16 & 65535; int westLMb = westCombined & 65535; int eastCombined = getWorld().getCombinedLight(te.getPos().add(new BlockPos(1,0,0)), 0); int eastLMa = eastCombined >> 16 & 65535; int eastLMb = eastCombined & 65535; vertexBuffer.setTranslation(x,y,z); //UP face vertexBuffer.pos(BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(still.getMinU(), still.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(still.getMaxU(), still.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(still.getMaxU(), still.getMaxV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(still.getMinU(), still.getMaxV()).lightmap(upLMa,upLMb).endVertex(); //NORTH face vertexBuffer.pos(BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, LOW, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMaxV()).lightmap(northLMa,northLMb).endVertex(); vertexBuffer.pos(BORDER, LOW, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMaxV()).lightmap(northLMa,northLMb).endVertex(); //SOUTH face vertexBuffer.pos(BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, LOW, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMaxV()).lightmap(southLMa,southLMb).endVertex(); vertexBuffer.pos(BORDER, LOW, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMaxV()).lightmap(southLMa,southLMb).endVertex(); //WEST face vertexBuffer.pos(BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(BORDER, LOW, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMaxV()).lightmap(westLMa,westLMb).endVertex(); vertexBuffer.pos(BORDER, LOW, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMaxV()).lightmap(westLMa,westLMb).endVertex(); //EAST face vertexBuffer.pos(1 - BORDER, actualHeight, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMinV()).lightmap(upLMa,upLMb).endVertex(); vertexBuffer.pos(1 - BORDER, LOW, 1 - BORDER).color(1f,1f,1f,0.8f).tex(flow.getMaxU(), flow.getMaxV()).lightmap(eastLMa,eastLMb).endVertex(); vertexBuffer.pos(1 - BORDER, LOW, BORDER).color(1f,1f,1f,0.8f).tex(flow.getMinU(), flow.getMaxV()).lightmap(eastLMa,eastLMb).endVertex(); } } And registering the FastTESR put this in preInit: ClientRegistry.bindTileEntitySpecialRenderer(BlockCrystalGrowthChamber.TileEntityCrystalGrowthChamber.class, new RenderCrystalGrowthChamber()); And finally what it looks like (the rest of the model is registered like a regular block model):
-
[1.11.2] How to make variable water level in a block
Thanks so much for the help. One more question: How would I go about adding more faces? It feels a bit sketchy to just add more vertices because I don't really get where or when I would add them. I'm fine with making a whole cube rather than just three faces if that's easier. If not, that's fine too.
-
[1.11.2] How to make variable water level in a block
After doing what you said, it does render the water, but why? It's very un-intuitive for a get function to set a value. I'm wonder what I'm supposed to put for the lightmap. My version of forge has those parameters obfuscated, and I don't completely get what the lightmap is. I think it has something to do with sun/artificial light, but ¯\_(ツ)_/¯ The same goes for color. I just stuck .color(1f,1f,1f,1f) onto all of the vertices, but idk if that's what I'm supposed to do. I have a feeling this is related to the lightmap and color, but the water texture is super dark (as seen in the attached image).
-
[1.11.2] How to make variable water level in a block
So I've made... a thing. It doesn't work, but to be fair I also didn't really expect it to. Where do I go from here? Inside of renderTileEntityFast final float PX = 1f / 16f; // Aligning with the block models final float YOFF = 1 * PX; final float BORDER = 2 * PX; final float MAXHEIGHT = 10 * PX; float actualHeight = (MAXHEIGHT * te.waterLevel) + YOFF; BlockModelShapes bm = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); TextureAtlasSprite still = bm.getTexture(Blocks.WATER.getDefaultState()); // What do I do with this? //vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); // It complained at me (aka crashed) when I tried to use this vertexBuffer.pos(BORDER, actualHeight, BORDER).tex(still.getMinU(), still.getMinV()).endVertex(); // I feel like I'm doing this all wrong vertexBuffer.pos(1 - BORDER, actualHeight, BORDER).tex(still.getMaxU(), still.getMinV()).endVertex(); vertexBuffer.pos(1 - BORDER, actualHeight, 1 - BORDER).tex(still.getMaxU(), still.getMaxV()).endVertex(); vertexBuffer.pos(BORDER, actualHeight, 1 - BORDER).tex(still.getMinU(), still.getMaxV()).endVertex(); Inside of preInit ClientRegistry.bindTileEntitySpecialRenderer(BlockExample.TileEntityExample.class, new RenderExample());
-
[1.11.2] How to make variable water level in a block
Thanks. I'll try to combine that with examples and check back if I can't figure it out.
-
[1.11.2] How to make variable water level in a block
I want a smooth animation, so blockstates/models are basically out of the option. From my OP:
-
[1.11.2] How to make variable water level in a block
BlockFluidRenderer does appear to have code for rendering fluids based on height, but it's generalized for ALL fluids, takes things like slope into account, and is completely unreadable to someone who has no experience with the specific topic. It's the same reason that reading the TC code is hard, but to an extreme.
-
[1.11.2] How to make variable water level in a block
The title basically says it. Similar to what you might see in a Tinkers Construct lava tank. I have basically no knowledge of custom block rendering, and looking online I've only found nothing super useful. Yes, I'm aware TC is open source, but it's hard to learn something from example when you have no knowledge to kick off from. Here's what I already have: I already have some variable that represents the water level stored in a tile entity. I can easily convert this number to a percentage. I already have block model and block state json files, which I have responding to IProperties. Here's what I want to know how to do: I want to render water on the sides and top (the user can only look in from the north, south, and top, but since the block can be rotated it might be easier to render on all sides) with a height according to water level value I want to register my custom renderer if necessary (this is something I haven't managed to find anywhere) I would prefer if I could do this algorithmically rather than needing to make a ton of block model files because I'm sure this can be done algorithmically I do NOT need to have support for any liquid other than water Again, emphasis on I've never touched custom block renderers before, even in older versions of forge. If there's already a really good explanation out there of how to do this, feel free to link me to that. Thanks in advance to anyone who helps.
-
1.10/1.11 compatibility
Oh, okay. Thanks.
-
1.10/1.11 compatibility
Not sure if I'm posting this in the right place. Feel free to move it if not. Correct me if I'm wrong, but I don't think much changed behind the scenes between 1.10 and 1.11. Seeing as there are some mods that claim to use the same jar for both versions, simple (or maybe even not simple) mods shouldn't need to be changed much or at all between 1.10 and 1.11. The issue is that I can't just use the same jar for 1.10 as I use for 1.11, because forge rejects anything with the wrong version number. I assume that It doesn't reject forwards-compatible mods (using a 1.10.2 mod with 1.11.2 forge), but from my very quick tests it does reject backwards-compatible mods (using a 1.11.2 mod with 1.10.2 forge). Is there a way to resolve that issue (I'd like my 1.11.2 mod to be usable in 1.10.2 modpacks) without recreating the development environment for 1.10 forge, or do I need to re-generate my dev environment? Note: I tried changing the minecraft version in build.gradle, but then it threw an error when I tried to build it, so I don't think it's that easy.
-
White box snowball renders [1.10.2] (RESOLVED)
So it turns out the CTD I was encountering was actually completely unrelated to the item registering (I changed other code as well so I assumed it was an issue with item registering). The thing from my previous post works fine and fixes the problem. For other modders who come across this, don't use any GameRegistry.register stuff for registering items and just use RegistryEvent.Register<Item>.
-
White box snowball renders [1.10.2] (RESOLVED)
I did something similar to your example on that thread you linked... public class ModItems { public static Item FLASH_PEARL = new ItemFlashPearl().setUnlocalizedName("flash_pearl").setRegistryName("flash_pearl"); @Mod.EventBusSubscriber public static class RegistrationHandler { public static final Set<Item> ITEMS = new HashSet<>(); @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); registry.registerAll( FLASH_PEARL ); } } ...but the event never seems to be called (and I couldn't find anything else that I needed to add in your example mod) so the game just crashes when it tries to register a renderer for a non-existent item. I don't have much experience with forge events so I apologize for my ignorance here.
-
White box snowball renders [1.10.2] (RESOLVED)
I recently got back into modding and I've encountered the classic white box entity rendering problem when trying to make an ender-pearl-like item. I've done a lot of googling, and I feel pretty confident in my code, but it still doesn't work for some reason. Here's the relevant code (that is, no other code involves rendering this particular entity) ExampleMod#init @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRenderItems(); proxy.registerRenderEntities(); } Yes, I have all of the @SidedProxy stuff and I know it works ClientProxy public class ClientProxy extends CommonProxy{ @Override public void registerRenderItems(){ ItemModelMesher renderer = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); renderer.register(ModItems.flashPearl, 0, new ModelResourceLocation(ModItems.flashPearl.getRegistryName(), "inventory")); } @Override public void registerRenderEntities(){ RenderingRegistry.registerEntityRenderingHandler(EntityFlashPearl.class, ((rm) -> new RenderSnowball(rm, ModItems.flashPearl, Minecraft.getMinecraft().getRenderItem()))); } }
-
[1.7.2] Sandwich that you can add stuff to
well they say what the functions do but they don't really explain how and where you would put them into your program
-
[1.7.2] Sandwich that you can add stuff to
Do you know of any good tutorials for that? Everything I have found simply says what a few functions do.
-
[1.7.2] Sandwich that you can add stuff to
how do I add additional code if a certain crafting recipe is run?
-
[1.7.2] Sandwich that you can add stuff to
I was thinking of making a sandwich in my mod where you would put 2 slices of bread (I already make that item!) together (one on top of the other) to get a Sandwich with item description "empty". Then, you could shapeless craft it with any food to get half the stats of that food added to the sandwich but you can only add a certain number of things to the sandwich and you cannot add twice of the same. I kind of know how to do this but I can't think of any working code. My main problem is accessing and editing a copy of the addShapelessRecipe function. Any help would be appreciated.
-
ItemFood parameter problems
I have forge set up. What I need is the vanilla code so that I can figure out what the super parameters are for various classes. Does that give insructions on how to get the vanilla code?
-
ItemFood parameter problems
I used MCP to decompress the source code but for some reason it decompressed the 1.6.4 jar rather than the 1.7.2 jar (which I gave it). Do you know how to get the 1.7 code?
-
ItemFood parameter problems
They mean: item id, hunger heal amt, saturation increase, tame wolf with this food
-
ItemFood parameter problems
I am trying to make a new food called carrot cake. When I try to use super (with 4 parameters), the quick fixes/error tells me that ItemFood has 2 or 3 parameters even though in the minecraft code, ItemFood can have 3 or 4. The following is my code and error. Code: package com.unlocked.lotsa_food.items; import net.minecraft.creativetab.CreativeTabs; import com.unlocked.lotsa_food.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class CarrotCake extends ItemFood { public CarrotCake(int par1, int par2, float par3, boolean par4) { [glow=red,0,300]super(par1, par2, par3, par4);[/glow] this.setMaxStackSize(64); this.setUnlocalizedName("carrot_cake"); this.setTextureName("lotsafood:carrot_cake"); } } Error: Multiple markers at this line - The constructor ItemFood(int, int, float, boolean) is undefined - Line breakpoint:CarrotCake [line: 14] - CarrotCake(int, int, float, boolean)
IPS spam blocked by CleanTalk.