Update done!

This commit is contained in:
Ellpeck 2015-03-30 18:42:14 +02:00
parent 3587e366ff
commit 09d67f95a4
6 changed files with 157 additions and 3 deletions

View file

@ -28,7 +28,7 @@ public class RenderItems implements IItemRenderer{
} }
@Override @Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data){ public void renderItem(ItemRenderType type, ItemStack stack, Object... data){
switch(type){ switch(type){
case INVENTORY: case INVENTORY:
GL11.glPushMatrix(); GL11.glPushMatrix();

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -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";
}
}

View file

@ -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();
}
}

View file

@ -4,9 +4,11 @@ package ellpeck.actuallyadditions.proxy;
import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ClientRegistry;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.render.*; import ellpeck.actuallyadditions.blocks.render.*;
import ellpeck.actuallyadditions.event.RenderPlayerEventAA;
import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.tile.TileEntityFishingNet;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
@ -15,11 +17,13 @@ public class ClientProxy implements IProxy{
@Override @Override
public void preInit(){ public void preInit(){
Util.logInfo("PreInitializing ClientProxy...");
} }
@Override @Override
public void init(){ public void init(){
Util.logInfo("Initializing ClientProxy...");
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(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())); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar()));
Util.registerEvent(new RenderPlayerEventAA());
} }
@Override @Override
public void postInit(){ public void postInit(){
Util.logInfo("PostInitializing ClientProxy...");
} }
} }