Re-wrote floating blocks

This commit is contained in:
Ellpeck 2015-08-25 18:26:23 +02:00
parent d44ecdde65
commit dea606e33f
7 changed files with 26 additions and 34 deletions

View file

@ -2,42 +2,42 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.gadget.ModelStandardBlock;
import ellpeck.actuallyadditions.gadget.ModelTorch;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.gadget.RenderSpecial;
import net.minecraft.init.Blocks;
import net.minecraftforge.client.event.RenderPlayerEvent;
import java.util.UUID;
public class RenderPlayerEventAA{
private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("Ellpeck"));
private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch());
private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Pakto"));
private RenderSpecial glenRender = new RenderSpecial(new ModelStandardBlock("Glenthor"));
private RenderSpecial lordiRender = new RenderSpecial(new ModelStandardBlock("Lordi"));
private RenderSpecial ellpeckRender = new RenderSpecial(InitBlocks.blockPhantomLiquiface, 0);
private RenderSpecial hoseRender = new RenderSpecial(Blocks.torch, 0);
private RenderSpecial paktoRender = new RenderSpecial(Blocks.wool, 6);
private RenderSpecial glenRender = new RenderSpecial(InitBlocks.blockHeatCollector, 0);
private RenderSpecial lordiRender = new RenderSpecial(InitBlocks.blockBreaker, 0);
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void RenderPlayerEvent(RenderPlayerEvent.Pre event){
public void RenderPlayerEvent(RenderPlayerEvent.Specials.Pre event){
//Ellpeck
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){
ellpeckRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
ellpeckRender.render(event.entityPlayer, 0.3F, 0);
}
//Paktosan
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){
paktoRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
paktoRender.render(event.entityPlayer, 0.3F, 0);
}
//TwoOfEight
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){
glenRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
glenRender.render(event.entityPlayer, 0.3F, 0);
}
//dqmhose
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){
hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.3F);
hoseRender.render(event.entityPlayer, 0.5F, -0.075F);
}
//Lordi
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("990ecf6d-15dd-442c-b91b-323a6420c78e"))){
lordiRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
lordiRender.render(event.entityPlayer, 0.3F, 0);
}
}
}

View file

@ -1,26 +1,24 @@
package ellpeck.actuallyadditions.gadget;
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;
public class RenderSpecial{
private double lastTimeForBobbing;
ModelBaseAA theModel;
ResourceLocation theTexture;
private Block theBlock;
private int meta;
public RenderSpecial(ModelBaseAA model){
this.theModel = model;
this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/special/" + this.theModel.getName() + ".png");
public RenderSpecial(Block block, int meta){
this.theBlock = block;
this.meta = meta;
}
public void render(EntityPlayer player, float renderTick, float size, float offsetUp){
public void render(EntityPlayer player, float size, float offsetUp){
if(player.isInvisible() || player.getHideCape()) return;
int bobHeight = 70;
@ -32,15 +30,7 @@ public class RenderSpecial{
}
GL11.glPushMatrix();
if(player != Minecraft.getMinecraft().thePlayer){
Vec3 clientPos = Minecraft.getMinecraft().thePlayer.getPosition(renderTick);
Vec3 playerPos = player.getPosition(renderTick);
GL11.glTranslated(playerPos.xCoord-clientPos.xCoord, playerPos.yCoord-clientPos.yCoord+1.6225, playerPos.zCoord-clientPos.zCoord);
}
GL11.glTranslated(0F, offsetUp + 0.15D, 0F);
GL11.glTranslated(0D, -0.775D+offsetUp, 0D);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
GL11.glScalef(size, size, size);
@ -53,8 +43,10 @@ public class RenderSpecial{
GL11.glRotated((double)theTime/20, 0, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);
GL11.glDisable(GL11.GL_LIGHTING);
AssetUtil.renderBlock(this.theBlock, this.meta);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B