Jump to content

TheTrollguy_

Forge Modder
  • Posts

    71
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Croatia
  • Personal Text
    My mom bakes cakes, but I bake models...

Recent Profile Visitors

7084 profile views

TheTrollguy_'s Achievements

Stone Miner

Stone Miner (3/8)

3

Reputation

  1. The support for 1.5.2 was dropped a looooong time ago. I doubt you'll get any help here unless you update to a more recent version (1.8+, preferably 1.12.2).
  2. Q: So I have this TileEntity that I only use to spawn particles every tick (yes, I do need it to be every tick) and I'm wondering since there's no other use for it, do I have to save its data. Is it possible to just create a TileEntity when the block is loaded and not write TileEntity's data to Chunk? It probably is but do I gain anything with it? A: Nope. A TileEntity has to at least write down its basic information to exist after the world is loaded.
  3. Well, I never actually thought about that approach. Now that I really think about it, it does make a lot of sense. Thanks for the heads up!
  4. The way I automized my registrations: Make a HashSet of Blocks/Items in your CommonProxy. In your Block/Item constructor, add the current instance of the class to the HashSet. (ie. CommonProxy.BLOCKS.add(this);) During RegistryEvent.Register, go through your HashSet and register each object (if we're talking about IForgeRegistryEntrys, otherwise register it during the preInit or init phase). Use a Stream, a for-loop, whatever you want. The same applies to models and other client-side stuff.
  5. Hey, I've been recently playing a lot with TRSRTransformation class and I realized that it could probably be easier to use a builder for it rather than passing a million arguments (I know it's just 4, but it looks neater). Let me show you what I mean. First, a few arguments why I even created a TRSR Util class: 1) I didn't know that there were cornerToCenter and centerToCorner methods and at first, they confused me since any rotation I do happens around the center of the block. (I think the majority of modders want it like that). 2) Quaternions. I don't think anybody uses quaternions to in their head to picture a rotation. I know that there are static methods in the TRSRTransformation class to get a quaternion from XYZ degrees, but that makes a horrible mess. 3) Readability. Tell me what is easier to read: TRSRTransformation tr = new TRSRTransformation(new Vector3f(0, 10F, 0), new Quat4f(0, 0.125F, 1, 0), new Vector3f(1, 1.25F, 1), null); VS TRSRTransformation tr = new TRSRTransformation.Builder() .translate(0.125F, 0, 0) .rotate(0, 90, 0) .scale(2, 2, 2) .postRotate(90, 0, 0) .build() You could even specify in the Builder's constructor if you want to use the corner or center version as a boolean variable (true - center, false - corner). And then, the Builder would do all the messy work, while you would just move on with your life. I can even provide a working Builder class I made myself if you all think that this would be a great addition, no matter how small it is, it would help modders a lot.
  6. Well this doesn't work: TRSRTransformation.blockCornerToCenter(new TRSRTransformation( closed ? null : vector, null, null, TRSRTransformation.quatFromXYZ(0, (float) Math.toRadians(90 * direction.ID), 0))); It gets properly rotated, but again it also gets translated weirdly
  7. Myproblem: weird rotation when using TRSRTransformation while baking IModels caused by the rotation axis not being in the center of the block. Solution: Use TRSRTransformation.blockCenterToCorner to convert your TRSRTransformation (even though you would intuitively use TRSRTransformation.blockCornerToCenter). Original post:
  8. Thanks diesieben07! Now another thing that makes zero sense to me related to IBakedModel. The method getQuads accepts EnumFacing as one of its arguments. While I was experimenting with something, I found out that sometimes, when the method gets called, null gets passed as the EnumFacing argument. Why is that? I know that if IBlockState argument is null, the quads are for an item model. The reason is written on the Forge Docs: mcforge.readthedocs.io/en/latest/models/advanced/ibakedmodel/#getquads
  9. I really hate to *bump* my posts, buuuut, anyone?
  10. Hi, I want to retexture my IModel, but the thing is I just end up with the 'missing texture' texture. I've been stuck with this problem for hours now, soo any help would be appreciated :) CODE:
  11. So I'm trying to render my .obj model in my TESR, but it is always dark. If I don't disable the lighting, it renders completely black. What am I doing wrong? Is there something to tweak while exporting my models or? P.S. I'm using TESR because there are going to be some animations and whatnot, so don't bother telling me that I shouldn't use TESR when I should. TESRCounter.java package tt.kitchenstuffmod.client.renderer.blockentity; import org.lwjgl.opengl.GL11; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import tt.kitchenstuffmod.blockentity.BlockEntityCounter; import tt.kitchenstuffmod.main.KitchenStuffMod; import tt.kitchenstuffmod.util.ModelLoader; @SideOnly(Side.CLIENT) public class TESRCounter extends TileEntitySpecialRenderer<BlockEntityCounter> { private static IBakedModel top; private static IBakedModel body; private static IBakedModel lower; private static IBakedModel upper; public static void loadModels() { top = ModelLoader.loadModel("counter/counter_top"); // 'loadModel' just loads the models and handles exceptions, nothing special... body = ModelLoader.loadModel("counter/top_01"); lower = ModelLoader.loadModel("counter/lowerdraw"); upper = ModelLoader.loadModel("counter/upperdraw"); KitchenStuffMod.log("Models loaded..."); } private Tessellator tessellator; private BufferBuilder buffer; private World world; private BlockPos position; private IBlockState block_state; private BlockModelRenderer renderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer(); @Override public void render(BlockEntityCounter block_entity, double x, double y, double z, float partial_ticks, int destroy_stage, float alpha) { this.tessellator = Tessellator.getInstance(); this.buffer = this.tessellator.getBuffer(); this.world = block_entity.getWorld(); this.position = block_entity.getPos(); this.block_state = world.getBlockState(position); BlockPos entity_position = block_entity.getPos(); push_all(); GlStateManager.translate(x - entity_position.getX(), y - entity_position.getY(), z - entity_position.getZ()); GlStateManager.disableLighting(); // the name of the texture is wrong, on purpose (top get the purple-black thingy) render_model(body, new ResourceLocation("minecraft", "textures/blocks/planks_fbirch.png")); pop_all(); } private void render_model(IBakedModel model, ResourceLocation texture) { this.buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); this.bindTexture(texture); this.renderer.renderModel(world, model, block_state, position, buffer, true); this.tessellator.draw(); } private void push() { GlStateManager.pushMatrix(); } private void push_all() { GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); } private void pop() { GlStateManager.popMatrix(); } private void pop_all() { GlStateManager.popMatrix(); GlStateManager.popAttrib(); } }
  12. So I'm stuck on this silly problem. All I want is to render my .obj model in my TESR. Here's the back-story. I have a .obj model that I want to render in my TESR. The texture that I want to render on the model is determined by a 'type' enum that every tile entity holds. The reason why I'm using a TESR is that a few parts of the model should be rotated by some factors, etc. What am I supposed to do? What classes should I use to load the .obj file. I found a few tutorials, but most of them were outdated. Can someone give me any directions or some sources to base my code off?
  13. I totally forgot about using instanceof . Thank you! Problem fixed. I'll see myself out now....
  14. So I've been kinda stuck with this event with casting. event.player returns an instance of EntityPlayer, but I need EntityPlayerMP to give the player some recipes. If I cast it to EntityPlayerSP or EntityPlayerMP, it throws ClassCastException (casting it to 'MP crashes Minecraft). Is there any way I can get instances of EntityPlayerSP and EntityPlayerMP or is there a way to check on which side the code is run?
×
×
  • Create New...

Important Information

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