mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-29 18:28:34 +01:00
Added Smiley Clouds. They're funny, they're derpy, they're unfinished, but they're awesome!
This commit is contained in:
parent
c088e2df35
commit
b25cbb7c85
19 changed files with 851 additions and 4 deletions
|
@ -0,0 +1,150 @@
|
||||||
|
package ellpeck.actuallyadditions.blocks;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg;
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs;
|
||||||
|
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud;
|
||||||
|
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||||
|
import ellpeck.actuallyadditions.util.INameableItem;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class BlockSmileyCloud extends BlockContainerBase implements INameableItem{
|
||||||
|
|
||||||
|
public BlockSmileyCloud(){
|
||||||
|
super(Material.cloth);
|
||||||
|
this.setHardness(0.5F);
|
||||||
|
this.setResistance(5.0F);
|
||||||
|
this.setStepSound(soundTypeWood);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
if(tile instanceof TileEntitySmileyCloud){
|
||||||
|
TileEntitySmileyCloud cloud = (TileEntitySmileyCloud)tile;
|
||||||
|
|
||||||
|
if(player.isSneaking()){
|
||||||
|
if(!world.isRemote){
|
||||||
|
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, x, y, z);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(ISmileyCloudEasterEgg egg : SmileyCloudEasterEggs.cloudStuff){
|
||||||
|
if(Objects.equals(egg.getTriggerName(), cloud.name)){
|
||||||
|
if(egg.hasSpecialRightClick()){
|
||||||
|
egg.specialRightClick(world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getIcon(int side, int metadata){
|
||||||
|
return this.blockIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||||
|
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||||
|
|
||||||
|
if (rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
|
if (rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||||
|
if (rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
|
if (rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerBlockIcons(IIconRegister iconReg){
|
||||||
|
this.blockIcon = Blocks.wool.getIcon(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalBlock(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderType(){
|
||||||
|
return RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int meta){
|
||||||
|
return new TileEntitySmileyCloud();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||||
|
this.dropInventory(world, x, y, z);
|
||||||
|
super.breakBlock(world, x, y, z, block, par6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "blockSmileyCloud";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TheItemBlock extends ItemBlock{
|
||||||
|
|
||||||
|
private Block theBlock;
|
||||||
|
|
||||||
|
public TheItemBlock(Block block){
|
||||||
|
super(block);
|
||||||
|
this.theBlock = block;
|
||||||
|
this.setHasSubtypes(false);
|
||||||
|
this.setMaxDamage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.uncommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName(ItemStack stack){
|
||||||
|
return this.getUnlocalizedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||||
|
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -82,9 +82,14 @@ public class InitBlocks{
|
||||||
public static Block blockXPSolidifier;
|
public static Block blockXPSolidifier;
|
||||||
public static Block blockOreMagnet;
|
public static Block blockOreMagnet;
|
||||||
|
|
||||||
|
public static Block blockSmileyCloud;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Blocks...");
|
ModUtil.LOGGER.info("Initializing Blocks...");
|
||||||
|
|
||||||
|
blockSmileyCloud = new BlockSmileyCloud();
|
||||||
|
BlockUtil.register(blockSmileyCloud, BlockSmileyCloud.TheItemBlock.class);
|
||||||
|
|
||||||
blockOreMagnet = new BlockOreMagnet();
|
blockOreMagnet = new BlockOreMagnet();
|
||||||
BlockUtil.register(blockOreMagnet, BlockOreMagnet.TheItemBlock.class);
|
BlockUtil.register(blockOreMagnet, BlockOreMagnet.TheItemBlock.class);
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,11 @@ public class ModelPhantomBooster extends ModelBaseAA{
|
||||||
return "modelPhantomBooster";
|
return "modelPhantomBooster";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesRotate(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||||
model.rotateAngleX = x;
|
model.rotateAngleX = x;
|
||||||
model.rotateAngleY = y;
|
model.rotateAngleY = y;
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
package ellpeck.actuallyadditions.blocks.render;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg;
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
|
||||||
|
public class ModelSmileyCloud extends ModelBaseAA{
|
||||||
|
|
||||||
|
ModelRenderer s1;
|
||||||
|
ModelRenderer s2;
|
||||||
|
ModelRenderer s3;
|
||||||
|
ModelRenderer s4;
|
||||||
|
ModelRenderer s5;
|
||||||
|
ModelRenderer s6;
|
||||||
|
ModelRenderer s7;
|
||||||
|
ModelRenderer s8;
|
||||||
|
ModelRenderer s9;
|
||||||
|
ModelRenderer s10;
|
||||||
|
ModelRenderer s11;
|
||||||
|
ModelRenderer s12;
|
||||||
|
ModelRenderer s13;
|
||||||
|
ModelRenderer s14;
|
||||||
|
ModelRenderer s15;
|
||||||
|
ModelRenderer s16;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesRotate(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelSmileyCloud(){
|
||||||
|
textureWidth = 64;
|
||||||
|
textureHeight = 64;
|
||||||
|
|
||||||
|
s1 = new ModelRenderer(this, 0, 0);
|
||||||
|
s1.addBox(0F, 0F, 0F, 12, 10, 10);
|
||||||
|
s1.setRotationPoint(-6F, 14F, -4F);
|
||||||
|
s1.setTextureSize(64, 64);
|
||||||
|
s1.mirror = true;
|
||||||
|
setRotation(s1, 0F, 0F, 0F);
|
||||||
|
s2 = new ModelRenderer(this, 45, 0);
|
||||||
|
s2.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||||
|
s2.setRotationPoint(-7F, 15F, -3F);
|
||||||
|
s2.setTextureSize(64, 64);
|
||||||
|
s2.mirror = true;
|
||||||
|
setRotation(s2, 0F, 0F, 0F);
|
||||||
|
s3 = new ModelRenderer(this, 45, 0);
|
||||||
|
s3.addBox(0F, 0F, 0F, 1, 8, 8);
|
||||||
|
s3.setRotationPoint(6F, 15F, -3F);
|
||||||
|
s3.setTextureSize(64, 64);
|
||||||
|
s3.mirror = true;
|
||||||
|
setRotation(s3, 0F, 0F, 0F);
|
||||||
|
s4 = new ModelRenderer(this, 0, 21);
|
||||||
|
s4.addBox(0F, 0F, 0F, 10, 8, 1);
|
||||||
|
s4.setRotationPoint(-5F, 15F, 6F);
|
||||||
|
s4.setTextureSize(64, 64);
|
||||||
|
s4.mirror = true;
|
||||||
|
setRotation(s4, 0F, 0F, 0F);
|
||||||
|
s5 = new ModelRenderer(this, 23, 27);
|
||||||
|
s5.addBox(0F, 0F, 0F, 10, 1, 8);
|
||||||
|
s5.setRotationPoint(-5F, 13F, -3F);
|
||||||
|
s5.setTextureSize(64, 64);
|
||||||
|
s5.mirror = true;
|
||||||
|
setRotation(s5, 0F, 0F, 0F);
|
||||||
|
s6 = new ModelRenderer(this, 23, 21);
|
||||||
|
s6.addBox(0F, 0F, 0F, 6, 1, 4);
|
||||||
|
s6.setRotationPoint(-3F, 12F, -1F);
|
||||||
|
s6.setTextureSize(64, 64);
|
||||||
|
s6.mirror = true;
|
||||||
|
setRotation(s6, 0F, 0F, 0F);
|
||||||
|
s7 = new ModelRenderer(this, 45, 16);
|
||||||
|
s7.addBox(0F, 0F, 0F, 6, 6, 1);
|
||||||
|
s7.setRotationPoint(-3F, 16F, 7F);
|
||||||
|
s7.setTextureSize(64, 64);
|
||||||
|
s7.mirror = true;
|
||||||
|
setRotation(s7, 0F, 0F, 0F);
|
||||||
|
s8 = new ModelRenderer(this, 0, 31);
|
||||||
|
s8.addBox(0F, 0F, 0F, 1, 6, 6);
|
||||||
|
s8.setRotationPoint(-8F, 16F, -2F);
|
||||||
|
s8.setTextureSize(64, 64);
|
||||||
|
s8.mirror = true;
|
||||||
|
setRotation(s8, 0F, 0F, 0F);
|
||||||
|
s9 = new ModelRenderer(this, 0, 31);
|
||||||
|
s9.addBox(0F, 0F, 0F, 1, 6, 6);
|
||||||
|
s9.setRotationPoint(7F, 16F, -2F);
|
||||||
|
s9.setTextureSize(64, 64);
|
||||||
|
s9.mirror = true;
|
||||||
|
setRotation(s9, 0F, 0F, 0F);
|
||||||
|
s10 = new ModelRenderer(this, 15, 37);
|
||||||
|
s10.addBox(0F, 0F, 0F, 6, 1, 1);
|
||||||
|
s10.setRotationPoint(-3F, 20F, -5F);
|
||||||
|
s10.setTextureSize(64, 64);
|
||||||
|
s10.mirror = true;
|
||||||
|
setRotation(s10, 0F, 0F, 0F);
|
||||||
|
s11 = new ModelRenderer(this, 15, 31);
|
||||||
|
s11.addBox(0F, 1F, 0F, 1, 1, 1);
|
||||||
|
s11.setRotationPoint(-4F, 18F, -5F);
|
||||||
|
s11.setTextureSize(64, 64);
|
||||||
|
s11.mirror = true;
|
||||||
|
setRotation(s11, 0F, 0F, 0F);
|
||||||
|
s12 = new ModelRenderer(this, 15, 31);
|
||||||
|
s12.addBox(0F, 1F, 0F, 1, 1, 1);
|
||||||
|
s12.setRotationPoint(3F, 18F, -5F);
|
||||||
|
s12.setTextureSize(64, 64);
|
||||||
|
s12.mirror = true;
|
||||||
|
setRotation(s12, 0F, 0F, 0F);
|
||||||
|
s13 = new ModelRenderer(this, 15, 40);
|
||||||
|
s13.addBox(0F, 0F, 0F, 2, 2, 1);
|
||||||
|
s13.setRotationPoint(-3F, 15F, -4.5F);
|
||||||
|
s13.setTextureSize(64, 64);
|
||||||
|
s13.mirror = true;
|
||||||
|
setRotation(s13, 0F, 0F, 0F);
|
||||||
|
s14 = new ModelRenderer(this, 15, 40);
|
||||||
|
s14.addBox(0F, 0F, 0F, 2, 2, 1);
|
||||||
|
s14.setRotationPoint(1F, 15F, -4.5F);
|
||||||
|
s14.setTextureSize(64, 64);
|
||||||
|
s14.mirror = true;
|
||||||
|
setRotation(s14, 0F, 0F, 0F);
|
||||||
|
s15 = new ModelRenderer(this, 30, 37);
|
||||||
|
s15.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||||
|
s15.setRotationPoint(-2.5F, 15.5F, -4.7F);
|
||||||
|
s15.setTextureSize(64, 64);
|
||||||
|
s15.mirror = true;
|
||||||
|
setRotation(s15, 0F, 0F, 0F);
|
||||||
|
s16 = new ModelRenderer(this, 30, 37);
|
||||||
|
s16.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||||
|
s16.setRotationPoint(1.5F, 15.5F, -4.7F);
|
||||||
|
s16.setTextureSize(64, 64);
|
||||||
|
s16.mirror = true;
|
||||||
|
setRotation(s16, 0F, 0F, 0F);
|
||||||
|
|
||||||
|
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
|
||||||
|
cloud.registerExtraRendering(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float f){
|
||||||
|
s1.render(f);
|
||||||
|
s2.render(f);
|
||||||
|
s3.render(f);
|
||||||
|
s4.render(f);
|
||||||
|
s5.render(f);
|
||||||
|
s6.render(f);
|
||||||
|
s7.render(f);
|
||||||
|
s8.render(f);
|
||||||
|
s9.render(f);
|
||||||
|
s10.render(f);
|
||||||
|
s11.render(f);
|
||||||
|
s12.render(f);
|
||||||
|
s13.render(f);
|
||||||
|
s14.render(f);
|
||||||
|
s15.render(f);
|
||||||
|
s16.render(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||||
|
model.rotateAngleX = x;
|
||||||
|
model.rotateAngleY = y;
|
||||||
|
model.rotateAngleZ = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "modelSmileyCloud";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package ellpeck.actuallyadditions.blocks.render;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg;
|
||||||
|
import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class RenderSmileyCloud extends RenderTileEntity{
|
||||||
|
|
||||||
|
public RenderSmileyCloud(ModelBaseAA model){
|
||||||
|
super(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||||
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||||
|
|
||||||
|
if(theModel.doesRotate()){
|
||||||
|
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||||
|
if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||||
|
if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||||
|
if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bindTexture(resLoc);
|
||||||
|
|
||||||
|
if(tile instanceof TileEntitySmileyCloud){
|
||||||
|
boolean hasRendered = false;
|
||||||
|
|
||||||
|
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
|
||||||
|
if(theCloud.name != null && !theCloud.name.isEmpty()){
|
||||||
|
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
|
||||||
|
if(Objects.equals(cloud.getTriggerName(), theCloud.name)){
|
||||||
|
|
||||||
|
if(cloud.shouldRenderOriginal()){
|
||||||
|
theModel.render(0.0625F);
|
||||||
|
}
|
||||||
|
|
||||||
|
//this.bindTexture(cloud.getResLoc());
|
||||||
|
cloud.renderExtra(0.0625F);
|
||||||
|
|
||||||
|
hasRendered = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!hasRendered) theModel.render(0.0625F);
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,17 +9,17 @@ import org.lwjgl.opengl.GL11;
|
||||||
public class RenderTileEntity extends TileEntitySpecialRenderer{
|
public class RenderTileEntity extends TileEntitySpecialRenderer{
|
||||||
|
|
||||||
public ModelBaseAA theModel;
|
public ModelBaseAA theModel;
|
||||||
private ResourceLocation resLoc;
|
protected ResourceLocation resLoc;
|
||||||
|
|
||||||
public RenderTileEntity(ModelBaseAA model){
|
public RenderTileEntity(ModelBaseAA model){
|
||||||
this.theModel = model;
|
this.theModel = model;
|
||||||
this.resLoc = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png");
|
this.resLoc = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/"+this.theModel.getName()+".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float)x + 0.5F, (float)y - 0.5F, (float)z + 0.5F);
|
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||||
this.bindTexture(resLoc);
|
this.bindTexture(resLoc);
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package ellpeck.actuallyadditions.gadget.cloud;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface ISmileyCloudEasterEgg{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra rendering function
|
||||||
|
*/
|
||||||
|
void renderExtra(float f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers extra rendering
|
||||||
|
*/
|
||||||
|
void registerExtraRendering(ModelBaseAA model);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the Original cloud should be rendered
|
||||||
|
*/
|
||||||
|
boolean shouldRenderOriginal();
|
||||||
|
|
||||||
|
boolean hasSpecialRightClick();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If something special happens on right-click of the cloud
|
||||||
|
*/
|
||||||
|
void specialRightClick(World world, int x, int y, int z, Block block, int meta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Something in addition to the default name in the name tag
|
||||||
|
*/
|
||||||
|
String displayNameExtra();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the original name should be rendered
|
||||||
|
*/
|
||||||
|
boolean shouldRenderOriginalName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name the cloud has to have for this effect to occur
|
||||||
|
*/
|
||||||
|
String getTriggerName();
|
||||||
|
|
||||||
|
ResourceLocation getResLoc();
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package ellpeck.actuallyadditions.gadget.cloud;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public abstract class SmileyCloudEasterEgg implements ISmileyCloudEasterEgg{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderExtra(float f){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getResLoc(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRenderOriginal(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasSpecialRightClick(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void specialRightClick(World world, int x, int y, int z, Block block, int meta){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerExtraRendering(ModelBaseAA model){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String displayNameExtra(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRenderOriginalName(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package ellpeck.actuallyadditions.gadget.cloud;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class SmileyCloudEasterEggs{
|
||||||
|
|
||||||
|
public static final ArrayList<ISmileyCloudEasterEgg> cloudStuff = new ArrayList<ISmileyCloudEasterEgg>();
|
||||||
|
|
||||||
|
static{
|
||||||
|
//Glenthor
|
||||||
|
register(new SmileyCloudEasterEgg(){
|
||||||
|
|
||||||
|
public ModelRenderer s9;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTriggerName(){
|
||||||
|
return "Glenthor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderExtra(float f){
|
||||||
|
s9.render(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRenderOriginal(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerExtraRendering(ModelBaseAA model){
|
||||||
|
s9 = new ModelRenderer(model, 0, 31);
|
||||||
|
s9.addBox(0F, 0F, 0F, 1, 6, 6);
|
||||||
|
s9.setRotationPoint(7F, 16F, -2F);
|
||||||
|
s9.setTextureSize(64, 64);
|
||||||
|
s9.mirror = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void register(ISmileyCloudEasterEgg egg){
|
||||||
|
cloudStuff.add(egg);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package ellpeck.actuallyadditions.inventory;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ContainerSmileyCloud extends Container{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer player){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -64,6 +64,8 @@ public class GuiHandler implements IGuiHandler{
|
||||||
return new ContainerXPSolidifier(entityPlayer.inventory, tile);
|
return new ContainerXPSolidifier(entityPlayer.inventory, tile);
|
||||||
case ORE_MAGNET:
|
case ORE_MAGNET:
|
||||||
return new ContainerOreMagnet(entityPlayer.inventory, tile);
|
return new ContainerOreMagnet(entityPlayer.inventory, tile);
|
||||||
|
case CLOUD:
|
||||||
|
return new ContainerSmileyCloud();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -122,6 +124,8 @@ public class GuiHandler implements IGuiHandler{
|
||||||
return new GuiXPSolidifier(entityPlayer.inventory, tile, x, y, z, world);
|
return new GuiXPSolidifier(entityPlayer.inventory, tile, x, y, z, world);
|
||||||
case ORE_MAGNET:
|
case ORE_MAGNET:
|
||||||
return new GuiOreMagnet(entityPlayer.inventory, tile);
|
return new GuiOreMagnet(entityPlayer.inventory, tile);
|
||||||
|
case CLOUD:
|
||||||
|
return new GuiSmileyCloud(tile, x, y, z, world);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +154,8 @@ public class GuiHandler implements IGuiHandler{
|
||||||
ENERGIZER,
|
ENERGIZER,
|
||||||
ENERVATOR,
|
ENERVATOR,
|
||||||
XP_SOLIDIFIER,
|
XP_SOLIDIFIER,
|
||||||
ORE_MAGNET
|
ORE_MAGNET,
|
||||||
|
CLOUD
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
package ellpeck.actuallyadditions.inventory.gui;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ellpeck.actuallyadditions.inventory.ContainerSmileyCloud;
|
||||||
|
import ellpeck.actuallyadditions.network.PacketHandler;
|
||||||
|
import ellpeck.actuallyadditions.network.gui.PacketGuiString;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||||
|
import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud;
|
||||||
|
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||||
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class GuiSmileyCloud extends GuiContainer{
|
||||||
|
|
||||||
|
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiSmileyCloud");
|
||||||
|
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
private int z;
|
||||||
|
private World world;
|
||||||
|
|
||||||
|
private GuiTextField nameField;
|
||||||
|
|
||||||
|
private TileEntitySmileyCloud cloud;
|
||||||
|
|
||||||
|
public GuiSmileyCloud(TileEntityBase tile, int x, int y, int z, World world){
|
||||||
|
super(new ContainerSmileyCloud());
|
||||||
|
this.cloud = (TileEntitySmileyCloud)tile;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.world = world;
|
||||||
|
this.xSize = 124;
|
||||||
|
this.ySize = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||||
|
String name = cloud.name == null || cloud.name.isEmpty() ? "" : StringUtil.ORANGE+cloud.name+StringUtil.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" ";
|
||||||
|
String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID_LOWER+".cloud.name");
|
||||||
|
this.fontRendererObj.drawString(localizedName, xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen(){
|
||||||
|
super.updateScreen();
|
||||||
|
this.nameField.updateCursorCounter();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void initGui(){
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
this.nameField = new GuiTextField(this.fontRendererObj, guiLeft+5, guiTop+6, 114, 8);
|
||||||
|
this.nameField.setMaxStringLength(20);
|
||||||
|
this.nameField.setEnableBackgroundDrawing(false);
|
||||||
|
this.nameField.setFocused(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int par1, int par2, int par3){
|
||||||
|
this.nameField.mouseClicked(par1, par2, par3);
|
||||||
|
super.mouseClicked(par1, par2, par3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyTyped(char theChar, int key){
|
||||||
|
if(key != 1 && this.nameField.isFocused()){
|
||||||
|
if(key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER){
|
||||||
|
this.setVariable(this.nameField);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.nameField.textboxKeyTyped(theChar, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else super.keyTyped(theChar, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariable(GuiTextField field){
|
||||||
|
this.sendPacket(field.getText(), 0);
|
||||||
|
field.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendPacket(String text, int textID){
|
||||||
|
PacketHandler.theNetwork.sendToServer(new PacketGuiString(x, y, z, world, text, textID, Minecraft.getMinecraft().thePlayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
this.mc.getTextureManager().bindTexture(resLoc);
|
||||||
|
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
|
this.nameField.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void drawScreen(int x, int y, float f){
|
||||||
|
super.drawScreen(x, y, f);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
|
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
|
||||||
import ellpeck.actuallyadditions.network.gui.PacketGuiNumber;
|
import ellpeck.actuallyadditions.network.gui.PacketGuiNumber;
|
||||||
|
import ellpeck.actuallyadditions.network.gui.PacketGuiString;
|
||||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
|
||||||
|
@ -18,5 +19,6 @@ public class PacketHandler{
|
||||||
theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 0, Side.SERVER);
|
theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 0, Side.SERVER);
|
||||||
theNetwork.registerMessage(PacketSyncerToClient.Handler.class, PacketSyncerToClient.class, 1, Side.CLIENT);
|
theNetwork.registerMessage(PacketSyncerToClient.Handler.class, PacketSyncerToClient.class, 1, Side.CLIENT);
|
||||||
theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 2, Side.SERVER);
|
theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 2, Side.SERVER);
|
||||||
|
theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 3, Side.SERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package ellpeck.actuallyadditions.network.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
public interface IStringReactor{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a text gets received after typing it in in the GUI
|
||||||
|
* @param text The text that was sent
|
||||||
|
* @param textID The ID (meaning the place in the GUI) of the text typed in
|
||||||
|
* @param player The Player doing it
|
||||||
|
*/
|
||||||
|
void onTextReceived(String text, int textID, EntityPlayer player);
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package ellpeck.actuallyadditions.network.gui;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
|
public class PacketGuiString implements IMessage{
|
||||||
|
|
||||||
|
private int tileX;
|
||||||
|
private int tileY;
|
||||||
|
private int tileZ;
|
||||||
|
private int worldID;
|
||||||
|
private String text;
|
||||||
|
private int textID;
|
||||||
|
private int playerID;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public PacketGuiString(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PacketGuiString(int x, int y, int z, World world, String text, int textID, EntityPlayer player){
|
||||||
|
this.tileX = x;
|
||||||
|
this.tileY = y;
|
||||||
|
this.tileZ = z;
|
||||||
|
this.worldID = world.provider.dimensionId;
|
||||||
|
this.text = text;
|
||||||
|
this.textID = textID;
|
||||||
|
this.playerID = player.getEntityId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf){
|
||||||
|
this.tileX = buf.readInt();
|
||||||
|
this.tileY = buf.readInt();
|
||||||
|
this.tileZ = buf.readInt();
|
||||||
|
this.worldID = buf.readInt();
|
||||||
|
|
||||||
|
this.text = "";
|
||||||
|
int textLength = buf.readInt();
|
||||||
|
for(int i = 0; i < textLength; i++){
|
||||||
|
this.text += buf.readChar();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.textID = buf.readInt();
|
||||||
|
this.playerID = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf){
|
||||||
|
buf.writeInt(this.tileX);
|
||||||
|
buf.writeInt(this.tileY);
|
||||||
|
buf.writeInt(this.tileZ);
|
||||||
|
buf.writeInt(this.worldID);
|
||||||
|
|
||||||
|
buf.writeInt(this.text.length());
|
||||||
|
for(int i = 0; i < this.text.length(); i++){
|
||||||
|
buf.writeChar(this.text.charAt(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.writeInt(this.textID);
|
||||||
|
buf.writeInt(this.playerID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Handler implements IMessageHandler<PacketGuiString, IMessage>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(PacketGuiString message, MessageContext ctx){
|
||||||
|
World world = DimensionManager.getWorld(message.worldID);
|
||||||
|
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
|
||||||
|
|
||||||
|
if(tile instanceof IStringReactor){
|
||||||
|
IStringReactor reactor = (IStringReactor)tile;
|
||||||
|
reactor.onTextReceived(message.text, message.textID, (EntityPlayer)world.getEntityByID(message.playerID));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,9 @@ public class ClientProxy implements IProxy{
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPhantomBooster.class, new RenderTileEntity(new ModelPhantomBooster()));
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPhantomBooster.class, new RenderTileEntity(new ModelPhantomBooster()));
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockPhantomBooster), new RenderItems(new ModelPhantomBooster()));
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockPhantomBooster), new RenderItems(new ModelPhantomBooster()));
|
||||||
|
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud()));
|
||||||
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockSmileyCloud), new RenderItems(new ModelSmileyCloud()));
|
||||||
|
|
||||||
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
|
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
|
||||||
|
|
||||||
Util.registerEvent(new RenderPlayerEventAA());
|
Util.registerEvent(new RenderPlayerEventAA());
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class TileEntityBase extends TileEntity{
|
||||||
GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator");
|
GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator");
|
||||||
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier");
|
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID_LOWER+":tileEntityXPSolidifier");
|
||||||
GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet");
|
GameRegistry.registerTileEntity(TileEntityOreMagnet.class, ModUtil.MOD_ID_LOWER+":tileEntityOreMagnet");
|
||||||
|
GameRegistry.registerTileEntity(TileEntitySmileyCloud.class, ModUtil.MOD_ID_LOWER+":tileEntityCloud");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package ellpeck.actuallyadditions.tile;
|
||||||
|
|
||||||
|
import ellpeck.actuallyadditions.network.gui.IStringReactor;
|
||||||
|
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||||
|
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSyncerToClient, IStringReactor{
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
private String nameBefore;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity(){
|
||||||
|
if(!worldObj.isRemote){
|
||||||
|
if(!Objects.equals(this.name, this.nameBefore)){
|
||||||
|
this.nameBefore = this.name;
|
||||||
|
this.sendUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
if(this.name != null){
|
||||||
|
compound.setString("Name", this.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
|
super.readFromNBT(compound);
|
||||||
|
this.name = compound.getString("Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getValues(){
|
||||||
|
if(this.name != null && !this.name.isEmpty()){
|
||||||
|
int[] chars = new int[this.name.length()];
|
||||||
|
for(int i = 0; i < this.name.length(); i++){
|
||||||
|
char atPlace = this.name.charAt(i);
|
||||||
|
chars[i] = (int)atPlace;
|
||||||
|
}
|
||||||
|
return chars;
|
||||||
|
}
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValues(int[] values){
|
||||||
|
if(values != null && values.length > 0){
|
||||||
|
String newName = "";
|
||||||
|
for(int value : values){
|
||||||
|
newName += (char)value;
|
||||||
|
}
|
||||||
|
this.name = newName;
|
||||||
|
}
|
||||||
|
else this.name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendUpdate(){
|
||||||
|
PacketSyncerToClient.sendPacket(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextReceived(String text, int textID, EntityPlayer player){
|
||||||
|
this.name = text;
|
||||||
|
}
|
||||||
|
}
|
|
@ -603,6 +603,7 @@ info.actuallyadditions.gui.whitelist=Whitelist
|
||||||
info.actuallyadditions.gui.blacklist=Blacklist
|
info.actuallyadditions.gui.blacklist=Blacklist
|
||||||
info.actuallyadditions.gui.coffee=Coffee
|
info.actuallyadditions.gui.coffee=Coffee
|
||||||
info.actuallyadditions.gui.ok=Ok
|
info.actuallyadditions.gui.ok=Ok
|
||||||
|
info.actuallyadditions.gui.the=the
|
||||||
|
|
||||||
tooltip.actuallyadditions.uses.desc=Uses
|
tooltip.actuallyadditions.uses.desc=Uses
|
||||||
tooltip.actuallyadditions.produces.desc=Produces
|
tooltip.actuallyadditions.produces.desc=Produces
|
||||||
|
@ -636,6 +637,7 @@ container.actuallyadditions.energizer.name=Energizer
|
||||||
container.actuallyadditions.enervator.name=Enervator
|
container.actuallyadditions.enervator.name=Enervator
|
||||||
container.actuallyadditions.xpSolidifier.name=Experience Solidifier
|
container.actuallyadditions.xpSolidifier.name=Experience Solidifier
|
||||||
container.actuallyadditions.oreMagnet.name=Magnetic Miner
|
container.actuallyadditions.oreMagnet.name=Magnetic Miner
|
||||||
|
container.actuallyadditions.cloud.name=Smiley Cloud
|
||||||
|
|
||||||
container.nei.actuallyadditions.crushing.name=Crusher
|
container.nei.actuallyadditions.crushing.name=Crusher
|
||||||
container.nei.actuallyadditions.crushingDouble.name=Double Crusher
|
container.nei.actuallyadditions.crushingDouble.name=Double Crusher
|
||||||
|
|
Loading…
Reference in a new issue