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){
if(tile instanceof TileEntitySmileyCloud){
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();
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.rotate(180F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -2F, 0.0F);
if(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud"))){
theCloud.setPinkAndFluffy();
}
else{
theCloud.setNormalCloud();
}
theCloud.setStatus(ClientProxy.bulletForMyValentine || (theCloud.name != null && !theCloud.name.isEmpty() && theCloud.name.equals("Pink Fluffy Unicloud")));
if(theCloud.name != null && !theCloud.name.isEmpty()){
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
boolean canBreak = false;
easterEggs : for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
for(String triggerName : cloud.getTriggerNames()){
if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){
GlStateManager.pushMatrix();
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
case 1:{
case 1:
GlStateManager.rotate(180, 0, 1, 0);
break;
}
case 2:{
case 2:
GlStateManager.rotate(270, 0, 1, 0);
break;
}
case 3:{
case 3:
GlStateManager.rotate(90, 0, 1, 0);
break;
}
}
cloud.renderExtra(0.0625F);
GlStateManager.popMatrix();
canBreak = true;
break;
break easterEggs;
}
}
if(canBreak){
break;
}
}
}
GlStateManager.popMatrix();
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.util.AssetUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -381,8 +380,7 @@ public class SmileyCloudEasterEggs{
GlStateManager.pushMatrix();
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.translate(0F, -1.5F, 0F);
GlStateManager.translate(0, 0.2F, leftHand ? -0.5F : 0.55F);
GlStateManager.translate(0.2, -1F, leftHand ? -0.525F : 0.525F);
GlStateManager.scale(0.75F, 0.75F, 0.75F);
AssetUtil.renderItemInWorld(stack);
@ -393,14 +391,11 @@ public class SmileyCloudEasterEggs{
private static void renderHeadBlock(Block block, int meta, float rotation){
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GlStateManager.translate(-0.015F, 0.6F, 0.075F);
GlStateManager.scale(0.3F, 0.3F, 0.3F);
GlStateManager.translate(-0.015F, 0.625F, 0.04F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(180F, 1F, 0F, 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);
GlStateManager.enableLighting();

View file

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