mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Fix name clash in TileSimpleInventory
This commit is contained in:
1 parent
e372f903cd
commit
24937e64ce
12 files changed
+32
-31
No files matched your search
@@ -58,7 +58,7 @@ public class ModelBrewery extends Model {
|
||||
public void render(@Nullable TileBrewery brewery, double time, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
|
||||
float offset = (float) Math.sin(time / 40) * 0.1F + 0.05F;
|
||||
boolean hasTile = brewery != null;
|
||||
int plates = hasTile ? brewery.getSizeInventory() - 1 : 7;
|
||||
int plates = hasTile ? brewery.inventorySize() - 1 : 7;
|
||||
float deg = (float) time / 16F;
|
||||
float polerot = -deg * 25F;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class RenderTileAltar extends TileEntityRenderer<TileAltar> {
|
||||
|
||||
if (water) {
|
||||
int petals = 0;
|
||||
for (int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < altar.inventorySize(); i++) {
|
||||
if (!altar.getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
petals++;
|
||||
} else {
|
||||
|
||||
@@ -41,14 +41,14 @@ public class RenderTileRuneAltar extends TileEntityRenderer<TileRuneAltar> {
|
||||
ms.push();
|
||||
|
||||
int items = 0;
|
||||
for (int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < altar.inventorySize(); i++) {
|
||||
if (altar.getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
break;
|
||||
} else {
|
||||
items++;
|
||||
}
|
||||
}
|
||||
float[] angles = new float[altar.getSizeInventory()];
|
||||
float[] angles = new float[altar.inventorySize()];
|
||||
|
||||
float anglePer = 360F / items;
|
||||
float totalAngle = 0F;
|
||||
@@ -58,7 +58,7 @@ public class RenderTileRuneAltar extends TileEntityRenderer<TileRuneAltar> {
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + partticks;
|
||||
|
||||
for (int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < altar.inventorySize(); i++) {
|
||||
ms.push();
|
||||
ms.translate(0.5F, 1.25F, 0.5F);
|
||||
ms.rotate(Vector3f.YP.rotationDegrees(angles[i] + (float) time));
|
||||
|
||||
@@ -229,7 +229,7 @@ public class RenderTileTinyPotato extends TileEntityRenderer<TileTinyPotato> {
|
||||
float s = 1F / 3.5F;
|
||||
ms.scale(s, s, s);
|
||||
|
||||
for (int i = 0; i < potato.getSizeInventory(); i++) {
|
||||
for (int i = 0; i < potato.inventorySize(); i++) {
|
||||
ItemStack stack = potato.getItemHandler().getStackInSlot(i);
|
||||
if (stack.isEmpty()) {
|
||||
continue;
|
||||
|
||||
@@ -8,18 +8,15 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
@@ -30,11 +27,9 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
@@ -142,7 +137,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
saveLastRecipe();
|
||||
ItemStack output = recipe.getCraftingResult(getItemHandler());
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
getItemHandler().setInventorySlotContents(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -158,11 +153,11 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
});
|
||||
return maybeRecipe.isPresent();
|
||||
} else if (!hasFluidCapability && !item.getTags().contains(ITEM_TAG_APOTHECARY_SPAWNED)) {
|
||||
if (!getItemHandler().getStackInSlot(getSizeInventory() - 1).isEmpty()) {
|
||||
if (!getItemHandler().getStackInSlot(inventorySize() - 1).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
getItemHandler().setInventorySlotContents(i, stack.split(1));
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_SPLASH, SoundCategory.BLOCKS, 0.1F, 10F);
|
||||
@@ -185,7 +180,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
|
||||
public void saveLastRecipe() {
|
||||
lastRecipe = new ArrayList<>();
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
ItemStack stack = getItemHandler().getStackInSlot(i);
|
||||
if (stack.isEmpty()) {
|
||||
break;
|
||||
@@ -234,7 +229,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (!getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -257,7 +252,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
ItemStack stackAt = getItemHandler().getStackInSlot(i);
|
||||
if (stackAt.isEmpty()) {
|
||||
break;
|
||||
@@ -345,7 +340,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
float angle = -90;
|
||||
int radius = 24;
|
||||
int amt = 0;
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
|
||||
|
||||
boolean did = false;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
did = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
@@ -149,7 +149,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
|
||||
world.addEntity(outputItem);
|
||||
world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
getItemHandler().setInventorySlotContents(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
}
|
||||
|
||||
private void ejectAll() {
|
||||
for (int i = 0; i < getSizeInventory(); ++i) {
|
||||
for (int i = 0; i < inventorySize(); ++i) {
|
||||
ItemStack stack = getItemHandler().getStackInSlot(i);
|
||||
if (!stack.isEmpty()) {
|
||||
eject(stack, false);
|
||||
|
||||
@@ -26,6 +26,11 @@ public abstract class TileExposedSimpleInventory extends TileSimpleInventory imp
|
||||
return getItemHandler().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index) {
|
||||
return getItemHandler().getStackInSlot(index);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
|
||||
boolean did = false;
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
did = true;
|
||||
ItemStack stackToAdd = stack.copy();
|
||||
@@ -221,7 +221,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
|
||||
private void saveLastRecipe() {
|
||||
lastRecipe = new ArrayList<>();
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
ItemStack stack = getItemHandler().getStackInSlot(i);
|
||||
if (stack.isEmpty()) {
|
||||
break;
|
||||
@@ -276,7 +276,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);
|
||||
|
||||
saveLastRecipe();
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
ItemStack stack = getItemHandler().getStackInSlot(i);
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem() instanceof ItemRune && (player == null || !player.abilities.isCreativeMode)) {
|
||||
@@ -294,7 +294,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (!getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
float angle = -90;
|
||||
int radius = 24;
|
||||
int amt = 0;
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
if (getItemHandler().getStackInSlot(i).isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class TileSimpleInventory extends TileMod {
|
||||
|
||||
@Override
|
||||
public void readPacketNBT(CompoundNBT tag) {
|
||||
NonNullList<ItemStack> tmp = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> tmp = NonNullList.withSize(inventorySize(), ItemStack.EMPTY);
|
||||
ItemStackHelper.loadAllItems(tag, tmp);
|
||||
copyToInv(tmp, itemHandler);
|
||||
}
|
||||
@@ -54,7 +54,8 @@ public abstract class TileSimpleInventory extends TileMod {
|
||||
ItemStackHelper.saveAllItems(tag, copyFromInv(itemHandler));
|
||||
}
|
||||
|
||||
public final int getSizeInventory() {
|
||||
// NB: Cannot be named the same as the corresponding method in vanilla's interface -- causes obf issues with MCP
|
||||
public final int inventorySize() {
|
||||
return getItemHandler().getSizeInventory();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileTinyPotato extends TileExposedSimpleInventory implements ITicka
|
||||
world.playSound(null, pos, ModSounds.doit, SoundCategory.BLOCKS, 1F, 1F);
|
||||
}
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
for (int i = 0; i < inventorySize(); i++) {
|
||||
ItemStack stackAt = getItemHandler().getStackInSlot(i);
|
||||
if (!stackAt.isEmpty() && stackAt.getItem() == ModBlocks.tinyPotato.asItem()) {
|
||||
player.sendMessage(new StringTextComponent("Don't talk to me or my son ever again."), Util.field_240973_b_);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class InventoryHelper {
|
||||
|
||||
public static void dropInventory(TileSimpleInventory inv, World world, BlockState state, BlockPos pos) {
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
for (int j1 = 0; j1 < inv.inventorySize(); ++j1) {
|
||||
ItemStack itemstack = inv.getItemHandler().getStackInSlot(j1);
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
@@ -62,7 +62,7 @@ public class InventoryHelper {
|
||||
}
|
||||
|
||||
public static void withdrawFromInventory(TileSimpleInventory inv, PlayerEntity player) {
|
||||
for (int i = inv.getSizeInventory() - 1; i >= 0; i--) {
|
||||
for (int i = inv.inventorySize() - 1; i >= 0; i--) {
|
||||
ItemStack stackAt = inv.getItemHandler().getStackInSlot(i);
|
||||
if (!stackAt.isEmpty()) {
|
||||
ItemStack copy = stackAt.copy();
|
||||
|
||||
Reference in new issue
Block a user