use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class RitualHolder method readNBT.
@SuppressWarnings("unchecked")
public void readNBT(NBTTagCompound cmp) {
NBTTagCompound tag = cmp.getCompoundTag("ritual_data");
ritual = KettleRegistry.getRituals().get(tag.getInteger("ritual"));
energy_left = tag.getInteger("energy_left");
ticks = tag.getInteger("ticks");
fail = tag.getBoolean("fail");
}
use of net.minecraft.nbt.NBTTagCompound in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EntityFallingUpBlock method onUpdate.
@Override
public void onUpdate() {
Block block = this.fallTile.getBlock();
if (this.fallTile.getMaterial() == Material.AIR) {
this.setDead();
} else {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.fallTime++ == 0) {
BlockPos blockpos = new BlockPos(this);
if (this.worldObj.getBlockState(blockpos).getBlock() == block) {
this.worldObj.setBlockToAir(blockpos);
} else if (!this.worldObj.isRemote) {
this.setDead();
return;
}
}
if (!this.hasNoGravity()) {
this.motionY += 0.03999999910593033D;
}
CallRunner.onEntityMove(this, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (!this.worldObj.isRemote) {
BlockPos blockpos1 = new BlockPos(this);
if (!onGround && isCollidedVertically) {
IBlockState iblockstate = this.worldObj.getBlockState(blockpos1);
if (// Forge: Don't indent below.
this.worldObj.isAirBlock(new BlockPos(this.posX, this.posY + 1.009999999776482582D, this.posZ)))
if (BlockFalling.canFallThrough(this.worldObj.getBlockState(new BlockPos(this.posX, this.posY + 1.009999999776482582D, this.posZ)))) {
this.isCollidedVertically = false;
return;
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
if (iblockstate.getBlock() != Blocks.PISTON_EXTENSION) {
this.setDead();
if (!this.canSetAsBlock) {
if (this.worldObj.canBlockBePlaced(block, blockpos1, true, EnumFacing.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFallThrough(this.worldObj.getBlockState(blockpos1.up())) && worldObj.setBlockState(blockpos1, this.fallTile, 3)) {
if (block instanceof BlockFalling) {
((BlockFalling) block).onEndFalling(this.worldObj, blockpos1);
}
if (this.tileEntityData != null && block instanceof ITileEntityProvider) {
TileEntity tileentity = this.worldObj.getTileEntity(blockpos1);
if (tileentity != null) {
NBTTagCompound nbttagcompound = tileentity.writeToNBT(new NBTTagCompound());
for (String s : this.tileEntityData.getKeySet()) {
NBTBase nbtbase = this.tileEntityData.getTag(s);
if (!"x".equals(s) && !"y".equals(s) && !"z".equals(s)) {
nbttagcompound.setTag(s, nbtbase.copy());
}
}
tileentity.readFromNBT(nbttagcompound);
tileentity.markDirty();
}
}
} else if (this.shouldDropItem && this.worldObj.getGameRules().getBoolean("doEntityDrops")) {
this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F);
}
}
}
} else if (this.fallTime > 100 && !this.worldObj.isRemote && (blockpos1.getY() < 1 || blockpos1.getY() > 256) || this.fallTime > 600) {
if (this.shouldDropItem && this.worldObj.getGameRules().getBoolean("doEntityDrops")) {
this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F);
}
this.setDead();
}
}
}
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class TileKettle method potionCustomLogic.
public void potionCustomLogic(EntityPlayer player, EnumHand hand, ItemStack stack) {
ItemStack brew = new ItemStack(ModItems.BREW_PHIAL_DRINK);
NBTTagCompound tag = getBrewData();
if (tag != null) {
brew.setTagCompound(tag);
brew.setCount(1 + getBrewMultiplier(player));
giveItem(player, hand, stack, brew);
inv.setFluid(null);
onLiquidChange();
}
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class TileKettle method saveItems.
private void saveItems(NBTTagCompound cmp) {
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < ingredients.length; ++i) {
if (!ingredients[i].isEmpty()) {
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("slot", (byte) i);
ingredients[i].writeToNBT(tag);
nbttaglist.appendTag(tag);
}
}
cmp.setTag(TAG_INGREDIENTS, nbttaglist);
if (!container.isEmpty()) {
NBTTagCompound tag = new NBTTagCompound();
container.writeToNBT(tag);
cmp.setTag(TAG_CONTAINER, tag);
}
}
use of net.minecraft.nbt.NBTTagCompound in project Witchworks by Um-Mitternacht.
the class TileMod method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound par1nbtTagCompound) {
final NBTTagCompound ret = super.writeToNBT(par1nbtTagCompound);
writeDataNBT(ret);
return ret;
}
Aggregations