From 09d67f95a43312fd0d541a185a75359ec4d2845c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 30 Mar 2015 18:42:14 +0200 Subject: [PATCH] Update done! --- .../blocks/render/RenderItems.java | 2 +- .../event/RenderPlayerEventAA.java | 45 ++++++++++++++++++ .../gadget/ModelStandardBlock.java | 30 ++++++++++++ .../actuallyadditions/gadget/ModelTorch.java | 27 +++++++++++ .../gadget/RenderSpecial.java | 46 +++++++++++++++++++ .../actuallyadditions/proxy/ClientProxy.java | 10 +++- 6 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java create mode 100644 src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java index 202ad6a4e..6c7e9fc1b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderItems.java @@ -28,7 +28,7 @@ public class RenderItems implements IItemRenderer{ } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data){ + public void renderItem(ItemRenderType type, ItemStack stack, Object... data){ switch(type){ case INVENTORY: GL11.glPushMatrix(); diff --git a/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java new file mode 100644 index 000000000..42fba23ef --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/RenderPlayerEventAA.java @@ -0,0 +1,45 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; +import ellpeck.actuallyadditions.gadget.ModelStandardBlock; +import ellpeck.actuallyadditions.gadget.ModelTorch; +import ellpeck.actuallyadditions.gadget.RenderSpecial; +import net.minecraftforge.client.event.RenderPlayerEvent; + +import java.util.UUID; + +public class RenderPlayerEventAA{ + + private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("ESD")); + private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch()); + private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Derp")); + private RenderSpecial glenRender = new RenderSpecial(new ModelFurnaceSolar()); + + @SubscribeEvent + public void RenderPlayerEvent(RenderPlayerEvent.Pre event){ + //Ellpeck + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){ + ellpeckRender.render(0.3F, 1F); + return; + } + + //Paktosan + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){ + paktoRender.render(0.3F, 1F); + return; + } + + //TwoOfEight + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){ + glenRender.render(0.3F, 1F); + return; + } + + //dqmhose + if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ + hoseRender.render(0.5F, 1.25F); + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java new file mode 100644 index 000000000..ceccb05fd --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelStandardBlock.java @@ -0,0 +1,30 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import net.minecraft.client.model.ModelRenderer; + +public class ModelStandardBlock extends ModelBaseAA{ + + public ModelRenderer s; + + private String name; + + public ModelStandardBlock(String name){ + this.name = name; + this.textureWidth = 64; + this.textureHeight = 64; + this.s = new ModelRenderer(this, 0, 0); + this.s.setRotationPoint(-8.0F, 8.0F, -8.0F); + this.s.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16, 0.0F); + } + + @Override + public void render(float f){ + this.s.render(f); + } + + @Override + public String getName(){ + return "model" + this.name; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java new file mode 100644 index 000000000..548328e4f --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/ModelTorch.java @@ -0,0 +1,27 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import net.minecraft.client.model.ModelRenderer; + +public class ModelTorch extends ModelBaseAA{ + + public ModelRenderer s; + + public ModelTorch(){ + this.textureWidth = 64; + this.textureHeight = 32; + this.s = new ModelRenderer(this, 0, 0); + this.s.setRotationPoint(-1.0F, 14.0F, -1.0F); + this.s.addBox(0.0F, 0.0F, 0.0F, 2, 10, 2, 0.0F); + } + + @Override + public void render(float f){ + this.s.render(f); + } + + @Override + public String getName(){ + return "modelTorch"; + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java new file mode 100644 index 000000000..0addb0ada --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/gadget/RenderSpecial.java @@ -0,0 +1,46 @@ +package ellpeck.actuallyadditions.gadget; + +import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; +import ellpeck.actuallyadditions.blocks.render.ModelFurnaceSolar; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderSpecial{ + + private double bobbing; + private double rotation; + + ModelBaseAA theModel; + ResourceLocation theTexture; + + public RenderSpecial(ModelBaseAA model){ + this.theModel = model; + this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + (model instanceof ModelFurnaceSolar ? "" : "special/") + this.theModel.getName() + ".png"); + } + + public void render(float size, float offsetUp){ + + if(bobbing >= 0.5) bobbing = 0; + else bobbing+=0.01; + + if(rotation >= 360) rotation = 0; + else rotation+=1; + + GL11.glPushMatrix(); + GL11.glTranslatef(0F, offsetUp, 0F); + GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); + GL11.glScalef(size, size, size); + + if(bobbing <= 0.25)GL11.glTranslated(0, bobbing, 0); + else GL11.glTranslated(0, 0.5 - bobbing, 0); + + GL11.glRotated(rotation, 0, 1, 0); + + Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); + theModel.render(0.0625F); + GL11.glPopMatrix(); + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java index ec1c2ddaf..f6066a752 100644 --- a/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java +++ b/src/main/java/ellpeck/actuallyadditions/proxy/ClientProxy.java @@ -4,9 +4,11 @@ package ellpeck.actuallyadditions.proxy; import cpw.mods.fml.client.registry.ClientRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.render.*; +import ellpeck.actuallyadditions.event.RenderPlayerEventAA; import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.Item; import net.minecraftforge.client.MinecraftForgeClient; @@ -15,11 +17,13 @@ public class ClientProxy implements IProxy{ @Override public void preInit(){ - + Util.logInfo("PreInitializing ClientProxy..."); } @Override public void init(){ + Util.logInfo("Initializing ClientProxy..."); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost())); @@ -28,10 +32,12 @@ public class ClientProxy implements IProxy{ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar())); + + Util.registerEvent(new RenderPlayerEventAA()); } @Override public void postInit(){ - + Util.logInfo("PostInitializing ClientProxy..."); } }