Jump to content

leplopp

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Personal Text
    Hi i'm leplopp

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

leplopp's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, I have a problem with my mod IDs, my ID management is very wasteful and i will be fixed this with Metadata for Blocks. I have no idea how to do it. My Mod have 1500 blocks with no metadata the Blocks are in a array, i want the IDs in the metadata because forge has a maximum ID limit. If the mod included with other mods, minecraft crashed because there is a ID limit. Can someone show me how to use Metadata in Minecraft 1.9.4 - 1.12+ An example would help very much. Thanks in advance
  2. Hello I have a problem with slopes in my mod. I use a Blender .obj file in my Minecraft mod, The block have a problem with the lighting, brightness. The brightness of the block is wrong not as at a normal block. I also have a problem with the rotation of the slopes. After each restart, the rotation of the slopes retruns to its default position. here is a picture of the problem: and here is a picture in the Night: You can clearly see the problem in the picture. What is wrong with the brigthness? here is my Block code: package mbm.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mbm.mbm; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class Blockroofs extends BlockContainer{ public Blockroofs(Material material, int type) { super(material); this.setBlockName("Blockroof"); } public boolean renderAsNormalBlock() { return false; } @Override public int getRenderType(){ return -1; } @Override public boolean isOpaqueCube(){ return false; } @Override public boolean isBlockNormalCube() { return false; } @Override public TileEntity createNewTileEntity(World world, int par2) { return new TileEntityBlockroofs(); } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { if (entity == null) { return; } TileEntityBlockroofs tile = (TileEntityBlockroofs) world.getTileEntity(x, y, z); tile.direction = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(mbm.MODID + ":" + this.getUnlocalizedName().substring(5)); } } here is my TileEntity code: package mbm.blocks; import net.minecraft.tileentity.TileEntity; public class TileEntityBlockroofs extends TileEntity { /* Rotation */ public float rotation = 0; /* Scale */ public float scale = 0; @Override public void updateEntity(){ if (worldObj.isRemote) rotation = (float) 0.5; if (worldObj.isRemote) scale = (float) 0.5; } public int direction; } here is my TileEntitySpecialRenderer code: package mbm.blocks; import org.lwjgl.opengl.GL11; import mbm.mbm; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; public class RenderTileEntityBlockroofs extends TileEntitySpecialRenderer{ ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public RenderTileEntityBlockroofs(){ texture = new ResourceLocation(mbm.MODID, "model/Blockroof.png"); objModelLocation = new ResourceLocation(mbm.MODID, "model/Blockroof.obj"); // Blender .obj model = AdvancedModelLoader.loadModel(objModelLocation); } private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (+90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float timeSinceLastTick) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); this.bindTexture(texture); GL11.glRotatef(0F, 1.0F, 1.0F, 1.0F); GL11.glPushMatrix(); TileEntityBlockroofs tile = (TileEntityBlockroofs) tileentity; int direction = tile.direction; GL11.glRotatef(direction * +90, 0.0F, 1.0F, 0.0F); GL11.glScaled(0.5, 0.5, 0.5); model.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); } } here is my proxy code: TileEntitySpecialRenderer renderer = new RenderTileEntityBlockroofs(); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBlockroofs.class, new RenderTileEntityBlockroofs()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(mbm.Blockroof), new BlockitemRenderer(new TileEntityBlockroofs(), new RenderTileEntityBlockroofs())); here is my register in my mod: //In the preinit Blockroof = new Blockroofs(Material.iron, 0).setCreativeTab(mbmblocks).setBlockName("Blockroof"); //In the init registerblocks(); //In the postinit proxy.registermodells(); //In registerBlocks private void registerblocks() { GameRegistry.registerBlock(Blockroof, "Blockroof"); } Thank you in advance
×
×
  • Create New...

Important Information

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