base mod created

This commit is contained in:
Mohammad-Ali Minaie
2018-10-08 09:07:47 -04:00
parent 0a7700c356
commit b86dedad2f
7848 changed files with 584664 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
package net.minecraft.tileentity;
import net.minecraft.block.BlockBed;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityBed extends TileEntity
{
private EnumDyeColor color = EnumDyeColor.RED;
public void setItemValues(ItemStack p_193051_1_)
{
this.setColor(EnumDyeColor.byMetadata(p_193051_1_.getMetadata()));
}
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
if (compound.hasKey("color"))
{
this.color = EnumDyeColor.byMetadata(compound.getInteger("color"));
}
}
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setInteger("color", this.color.getMetadata());
return compound;
}
public NBTTagCompound getUpdateTag()
{
return this.writeToNBT(new NBTTagCompound());
}
public SPacketUpdateTileEntity getUpdatePacket()
{
return new SPacketUpdateTileEntity(this.pos, 11, this.getUpdateTag());
}
public EnumDyeColor getColor()
{
return this.color;
}
public void setColor(EnumDyeColor color)
{
this.color = color;
this.markDirty();
}
@SideOnly(Side.CLIENT)
public boolean isHeadPiece()
{
return BlockBed.isHeadPiece(this.getBlockMetadata());
}
public ItemStack getItemStack()
{
return new ItemStack(Items.BED, 1, this.color.getMetadata());
}
}