mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Whole block pkg compiling
This commit is contained in:
15 files changed
+68
-68
No files matched your search
@@ -199,8 +199,8 @@ public class TileAlfPortal extends TileMod {
|
||||
}
|
||||
|
||||
private void addItem(ItemStack stack) {
|
||||
int size = stack.stackSize;
|
||||
stack.stackSize = 1;
|
||||
int size = stack.getCount();
|
||||
stack.setCount(1);
|
||||
for(int i = 0; i < size; i++)
|
||||
stacksIn.add(stack.copy());
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class TileAlfPortal extends TileMod {
|
||||
stacksIn.clear();
|
||||
for(int i = 0; i < count; i++) {
|
||||
NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_STACK + i);
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
|
||||
ItemStack stack = new ItemStack(stackcmp);
|
||||
stacksIn.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
|
||||
world.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
} else {
|
||||
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty())
|
||||
item.setDead();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
}
|
||||
@@ -121,18 +121,18 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
|
||||
boolean didChange = false;
|
||||
|
||||
if(stack.getItem() instanceof IFlowerComponent && ((IFlowerComponent) stack.getItem()).canFit(stack, this)) {
|
||||
if(itemHandler.getStackInSlot(getSizeInventory() - 1) != null)
|
||||
if(!itemHandler.getStackInSlot(getSizeInventory() - 1).isEmpty())
|
||||
return false;
|
||||
|
||||
if(!world.isRemote) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty())
|
||||
item.setDead();
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
if(itemHandler.getStackInSlot(i) == null) {
|
||||
if(itemHandler.getStackInSlot(i).isEmpty()) {
|
||||
ItemStack stackToPut = stack.copy();
|
||||
stackToPut.stackSize = 1;
|
||||
stackToPut.setCount(1);
|
||||
itemHandler.setStackInSlot(i, stackToPut);
|
||||
didChange = true;
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_SPLASH, SoundCategory.BLOCKS, 0.1F, 10F);
|
||||
@@ -146,10 +146,10 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
|
||||
|
||||
if(!world.isRemote) {
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
itemHandler.setStackInSlot(i, null);
|
||||
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
|
||||
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty())
|
||||
item.setDead();
|
||||
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
@@ -175,7 +175,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
|
||||
lastRecipe = new ArrayList<>();
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
ItemStack stack = itemHandler.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
break;
|
||||
lastRecipe.add(stack.copy());
|
||||
}
|
||||
@@ -200,13 +200,13 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
|
||||
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack pstack = player.inventory.getStackInSlot(i);
|
||||
if(pstack != null && pstack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(stack, pstack)) {
|
||||
pstack.stackSize--;
|
||||
if(pstack.stackSize == 0)
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
if(!pstack.isEmpty() && pstack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(stack, pstack)) {
|
||||
pstack.shrink(1);
|
||||
if(pstack.isEmpty())
|
||||
player.inventory.setInventorySlotContents(i, ItemStack.EMPTY);
|
||||
|
||||
ItemStack stackToPut = pstack.copy();
|
||||
stackToPut.stackSize = 1;
|
||||
stackToPut.setCount(1);
|
||||
inv.setStackInSlot(index, stackToPut);
|
||||
didAny = true;
|
||||
index++;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TileAnimatedTorch extends TileMod {
|
||||
this.side = side;
|
||||
rotating = true;
|
||||
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType());
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -117,7 +117,7 @@ public class TileAnimatedTorch extends TileMod {
|
||||
|
||||
if(rotationTicks <= 0) {
|
||||
rotating = false;
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType());
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
|
||||
}
|
||||
|
||||
} else rotation = side * 90;
|
||||
|
||||
@@ -54,16 +54,16 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
|
||||
boolean did = false;
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
if(itemHandler.getStackInSlot(i) == null) {
|
||||
if(itemHandler.getStackInSlot(i).isEmpty()) {
|
||||
did = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
stackToAdd.stackSize = 1;
|
||||
stackToAdd.setCount(1);
|
||||
itemHandler.setStackInSlot(i, stackToAdd);
|
||||
|
||||
if(player == null || !player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0 && player != null)
|
||||
player.setHeldItem(hand, null);
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty() && player != null)
|
||||
player.setHeldItem(hand, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -100,9 +100,9 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
|
||||
if(!world.isRemote && recipe == null) {
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1));
|
||||
for(EntityItem item : items)
|
||||
if(!item.isDead && item.getEntityItem() != null) {
|
||||
if(!item.isDead && !item.getEntityItem().isEmpty()) {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(addItem(null, stack, null) && stack.stackSize == 0)
|
||||
if(addItem(null, stack, null) && stack.isEmpty())
|
||||
item.setDead();
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
|
||||
}
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
itemHandler.setStackInSlot(i, null);
|
||||
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
|
||||
|
||||
craftingFanciness();
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
|
||||
|
||||
public int getManaCost() {
|
||||
ItemStack stack = itemHandler.getStackInSlot(0);
|
||||
if(recipe == null || stack == null || !(stack.getItem() instanceof IBrewContainer))
|
||||
if(recipe == null || stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
|
||||
return 0;
|
||||
IBrewContainer container = (IBrewContainer) stack.getItem();
|
||||
return container.getManaCost(recipe.getBrew(), stack);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TileCacophonium extends TileMod {
|
||||
super.readPacketNBT(cmp);
|
||||
|
||||
NBTTagCompound cmp1 = cmp.getCompoundTag(TAG_STACK);
|
||||
stack = ItemStack.loadItemStackFromNBT(cmp1);
|
||||
stack = new ItemStack(cmp1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -346,7 +346,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
|
||||
stage3EndTicks = cmp.getInteger(TAG_STAGE_3_END_TICKS);
|
||||
|
||||
NBTTagCompound itemCmp = cmp.getCompoundTag(TAG_ITEM);
|
||||
itemToEnchant = ItemStack.loadItemStackFromNBT(itemCmp);
|
||||
itemToEnchant = new ItemStack(itemCmp);
|
||||
|
||||
enchants.clear();
|
||||
String enchStr = cmp.getString(TAG_ENCHANTS);
|
||||
@@ -375,7 +375,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
|
||||
|
||||
for(EnchantmentData data : enchants) {
|
||||
Enchantment otherEnch = data.enchantmentobj;
|
||||
if(!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch))
|
||||
if (ench.func_191560_c(otherEnch))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ public class TileHourglass extends TileSimpleInventory {
|
||||
|
||||
public int getTotalTime() {
|
||||
ItemStack stack = itemHandler.getStackInSlot(0);
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return 0;
|
||||
|
||||
return getStackItemTime(stack) * stack.stackSize;
|
||||
return getStackItemTime(stack) * stack.getCount();
|
||||
}
|
||||
|
||||
public static int getStackItemTime(ItemStack stack) {
|
||||
@@ -119,7 +119,7 @@ public class TileHourglass extends TileSimpleInventory {
|
||||
|
||||
public int getColor() {
|
||||
ItemStack stack = itemHandler.getStackInSlot(0);
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return 0;
|
||||
if(stack.getItem() == Item.getItemFromBlock(Blocks.SAND))
|
||||
return stack.getItemDamage() == 1 ? 0xE95800 : 0xFFEC49;
|
||||
|
||||
@@ -63,9 +63,9 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
|
||||
|
||||
if(stack.getItem() == Item.getItemFromBlock(ModBlocks.livingrock) && stack.getItemDamage() == 0) {
|
||||
if(player == null || !player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0 && player != null)
|
||||
player.setHeldItem(hand, null);
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty() && player != null)
|
||||
player.setHeldItem(hand, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
EntityItem item = new EntityItem(world, getPos().getX() + 0.5, getPos().getY() + 1, getPos().getZ() + 0.5, new ItemStack(ModBlocks.livingrock));
|
||||
@@ -86,12 +86,12 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
|
||||
if(itemHandler.getStackInSlot(i) == null) {
|
||||
did = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
stackToAdd.stackSize = 1;
|
||||
stackToAdd.setCount(1);
|
||||
itemHandler.setStackInSlot(i, stackToAdd);
|
||||
|
||||
if(player == null || !player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0 && player != null)
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty() && player != null)
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
|
||||
for(EntityItem item : items)
|
||||
if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() != Item.getItemFromBlock(ModBlocks.livingrock)) {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(addItem(null, stack, null) && stack.stackSize == 0)
|
||||
if(addItem(null, stack, null) && stack.isEmpty())
|
||||
item.setDead();
|
||||
}
|
||||
}
|
||||
@@ -247,8 +247,8 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
|
||||
}
|
||||
|
||||
ItemStack livingrockItem = livingrock.getEntityItem();
|
||||
livingrockItem.stackSize--;
|
||||
if(livingrockItem.stackSize == 0)
|
||||
livingrockItem.shrink(1);
|
||||
if(livingrockItem.isEmpty())
|
||||
livingrock.setDead();
|
||||
}
|
||||
|
||||
|
||||
@@ -149,12 +149,12 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
if(items.size() != 3)
|
||||
return false;
|
||||
|
||||
ItemStack ingot = null;
|
||||
ItemStack pearl = null;
|
||||
ItemStack diamond = null;
|
||||
ItemStack ingot = ItemStack.EMPTY;
|
||||
ItemStack pearl = ItemStack.EMPTY;
|
||||
ItemStack diamond = ItemStack.EMPTY;
|
||||
for(EntityItem item : items) {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(stack.getItem() != ModItems.manaResource || stack.stackSize != 1)
|
||||
if(stack.getItem() != ModItems.manaResource || stack.getCount() != 1)
|
||||
return false;
|
||||
|
||||
int meta = stack.getItemDamage();
|
||||
@@ -167,7 +167,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
else return false;
|
||||
}
|
||||
|
||||
return ingot != null && pearl != null && diamond != null;
|
||||
return !ingot.isEmpty() && !pearl.isEmpty() && !diamond.isEmpty();
|
||||
}
|
||||
|
||||
boolean hasValidPlatform() {
|
||||
|
||||
@@ -33,17 +33,17 @@ public class TileTinyPotato extends TileSimpleInventory {
|
||||
int index = side.getIndex();
|
||||
if(index >= 0) {
|
||||
ItemStack stackAt = getItemHandler().getStackInSlot(index);
|
||||
if(stackAt != null && stack == null) {
|
||||
if(!stackAt.isEmpty() && stack.isEmpty()) {
|
||||
player.setHeldItem(hand, stackAt);
|
||||
getItemHandler().setStackInSlot(index, null);
|
||||
getItemHandler().setStackInSlot(index, ItemStack.EMPTY);
|
||||
} else if(stack != null) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.stackSize = 1;
|
||||
stack.stackSize--;
|
||||
copy.setCount(1);
|
||||
stack.shrink(1);
|
||||
|
||||
if(stack.stackSize == 0)
|
||||
if(stack.isEmpty())
|
||||
player.setHeldItem(hand, stackAt);
|
||||
else if(stackAt != null) {
|
||||
else if(!stackAt.isEmpty()) {
|
||||
if(!player.inventory.addItemStackToInventory(stackAt))
|
||||
player.dropItem(stackAt, false);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class TileTinyPotato extends TileSimpleInventory {
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
ItemStack stackAt = getItemHandler().getStackInSlot(i);
|
||||
if(stackAt != null && stackAt.getItem() == Item.getItemFromBlock(ModBlocks.tinyPotato)) {
|
||||
if(!stackAt.isEmpty() && stackAt.getItem() == Item.getItemFromBlock(ModBlocks.tinyPotato)) {
|
||||
player.sendMessage(new TextComponentString("Don't talk to me or my son ever again."));
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-4
@@ -64,7 +64,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
public void setRequestTarget(ItemStack stack) {
|
||||
if(stack != null) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.stackSize = 1;
|
||||
copy.setCount(1);
|
||||
requestTarget = copy;
|
||||
updateCount();
|
||||
if(!world.isRemote)
|
||||
@@ -102,7 +102,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
if(spark != null && spark.getMaster() != null && requestTarget != null) {
|
||||
List<ItemStack> stacks = CorporeaHelper.requestItem(requestTarget, -1, spark, true, false);
|
||||
for(ItemStack stack : stacks)
|
||||
itemCount += stack.stackSize;
|
||||
itemCount += stack.getCount();
|
||||
}
|
||||
|
||||
if(itemCount != oldCount) {
|
||||
@@ -130,7 +130,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
public void readPacketNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readPacketNBT(par1nbtTagCompound);
|
||||
NBTTagCompound cmp = par1nbtTagCompound.getCompoundTag(TAG_REQUEST_TARGET);
|
||||
requestTarget = ItemStack.loadItemStackFromNBT(cmp);
|
||||
requestTarget = new ItemStack(cmp);
|
||||
itemCount = par1nbtTagCompound.getInteger(TAG_ITEM_COUNT);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
if(requestTarget != null) {
|
||||
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, reqStack);
|
||||
world.spawnEntity(item);
|
||||
itemCount -= reqStack.stackSize;
|
||||
itemCount -= reqStack.getCount();
|
||||
did = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
|
||||
ItemStack stack = filter.get(world.rand.nextInt(filter.size()));
|
||||
|
||||
if(stack != null)
|
||||
doCorporeaRequest(stack, stack.stackSize, spark);
|
||||
doCorporeaRequest(stack, stack.getCount(), spark);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class TileCorporeaFunnel extends TileCorporeaBase implements ICorporeaReq
|
||||
ItemStack stack = frame.getDisplayedItem();
|
||||
if(stack != null) {
|
||||
ItemStack copy = stack.copy();
|
||||
copy.stackSize = rotationToStackSize[frame.getRotation()];
|
||||
copy.setCount(rotationToStackSize[frame.getRotation()]);
|
||||
filter.add(copy);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
|
||||
if(requestMatches(request, stack)) {
|
||||
int missing = count;
|
||||
for(ItemStack stack_ : stacks)
|
||||
missing -= stack_.stackSize;
|
||||
missing -= stack_.getCount();
|
||||
|
||||
if(missing > 0 && !world.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED)) {
|
||||
world.setBlockState(getPos(), world.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class TileCorporeaRetainer extends TileMod {
|
||||
break;
|
||||
case REQUEST_ITEMSTACK:
|
||||
NBTTagCompound cmp1 = cmp.getCompoundTag(TAG_REQUEST_STACK);
|
||||
request = ItemStack.loadItemStackFromNBT(cmp1);
|
||||
request = new ItemStack(cmp1);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
|
||||
if(stack.getItem() instanceof IManaDissolvable) {
|
||||
((IManaDissolvable) stack.getItem()).onDissolveTick(this, stack, item);
|
||||
if(stack.stackSize == 0)
|
||||
if(stack.isEmpty())
|
||||
item.setDead();
|
||||
}
|
||||
|
||||
@@ -187,8 +187,8 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
if(getCurrentMana() >= mana) {
|
||||
recieveMana(-mana);
|
||||
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
stack.shrink(1);
|
||||
if(stack.isEmpty())
|
||||
item.setDead();
|
||||
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
|
||||
Reference in new issue
Block a user