mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
Expose the automation inventories that should be exposed
This commit is contained in:
1 parent
1980958c67
commit
95ab01022f
9 files changed
+79
-15
No files matched your search
@@ -43,7 +43,6 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(10) {
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
||||
/**
|
||||
* Version of {@link TileSimpleInventory} where the backing inventory is exposed to automation
|
||||
*/
|
||||
public abstract class TileExposedSimpleInventory extends TileSimpleInventory implements IInventory {
|
||||
public TileExposedSimpleInventory(TileEntityType<?> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return getItemHandler().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int index) {
|
||||
return getItemHandler().getStackInSlot(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count) {
|
||||
return getItemHandler().decrStackSize(index, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int index) {
|
||||
return getItemHandler().removeStackFromSlot(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||
getItemHandler().setInventorySlotContents(index, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsableByPlayer(PlayerEntity player) {
|
||||
return getItemHandler().isUsableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
getItemHandler().clear();
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileHourglass extends TileSimpleInventory implements ITickableTileEntity {
|
||||
public class TileHourglass extends TileExposedSimpleInventory implements ITickableTileEntity {
|
||||
private static final String TAG_TIME = "time";
|
||||
private static final String TAG_TIME_FRACTION = "timeFraction";
|
||||
private static final String TAG_FLIP = "flip";
|
||||
@@ -163,7 +163,6 @@ public class TileHourglass extends TileSimpleInventory implements ITickableTileE
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(1) {
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -18,6 +19,7 @@ import net.minecraft.potion.Effects;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -33,11 +35,12 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileIncensePlate extends TileSimpleInventory implements ITickableTileEntity {
|
||||
public class TileIncensePlate extends TileExposedSimpleInventory implements ISidedInventory, ITickableTileEntity {
|
||||
private static final String TAG_TIME_LEFT = "timeLeft";
|
||||
private static final String TAG_BURNING = "burning";
|
||||
private static final int RANGE = 32;
|
||||
@@ -165,7 +168,6 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose, prevent extract
|
||||
return new Inventory(1) {
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
@@ -182,4 +184,20 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
|
||||
}
|
||||
}
|
||||
|
||||
private static final int[] SLOTS = { 0 };
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
return SLOTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, @Nullable Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, Direction direction) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class TileOpenCrate extends TileSimpleInventory implements ITickableTileEntity {
|
||||
public class TileOpenCrate extends TileExposedSimpleInventory implements ITickableTileEntity {
|
||||
public TileOpenCrate() {
|
||||
this(ModTiles.OPEN_CRATE);
|
||||
}
|
||||
@@ -35,7 +35,6 @@ public class TileOpenCrate extends TileSimpleInventory implements ITickableTileE
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class TileSparkChanger extends TileSimpleInventory {
|
||||
public class TileSparkChanger extends TileExposedSimpleInventory {
|
||||
public TileSparkChanger() {
|
||||
super(ModTiles.SPARK_CHANGER);
|
||||
}
|
||||
@@ -73,7 +73,6 @@ public class TileSparkChanger extends TileSimpleInventory {
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(1) {
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
|
||||
@@ -32,7 +32,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TileTinyPotato extends TileSimpleInventory implements ITickableTileEntity, INameable {
|
||||
public class TileTinyPotato extends TileExposedSimpleInventory implements ITickableTileEntity, INameable {
|
||||
private static final String TAG_NAME = "name";
|
||||
private static final int JUMP_EVENT = 0;
|
||||
|
||||
@@ -136,7 +136,6 @@ public class TileTinyPotato extends TileSimpleInventory implements ITickableTile
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(6);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,14 @@ import vazkii.botania.api.mana.ITinyPlanetExcempt;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.ModTiles;
|
||||
import vazkii.botania.common.block.tile.TileExposedSimpleInventory;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TilePrism extends TileSimpleInventory {
|
||||
public class TilePrism extends TileExposedSimpleInventory {
|
||||
public TilePrism() {
|
||||
super(ModTiles.PRISM);
|
||||
}
|
||||
@@ -65,7 +66,6 @@ public class TilePrism extends TileSimpleInventory {
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(1) {
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
|
||||
@@ -41,6 +41,7 @@ import vazkii.botania.api.wand.IWandBindable;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.block.mana.BlockSpreader;
|
||||
import vazkii.botania.common.block.tile.ModTiles;
|
||||
import vazkii.botania.common.block.tile.TileExposedSimpleInventory;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
@@ -55,7 +56,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IDirectioned, ITickableTileEntity {
|
||||
public class TileSpreader extends TileExposedSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IDirectioned, ITickableTileEntity {
|
||||
private static final int TICKS_ALLOWED_WITHOUT_PINGBACK = 20;
|
||||
private static final double PINGBACK_EXPIRED_SEARCH_DISTANCE = 0.5;
|
||||
|
||||
@@ -591,7 +592,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
|
||||
@Override
|
||||
protected Inventory createItemHandler() {
|
||||
// todo 1.16 expose
|
||||
return new Inventory(1) {
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
|
||||
Reference in new issue
Block a user