Everything posted by memcallen
-
Proper way to bind texture for IItemRenderer
package com.example.gammacraft.ItemRenderers; import org.lwjgl.opengl.GL11; import assets.gammacraft.textures.models.ModelMiniJetEngine; import assets.gammacraft.textures.models.TestItemModel; import com.example.gammacraft.gammacraft; import com.example.gammacraft.TileEntity.RotaryServoTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; public class TestItemModelRenderer implements IItemRenderer { public static TestItemModel model; public TestItemModelRenderer() { this.model=new TestItemModel(); } @Override public boolean handleRenderType(ItemStack arg0, ItemRenderType arg1) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack itemstack, Object... arg2) { GL11.glPushMatrix(); if(type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } @Override public boolean shouldUseRenderHelper(ItemRenderType arg0, ItemStack arg1,ItemRendererHelper arg2) { return true; } }
-
Proper way to bind texture for IItemRenderer
I tried this in the render method, the item "renders" but with no texture: Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("gammacraft","textures/models/TestTexture.png")); also, it deleted all my mod's textures... :'( please help
-
[1.7.2]Create Instant Structures?[Solved]
wrong function its @Override public void onBlockPlacedBy(World world,int x,int y,int z,EntityLivingBase entity, ItemStack itemstack){ //code } Also you should do @Override before your functions, because if the function is incorrect, you get an error.
-
GL11.glRotated acting weird
any GL11 wizards out there know how to fix this?
-
GL11.glRotated acting weird
I need some help with this, I'm trying to rotate a jet engine I created (it's a model) with GL11.glRotated but it was acting weirdly heres a link to the video: code for render file: public class MiniJetEngineRenderer extends TileEntitySpecialRenderer { public static ModelMiniJetEngine model; public MiniJetEngineRenderer() { this.model=new ModelMiniJetEngine(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { int x1 = te.xCoord; int y1 = te.yCoord; int z1 = te.zCoord; World world = te.getWorldObj(); double rotation = 0D; if(world.getBlock(x1, y1-1, z1)==gammacraft.Servo){ RotaryServoTileEntity tile = (RotaryServoTileEntity)world.getTileEntity(x1, y1-1, z1); rotation = (double)(tile.Rotation*3.6F); } GL11.glRotated(rotation, 0D, 1D, 0D); GL11.glTranslated(x, y, z); this.bindTexture(new ResourceLocation("gammacraft","textures/models/MiniJetEngineBlock.png")); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glTranslated(-x, -y, -z); GL11.glRotated(-rotation, 0D, 1.0D, 0D); } } Also the block below the engine stores it's rotation in radians, which is why I'm multiplying by 3.6F. (I made it like that so you don't have to click 360 times for it to rotate 1 turn)
-
easy way to detect lots of blocks
I was planning on using a centralized TileEntity to control if the structure was formed (just for an inventory). What type of variable should I use to save the structure map?
-
easy way to detect lots of blocks
Yes, when the player completes the structure, the accelerator will work correctly. It's basically just a giant machine. I don't know if I should check in onBlockActivated or updateTick.
-
easy way to detect lots of blocks
I'm making a particle accelerator type thing, and it will be very massive, but I don't want to have a world.getblock for each block. That would get too crazy too fast. Is there an easier way to do this? ( it doesn't have to be easier just less huge)
-
proper dimension teleportation?
For me, it was when I teleported to the nether, but I teleported under the world somehow. And when I teleported back to the overworld, it just didn't render.
-
proper dimension teleportation?
Thanks it works, sometimes the overworld doesn't render properly, but other than that it works fine.
-
[1.7.10] Won't read mods (Mods do not work!)
I can't see any immediate errors, although it might be a mod compatibility issue. Do you have the stacktrace after "Caused by: java.lang.NullPointException"?
-
proper dimension teleportation?
(bump) I've tried multiple things to teleport the player, all of them either crash you or send you to the nether and I have no idea why.
-
proper dimension teleportation?
I just tested travelToDimension, it sent me to the nether even though I put in the correct ID.
-
proper dimension teleportation?
Ok awesome, I never knew about that. I thought you had to do some crazy thing to decompile it all...
-
proper dimension teleportation?
yeah I kind of figured that, I was reading the other topic on the same-ish subject and I couldn't understand the teleportation code at all. unfortunately I also have no idea how to unpack the minecraft files.
-
proper dimension teleportation?
I created a custom dimension that works fine. currently it's just a copy of the overworld. I need help with teleportation to the dimension, currently what I'm doing is player.dimension=myDimensionID; this works, but it doesn't teleport the player and you collide with invisible blocks which I think are from my custom dimension. I'm pretty sure it's a client-server sync issue but I can't solve it.
-
Gui not rendering
I've figured out how to make it render, but how can I get the height/width of the minecraft window?
-
Gui not rendering
Ok I think I got it to work, it still doesn't print anything but it can pause the game when I right click. and unpause when I press esc. now I need to figure out how to render it.
-
Gui not rendering
Mitchellbrine, that's what it's supposed to do, should've worded it better. diedieten07, what do you mean the server can't access the class?
-
Gui not rendering
thats the thing though...its not printing anything
-
Gui not rendering
I'm sure I'm doing something wrong but I can't find It. ps this is my first time using a gui GuiScreen: GuiHandler: GuiHandler register: NetworkRegistry.INSTANCE.registerGuiHandler(Instance, new GuiHandler()); openGui code in block class: @Override public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int side,float hx,float hy,float hz{ player.openGui(gammacraft.Instance, 3, world, x, y, z); return true; } I'm sure its just some stupid mistake that I can't find. also this doesn't render anything, it just prints "render" in the console, but it doesn't do anything
- rotating model?
-
rotating model?
the render class is fairly useless considering the "render" method is in the model but whatever. Also I will check out the IItemRenderer tutorial. package blockRenderers; import org.lwjgl.opengl.GL11; import com.example.gammacraft.TileEntity.TurbineTileEntity; import com.example.gammacraft.models.ModelMiniJet; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; public class TurbineRenderer extends TileEntitySpecialRenderer{ private static ModelTurbine model; public TurbineRenderer() { this.model = new ModelTurbine(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y,double z, float scale) { System.out.println("rendering"); GL11.glTranslated(x, y, z); this.bindTexture(new ResourceLocation("gammacraft:textures/blocks/Candle.png")); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glTranslated(-x, -y, -z); } }
-
rotating model?
also how could I set the Block's item texture? currently they are just the default pink and black squares.
-
rotating model?
I have already created this topic (sorry). but I have ran into another problem, my model was working correctly but now the rotating parts don't render, I used to be able to render only one rotating part but now they don't render at all. can someone please point me in the right direction? render of model without rotation: render of model with rotation: code for model class: package com.example.gammacraft.models; import com.example.gammacraft.TileEntity.MiniJetTileEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; public class ModelMiniJet extends ModelBase { //fields ModelRenderer base; ModelRenderer layer145; ModelRenderer layer190; ModelRenderer Shape1; ModelRenderer layer1452; ModelRenderer layer1902; ModelRenderer Blade1; ModelRenderer Blade2; ModelRenderer Blade3; ModelRenderer Blade_4; public ModelMiniJet() { textureWidth = 64; textureHeight = 32; //base base = new ModelRenderer(this, 0, 0); base.addBox(0F, 0F, 0F, 16, 1, 16); base.setRotationPoint(-8F, -1F, -8F); base.setTextureSize(64, 32); base.mirror = true; setRotation(base, 0F, 0F, 0F); //layer 1 layer145 = new ModelRenderer(this, 0, 0); layer145.addBox(-2.5F, 0F, -2.5F, 5, 1, 5); layer145.setRotationPoint(0F, -2F, 0F); layer145.setTextureSize(64, 32); layer145.mirror = true; setRotation(layer145, 0F, -0.7853982F, 0F); layer190 = new ModelRenderer(this, 0, 0); layer190.addBox(-2.5F, 0F, -2.5F, 5, 1, 5); layer190.setRotationPoint(0F, -2F, 0F); layer190.setTextureSize(64, 32); layer190.mirror = true; setRotation(layer190, 0F, 0F, 0F); //pole Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(-1.5F, 0F, -1.5F, 3, 17, 3); Shape1.setRotationPoint(0F, -19F, 0F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); //layer 2 layer1452 = new ModelRenderer(this, 0, 0); layer1452.addBox(-2.5F, 0F, -2.5F, 5, 1, 5); layer1452.setRotationPoint(0F, -20F, 0F); layer1452.setTextureSize(64, 32); layer1452.mirror = true; setRotation(layer1452, 0F, -0.7853982F, 0F); layer1902 = new ModelRenderer(this, 0, 0); layer1902.addBox(-2.5F, 0F, -2.5F, 5, 1, 5); layer1902.setRotationPoint(0F, -20F, 0F); layer1902.setTextureSize(64, 32); layer1902.mirror = true; setRotation(layer1902, 0F, 0F, 0F); //turbines Blade1 = new ModelRenderer(this, 0, 0); Blade1.addBox(-0.4666667F, 0F, -7F, 1, 17, 14); Blade1.setRotationPoint(0F, -19F, 0F); Blade1.setTextureSize(64, 32); Blade1.mirror = true; setRotation(Blade1, 0F, -0.7853982F, 0F); Blade2 = new ModelRenderer(this, 0, 0); Blade2.addBox(-0.5F, 0F, -7F, 1, 17, 14); Blade2.setRotationPoint(0F, -19F, 0F); Blade2.setTextureSize(64, 32); Blade2.mirror = true; setRotation(Blade2, 0F, 0F, 0F); Blade3 = new ModelRenderer(this, 0, 0); Blade3.addBox(-0.5F, 0F, -7F, 1, 17, 14); Blade3.setRotationPoint(0F, -19F, 0F); Blade3.setTextureSize(64, 32); Blade3.mirror = true; setRotation(Blade3, 0F, 1.570796F, 0F); Blade_4 = new ModelRenderer(this, 0, 0); Blade_4.addBox(-0.5F, 0F, -7F, 1, 17, 14); Blade_4.setRotationPoint(0F, -19F, 0F); Blade_4.setTextureSize(64, 32); Blade_4.mirror = true; setRotation(Blade_4, 0F, 0.7853982F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5,entity); base.render(f5); layer145.render(f5); layer190.render(f5); Shape1.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F; Shape1.render(f5); Blade1.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F; Blade1.render(f5); Blade2.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F; Blade2.render(f5); Blade3.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F; Blade3.render(f5); Blade_4.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F; Blade_4.render(f5); layer1452.render(f5); layer1902.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5,Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } I would've used spoilers but they're derping again
IPS spam blocked by CleanTalk.