mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 18:09:44 +00:00
Updated Banners
This commit is contained in:
1 parent
2f5d5f84c2
commit
4d2ced4528
25 files changed
+314
-85
No files matched your search
@@ -3,29 +3,39 @@ package noppes.npcs.blocks.tiles;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import noppes.npcs.constants.EnumBannerVariant;
|
||||
|
||||
public class TileBanner extends TileColorable {
|
||||
|
||||
|
||||
public ItemStack icon;
|
||||
public EnumBannerVariant variant = EnumBannerVariant.Normal;
|
||||
public long time = 0;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
icon = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("BannerIcon"));
|
||||
|
||||
int variantIndex = compound.getInteger("BannerVariant");
|
||||
if (variantIndex >= 0 && variantIndex < EnumBannerVariant.values().length) {
|
||||
variant = EnumBannerVariant.values()[variantIndex];
|
||||
} else {
|
||||
variant = EnumBannerVariant.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
if(icon != null)
|
||||
compound.setTag("BannerIcon", icon.writeToNBT(new NBTTagCompound()));
|
||||
compound.setInteger("BannerVariant", variant.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox(){
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1);
|
||||
}
|
||||
|
||||
|
||||
public boolean canEdit(){
|
||||
return System.currentTimeMillis() - time < 10000;
|
||||
return System.currentTimeMillis() - time < 20000;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user