Whoever made the items float?

This commit is contained in:
Ellpeck 2016-03-18 18:16:25 +01:00
parent 7a236aa2b3
commit 56f9402fde
3 changed files with 21 additions and 62 deletions

View file

@ -28,72 +28,41 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
if(tile instanceof TileEntitySmileyCloud){ if(tile instanceof TileEntitySmileyCloud){
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile; TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
if(theCloud.flyHeight == 0){
theCloud.flyHeight = tile.getWorld().rand.nextInt(30)+30;
}
int bobHeight = theCloud.flyHeight;
double theTime = Minecraft.getSystemTime();
double time = theTime/50;
if(time-bobHeight >= theCloud.lastFlyHeight){
theCloud.lastFlyHeight = time;
}
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
if(time-(bobHeight/2) >= theCloud.lastFlyHeight){
GlStateManager.translate(0, (time-theCloud.lastFlyHeight)/300, 0);
}
else{
GlStateManager.translate(0, -(time-theCloud.lastFlyHeight)/300+(double)bobHeight/300, 0);
}
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F); GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -2F, 0.0F); GlStateManager.translate(0.0F, -2F, 0.0F);
if(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"))){ theCloud.setStatus(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud")));
theCloud.setPinkAndFluffy();
}
else{
theCloud.setNormalCloud();
}
if(theCloud.name != null && !theCloud.name.isEmpty()){ if(theCloud.name != null && !theCloud.name.isEmpty()){
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){ easterEggs : for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
boolean canBreak = false;
for(String triggerName : cloud.getTriggerNames()){ for(String triggerName : cloud.getTriggerNames()){
if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){ if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){ switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
case 1:{ case 1:
GlStateManager.rotate(180, 0, 1, 0); GlStateManager.rotate(180, 0, 1, 0);
break; break;
} case 2:
case 2:{
GlStateManager.rotate(270, 0, 1, 0); GlStateManager.rotate(270, 0, 1, 0);
break; break;
} case 3:
case 3:{
GlStateManager.rotate(90, 0, 1, 0); GlStateManager.rotate(90, 0, 1, 0);
break; break;
} }
}
cloud.renderExtra(0.0625F); cloud.renderExtra(0.0625F);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
canBreak = true; break easterEggs;
break;
} }
} }
if(canBreak){
break;
}
} }
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){ if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.3F, z+0.66); AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.66);
} }
} }

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -381,8 +380,7 @@ public class SmileyCloudEasterEggs{
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.rotate(180F, 0F, 0F, 1F); GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90, 0, 1, 0); GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.translate(0F, -1.5F, 0F); GlStateManager.translate(0.2, -1F, leftHand ? -0.525F : 0.525F);
GlStateManager.translate(0, 0.2F, leftHand ? -0.5F : 0.55F);
GlStateManager.scale(0.75F, 0.75F, 0.75F); GlStateManager.scale(0.75F, 0.75F, 0.75F);
AssetUtil.renderItemInWorld(stack); AssetUtil.renderItemInWorld(stack);
@ -393,14 +391,11 @@ public class SmileyCloudEasterEggs{
private static void renderHeadBlock(Block block, int meta, float rotation){ private static void renderHeadBlock(Block block, int meta, float rotation){
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.translate(-0.015F, 0.6F, 0.075F); GlStateManager.translate(-0.015F, 0.625F, 0.04F);
GlStateManager.scale(0.3F, 0.3F, 0.3F); GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(rotation, 0F, 1F, 0F); GlStateManager.rotate(rotation, 0F, 1F, 0F);
double boop = Minecraft.getSystemTime()/1000D;
GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0);
AssetUtil.renderBlockInWorld(block, meta); AssetUtil.renderBlockInWorld(block, meta);
GlStateManager.enableLighting(); GlStateManager.enableLighting();

View file

@ -14,18 +14,12 @@ import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Objects; import java.util.Objects;
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
public String name; public String name;
@SideOnly(Side.CLIENT)
public double lastFlyHeight;
@SideOnly(Side.CLIENT)
public int flyHeight;
private String nameBefore; private String nameBefore;
@Override @Override
@ -58,16 +52,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
this.name = text; this.name = text;
} }
public void setPinkAndFluffy(){ public void setStatus(boolean pinkAndFluffy){
if(PosUtil.getMetadata(this.pos, this.worldObj) <= 3){ int meta = PosUtil.getMetadata(this.pos, this.worldObj);
PosUtil.setMetadata(this.pos, this.worldObj, PosUtil.getMetadata(this.pos, this.worldObj)+4, 2); if(pinkAndFluffy){
if(meta <= 3){
PosUtil.setMetadata(this.pos, this.worldObj, meta+4, 2);
} }
} }
else{
public void setNormalCloud(){ if(meta >= 4){
if(PosUtil.getMetadata(this.pos, this.worldObj) >= 4){ PosUtil.setMetadata(this.pos, this.worldObj, meta-4, 2);
PosUtil.setMetadata(this.pos, this.worldObj, PosUtil.getMetadata(this.pos, this.worldObj)-4, 2); }
} }
} }
} }