2015-08-29 14:33:25 +02:00
|
|
|
/*
|
|
|
|
* This file ("TileEntitySmileyCloud.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-01-03 16:05:51 +01:00
|
|
|
* http://ellpeck.de/actaddlicense/
|
2015-08-29 14:33:25 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-01-03 16:05:51 +01:00
|
|
|
* © 2016 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.tile;
|
2015-08-23 23:41:46 +02:00
|
|
|
|
2015-08-25 17:59:50 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
|
2015-08-23 23:41:46 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
2015-10-18 15:28:06 +02:00
|
|
|
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
|
2015-08-23 23:41:46 +02:00
|
|
|
|
|
|
|
public String name;
|
2015-08-25 17:59:50 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public double lastFlyHeight;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int flyHeight;
|
2015-10-03 10:16:18 +02:00
|
|
|
private String nameBefore;
|
2015-08-25 17:59:50 +02:00
|
|
|
|
2015-12-01 19:48:09 +01:00
|
|
|
@Override
|
|
|
|
public void updateEntity(){
|
|
|
|
super.updateEntity();
|
|
|
|
if(!worldObj.isRemote){
|
|
|
|
if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){
|
|
|
|
this.nameBefore = this.name;
|
|
|
|
this.markDirty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-23 23:41:46 +02:00
|
|
|
@Override
|
2015-10-18 15:28:06 +02:00
|
|
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
2015-12-21 22:18:33 +01:00
|
|
|
super.writeSyncableNBT(compound, sync);
|
2015-08-23 23:41:46 +02:00
|
|
|
if(this.name != null){
|
|
|
|
compound.setString("Name", this.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-18 15:31:01 +02:00
|
|
|
@Override
|
|
|
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
2015-12-21 22:18:33 +01:00
|
|
|
super.readSyncableNBT(compound, sync);
|
2015-10-18 15:31:01 +02:00
|
|
|
this.name = compound.getString("Name");
|
|
|
|
}
|
|
|
|
|
2015-08-23 23:41:46 +02:00
|
|
|
@Override
|
|
|
|
public void onTextReceived(String text, int textID, EntityPlayer player){
|
|
|
|
this.name = text;
|
|
|
|
}
|
|
|
|
}
|