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.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.gadget.ModelStandardBlock; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.gadget.ModelTorch;
import ellpeck.actuallyadditions.gadget.RenderSpecial; import ellpeck.actuallyadditions.gadget.RenderSpecial;
import net.minecraft.init.Blocks;
import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderPlayerEvent;
import java.util.UUID; import java.util.UUID;
public class RenderPlayerEventAA{ public class RenderPlayerEventAA{
private RenderSpecial ellpeckRender = new RenderSpecial(new ModelStandardBlock("Ellpeck")); private RenderSpecial ellpeckRender = new RenderSpecial(InitBlocks.blockPhantomLiquiface, 0);
private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch()); private RenderSpecial hoseRender = new RenderSpecial(Blocks.torch, 0);
private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Pakto")); private RenderSpecial paktoRender = new RenderSpecial(Blocks.wool, 6);
private RenderSpecial glenRender = new RenderSpecial(new ModelStandardBlock("Glenthor")); private RenderSpecial glenRender = new RenderSpecial(InitBlocks.blockHeatCollector, 0);
private RenderSpecial lordiRender = new RenderSpecial(new ModelStandardBlock("Lordi")); private RenderSpecial lordiRender = new RenderSpecial(InitBlocks.blockBreaker, 0);
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public void RenderPlayerEvent(RenderPlayerEvent.Pre event){ public void RenderPlayerEvent(RenderPlayerEvent.Specials.Pre event){
//Ellpeck //Ellpeck
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){ 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 //Paktosan
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("0bac71ad-9156-487e-9ade-9c5b57274b23"))){ 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 //TwoOfEight
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("a57d2829-9711-4552-a7de-ee800802f643"))){ 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 //dqmhose
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ 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 //Lordi
else if(event.entityPlayer.getUniqueID().equals(UUID.fromString("990ecf6d-15dd-442c-b91b-323a6420c78e"))){ 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; package ellpeck.actuallyadditions.gadget;
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA; import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class RenderSpecial{ public class RenderSpecial{
private double lastTimeForBobbing; private double lastTimeForBobbing;
ModelBaseAA theModel; private Block theBlock;
ResourceLocation theTexture; private int meta;
public RenderSpecial(ModelBaseAA model){ public RenderSpecial(Block block, int meta){
this.theModel = model; this.theBlock = block;
this.theTexture = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/special/" + this.theModel.getName() + ".png"); 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; if(player.isInvisible() || player.getHideCape()) return;
int bobHeight = 70; int bobHeight = 70;
@ -32,15 +30,7 @@ public class RenderSpecial{
} }
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(0D, -0.775D+offsetUp, 0D);
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.glRotatef(180F, 1.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
GL11.glScalef(size, size, size); GL11.glScalef(size, size, size);
@ -53,8 +43,10 @@ public class RenderSpecial{
GL11.glRotated((double)theTime/20, 0, 1, 0); GL11.glRotated((double)theTime/20, 0, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); GL11.glDisable(GL11.GL_LIGHTING);
theModel.render(0.0625F); AssetUtil.renderBlock(this.theBlock, this.meta);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix(); 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