Re-add the Destructor
This commit is contained in:
@@ -61,6 +61,7 @@ public class ClientSetup {
|
||||
));
|
||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "wireless_transmitter"), (base, registry) -> new FullbrightBakedModel(base, new ResourceLocation(RS.ID, "block/wireless_transmitter/cutouts/connected")));
|
||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "constructor"), (base, registry) -> new FullbrightBakedModel(base, new ResourceLocation(RS.ID, "block/constructor/cutouts/connected")));
|
||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "destructor"), (base, registry) -> new FullbrightBakedModel(base, new ResourceLocation(RS.ID, "block/destructor/cutouts/connected")));
|
||||
|
||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "disk_drive"), (base, registry) -> new FullbrightBakedModel(
|
||||
new DiskDriveBakedModel(
|
||||
@@ -134,6 +135,7 @@ public class ClientSetup {
|
||||
ScreenManager.registerFactory(RSContainers.WIRELESS_TRANSMITTER, WirelessTransmitterScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.STORAGE_MONITOR, StorageMonitorScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.CONSTRUCTOR, ConstructorScreen::new);
|
||||
ScreenManager.registerFactory(RSContainers.DESTRUCTOR, DestructorScreen::new);
|
||||
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_WIRELESS_GRID);
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_WIRELESS_FLUID_GRID);
|
||||
|
||||
@@ -131,6 +131,7 @@ public final class RS {
|
||||
API.instance().getNetworkNodeRegistry().add(WirelessTransmitterNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new WirelessTransmitterNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(StorageMonitorNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new StorageMonitorNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(ConstructorNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new ConstructorNetworkNode(world, pos)));
|
||||
API.instance().getNetworkNodeRegistry().add(DestructorNetworkNode.ID, (tag, world, pos) -> readAndReturn(tag, new DestructorNetworkNode(world, pos)));
|
||||
|
||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||
API.instance().getGridManager().add(WirelessGridGridFactory.ID, new WirelessGridGridFactory());
|
||||
@@ -187,6 +188,7 @@ public final class RS {
|
||||
e.getRegistry().register(new WirelessTransmitterBlock());
|
||||
e.getRegistry().register(new StorageMonitorBlock());
|
||||
e.getRegistry().register(new ConstructorBlock());
|
||||
e.getRegistry().register(new DestructorBlock());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -225,6 +227,7 @@ public final class RS {
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(WirelessTransmitterTile::new, RSBlocks.WIRELESS_TRANSMITTER).build(null).setRegistryName(RS.ID, "wireless_transmitter")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(StorageMonitorTile::new, RSBlocks.STORAGE_MONITOR).build(null).setRegistryName(RS.ID, "storage_monitor")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ConstructorTile::new, RSBlocks.CONSTRUCTOR).build(null).setRegistryName(RS.ID, "constructor")));
|
||||
e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DestructorTile::new, RSBlocks.DESTRUCTOR).build(null).setRegistryName(RS.ID, "destructor")));
|
||||
}
|
||||
|
||||
private <T extends TileEntity> TileEntityType<T> registerTileDataParameters(TileEntityType<T> t) {
|
||||
@@ -255,6 +258,7 @@ public final class RS {
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<WirelessTransmitterContainer, WirelessTransmitterTile>((windowId, inv, tile) -> new WirelessTransmitterContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "wireless_transmitter"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<StorageMonitorContainer, StorageMonitorTile>((windowId, inv, tile) -> new StorageMonitorContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "storage_monitor"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<ConstructorContainer, ConstructorTile>((windowId, inv, tile) -> new ConstructorContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "constructor"));
|
||||
e.getRegistry().register(IForgeContainerType.create(new PositionalTileContainerFactory<DestructorContainer, DestructorTile>((windowId, inv, tile) -> new DestructorContainer(tile, inv.player, windowId))).setRegistryName(RS.ID, "destructor"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -335,6 +339,7 @@ public final class RS {
|
||||
e.getRegistry().register(new WirelessTransmitterBlockItem());
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.STORAGE_MONITOR));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CONSTRUCTOR));
|
||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DESTRUCTOR));
|
||||
|
||||
e.getRegistry().register(new WirelessGridItem(WirelessGridItem.Type.NORMAL));
|
||||
e.getRegistry().register(new WirelessGridItem(WirelessGridItem.Type.CREATIVE));
|
||||
|
||||
@@ -70,8 +70,9 @@ public final class RSBlocks {
|
||||
public static final StorageMonitorBlock STORAGE_MONITOR = null;
|
||||
@ObjectHolder(RS.ID + ":constructor")
|
||||
public static final ConstructorBlock CONSTRUCTOR = null;
|
||||
|
||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||
@ObjectHolder(RS.ID + ":destructor")
|
||||
public static final DestructorBlock DESTRUCTOR = null;
|
||||
|
||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||
public static final BlockDiskManipulator DISK_MANIPULATOR = new BlockDiskManipulator();
|
||||
|
||||
@@ -41,6 +41,8 @@ public final class RSContainers {
|
||||
public static final ContainerType<StorageMonitorContainer> STORAGE_MONITOR = null;
|
||||
@ObjectHolder(RS.ID + ":constructor")
|
||||
public static final ContainerType<ConstructorContainer> CONSTRUCTOR = null;
|
||||
@ObjectHolder(RS.ID + ":destructor")
|
||||
public static final ContainerType<DestructorContainer> DESTRUCTOR = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":crafter")
|
||||
public static final ContainerType<CrafterContainer> CRAFTER = null;
|
||||
@@ -48,8 +50,6 @@ public final class RSContainers {
|
||||
public static final ContainerType<CrafterContainer> CRAFTER_MANAGER = null;
|
||||
//@ObjectHolder(RS.ID + ":crafting_monitor")
|
||||
public static final ContainerType<CraftingMonitorContainer> CRAFTING_MONITOR = null;
|
||||
//@ObjectHolder(RS.ID + ":destructor")
|
||||
public static final ContainerType<DestructorContainer> DESTRUCTOR = null;
|
||||
//@ObjectHolder(RS.ID + ":disk_manipulator")
|
||||
public static final ContainerType<DiskManipulatorContainer> DISK_MANIPULATOR = null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ public class RSOldConfig {
|
||||
public int crafterPerPatternUsage;
|
||||
public int craftingMonitorUsage;
|
||||
public int crafterManagerUsage;
|
||||
public int destructorUsage;
|
||||
public int diskManipulatorUsage;
|
||||
//endregion
|
||||
|
||||
@@ -43,7 +42,6 @@ public class RSOldConfig {
|
||||
crafterPerPatternUsage = config.getInt("crafterPerPattern", ENERGY, 1, 0, Integer.MAX_VALUE, "The additional energy used per Pattern in a Crafter");
|
||||
craftingMonitorUsage = config.getInt("craftingMonitor", ENERGY, 2, 0, Integer.MAX_VALUE, "The energy used by Crafting Monitors");
|
||||
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
||||
destructorUsage = config.getInt("destructor", ENERGY, 1, 0, Integer.MAX_VALUE, "The energy used by Destructors");
|
||||
diskManipulatorUsage = config.getInt("diskManipulator", ENERGY, 3, 0, Integer.MAX_VALUE, "The energy used by Disk Manipulators");
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ public class RSTiles {
|
||||
public static final TileEntityType<StorageMonitorTile> STORAGE_MONITOR = null;
|
||||
@ObjectHolder(RS.ID + ":constructor")
|
||||
public static final TileEntityType<ConstructorTile> CONSTRUCTOR = null;
|
||||
@ObjectHolder(RS.ID + ":destructor")
|
||||
public static final TileEntityType<DestructorTile> DESTRUCTOR = null;
|
||||
|
||||
//@ObjectHolder(RS.ID + ":portable_grid")
|
||||
public static final TileEntityType<TilePortableGrid> PORTABLE_GRID = null;
|
||||
@@ -81,6 +83,4 @@ public class RSTiles {
|
||||
public static final TileEntityType<TileCrafter> CRAFTER_MANAGER = null;
|
||||
//@ObjectHolder(RS.ID + ":crafting_monitor")
|
||||
public static final TileEntityType<TileCraftingMonitor> CRAFTING_MONITOR = null;
|
||||
//@ObjectHolder(RS.ID + ":destructor")
|
||||
public static final TileEntityType<TileDestructor> DESTRUCTOR = null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
@@ -14,6 +13,7 @@ import com.raoulvdberge.refinedstorage.tile.ConstructorTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.dispenser.Position;
|
||||
import net.minecraft.entity.item.FireworkRocketEntity;
|
||||
@@ -33,8 +33,6 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
@@ -45,7 +43,6 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ConstructorNetworkNode extends NetworkNode implements IComparable, IType {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "constructor");
|
||||
@@ -105,7 +102,7 @@ public class ConstructorNetworkNode extends NetworkNode implements IComparable,
|
||||
if (upgrades.hasUpgrade(UpgradeItem.Type.CRAFTING)) {
|
||||
network.getCraftingManager().request(this, stack, FluidAttributes.BUCKET_VOLUME);
|
||||
}
|
||||
} else if (world.isAirBlock(front) && FluidUtil.tryPlaceFluid(getFakePlayer(), world, Hand.MAIN_HAND, front, new NetworkFluidHandler(StackUtils.copy(stack, FluidAttributes.BUCKET_VOLUME)), stack)) {
|
||||
} else if (world.isAirBlock(front) && FluidUtil.tryPlaceFluid(WorldUtils.getFakePlayer((ServerWorld) world, getOwner()), world, Hand.MAIN_HAND, front, new NetworkFluidHandler(StackUtils.copy(stack, FluidAttributes.BUCKET_VOLUME)), stack)) {
|
||||
// We manually have to check world.isAirBlock in the else if statement because tryPlaceFluid ignores this.
|
||||
network.extractFluid(stack, FluidAttributes.BUCKET_VOLUME, Action.PERFORM);
|
||||
}
|
||||
@@ -115,7 +112,7 @@ public class ConstructorNetworkNode extends NetworkNode implements IComparable,
|
||||
if (!network.extractItem(stack, 1, compare, Action.SIMULATE).isEmpty()) {
|
||||
BlockItemUseContext ctx = new ConstructorBlockItemUseContext(
|
||||
world,
|
||||
getFakePlayer(),
|
||||
WorldUtils.getFakePlayer((ServerWorld) world, getOwner()),
|
||||
Hand.MAIN_HAND,
|
||||
ItemHandlerHelper.copyStackWithSize(stack, 1),
|
||||
new BlockRayTraceResult(Vec3d.ZERO, getDirection(), pos, false)
|
||||
@@ -150,22 +147,6 @@ public class ConstructorNetworkNode extends NetworkNode implements IComparable,
|
||||
}
|
||||
}
|
||||
|
||||
private FakePlayer getFakePlayer() {
|
||||
ServerWorld world = (ServerWorld) this.world;
|
||||
|
||||
UUID owner = getOwner();
|
||||
|
||||
if (owner != null) {
|
||||
GameProfile profile = world.getServer().getPlayerProfileCache().getProfileByUUID(owner);
|
||||
|
||||
if (profile != null) {
|
||||
return FakePlayerFactory.get(world, profile);
|
||||
}
|
||||
}
|
||||
|
||||
return FakePlayerFactory.getMinecraft(world);
|
||||
}
|
||||
|
||||
// @Volatile: From BlockDispenser#getDispensePosition
|
||||
private double getDispensePositionX() {
|
||||
return (double) pos.getX() + 0.5D + 0.8D * (double) getDirection().getXOffset();
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeFluidInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.item.UpgradeItem;
|
||||
import com.raoulvdberge.refinedstorage.tile.DestructorTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DestructorNetworkNode extends NetworkNode implements IComparable, IWhitelistBlacklist, IType {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "destructor");
|
||||
|
||||
private static final String NBT_COMPARE = "Compare";
|
||||
private static final String NBT_MODE = "Mode";
|
||||
private static final String NBT_TYPE = "Type";
|
||||
private static final String NBT_PICKUP = "Pickup";
|
||||
private static final String NBT_FLUID_FILTERS = "FluidFilters";
|
||||
|
||||
private static final int BASE_SPEED = 20;
|
||||
|
||||
private BaseItemHandler itemFilters = new BaseItemHandler(9).addListener(new NetworkNodeInventoryListener(this));
|
||||
private FluidInventory fluidFilters = new FluidInventory(9).addListener(new NetworkNodeFluidInventoryListener(this));
|
||||
|
||||
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4, UpgradeItem.Type.SPEED, UpgradeItem.Type.SILK_TOUCH, UpgradeItem.Type.FORTUNE_1, UpgradeItem.Type.FORTUNE_2, UpgradeItem.Type.FORTUNE_3)
|
||||
.addListener(new NetworkNodeInventoryListener(this))
|
||||
.addListener((handler, slot, reading) -> {
|
||||
tool = createTool();
|
||||
});
|
||||
|
||||
private int compare = IComparer.COMPARE_NBT;
|
||||
private int mode = IWhitelistBlacklist.BLACKLIST;
|
||||
private int type = IType.ITEMS;
|
||||
private boolean pickupItem = false;
|
||||
private ItemStack tool = createTool();
|
||||
|
||||
public DestructorNetworkNode(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RS.SERVER_CONFIG.getDestructor().getUsage() + upgrades.getEnergyUsage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (canUpdate() && ticks % upgrades.getSpeed(BASE_SPEED, 4) == 0) {
|
||||
if (type == IType.ITEMS) {
|
||||
if (pickupItem) {
|
||||
pickupItems();
|
||||
} else {
|
||||
breakBlock();
|
||||
}
|
||||
} else if (type == IType.FLUIDS) {
|
||||
breakFluid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pickupItems() {
|
||||
BlockPos front = pos.offset(getDirection());
|
||||
|
||||
List<Entity> droppedItems = new ArrayList<>();
|
||||
|
||||
Chunk chunk = world.getChunkAt(front);
|
||||
chunk.getEntitiesWithinAABBForEntity(null, new AxisAlignedBB(front), droppedItems, null);
|
||||
|
||||
for (Entity entity : droppedItems) {
|
||||
if (entity instanceof ItemEntity) {
|
||||
ItemStack droppedItem = ((ItemEntity) entity).getItem();
|
||||
|
||||
if (IWhitelistBlacklist.acceptsItem(itemFilters, mode, compare, droppedItem) &&
|
||||
network.insertItem(droppedItem, droppedItem.getCount(), Action.SIMULATE).isEmpty()) {
|
||||
network.insertItemTracked(droppedItem.copy(), droppedItem.getCount());
|
||||
|
||||
entity.remove();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void breakBlock() {
|
||||
BlockPos front = pos.offset(getDirection());
|
||||
BlockState frontBlockState = world.getBlockState(front);
|
||||
Block frontBlock = frontBlockState.getBlock();
|
||||
ItemStack frontStack = frontBlock.getPickBlock(
|
||||
frontBlockState,
|
||||
new BlockRayTraceResult(Vec3d.ZERO, getDirection().getOpposite(), front, false),
|
||||
world,
|
||||
front,
|
||||
WorldUtils.getFakePlayer((ServerWorld) world, getOwner())
|
||||
);
|
||||
|
||||
if (!frontStack.isEmpty() &&
|
||||
IWhitelistBlacklist.acceptsItem(itemFilters, mode, compare, frontStack) &&
|
||||
frontBlockState.getBlockHardness(world, front) != -1.0) {
|
||||
List<ItemStack> drops = Block.getDrops(
|
||||
frontBlockState,
|
||||
(ServerWorld) world,
|
||||
front,
|
||||
world.getTileEntity(front),
|
||||
WorldUtils.getFakePlayer((ServerWorld) world, getOwner()),
|
||||
tool
|
||||
);
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
if (!network.insertItem(drop, drop.getCount(), Action.SIMULATE).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(world, front, frontBlockState, WorldUtils.getFakePlayer((ServerWorld) world, getOwner()));
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(e)) {
|
||||
frontBlock.onBlockHarvested(world, front, frontBlockState, WorldUtils.getFakePlayer((ServerWorld) world, getOwner()));
|
||||
|
||||
world.removeBlock(front, false);
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
// We check if the controller isn't null here because when a destructor faces a node and removes it
|
||||
// it will essentially remove this block itself from the network without knowing
|
||||
if (network == null) {
|
||||
InventoryHelper.spawnItemStack(world, front.getX(), front.getY(), front.getZ(), drop);
|
||||
} else {
|
||||
network.insertItemTracked(drop, drop.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void breakFluid() {
|
||||
BlockPos front = pos.offset(getDirection());
|
||||
BlockState frontBlockState = world.getBlockState(front);
|
||||
Block frontBlock = frontBlockState.getBlock();
|
||||
|
||||
if (frontBlock instanceof FlowingFluidBlock) {
|
||||
// @Volatile: Logic from FlowingFluidBlock#pickupFluid
|
||||
if (frontBlockState.get(FlowingFluidBlock.LEVEL) == 0) {
|
||||
Fluid fluid = ((FlowingFluidBlock) frontBlock).getFluid();
|
||||
|
||||
FluidStack stack = new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME);
|
||||
|
||||
if (IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, stack) &&
|
||||
network.insertFluid(stack, stack.getAmount(), Action.SIMULATE).isEmpty()) {
|
||||
network.insertFluidTracked(stack, stack.getAmount());
|
||||
|
||||
world.setBlockState(front, Blocks.AIR.getDefaultState(), 11);
|
||||
}
|
||||
}
|
||||
} else if (frontBlock instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock) frontBlock;
|
||||
|
||||
if (fluidBlock.canDrain(world, front)) {
|
||||
FluidStack simulatedDrain = fluidBlock.drain(world, front, IFluidHandler.FluidAction.SIMULATE);
|
||||
|
||||
if (IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, simulatedDrain) &&
|
||||
network.insertFluid(simulatedDrain, simulatedDrain.getAmount(), Action.SIMULATE).isEmpty()) {
|
||||
FluidStack drained = fluidBlock.drain(world, front, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
network.insertFluidTracked(drained, drained.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack createTool() {
|
||||
ItemStack tool = new ItemStack(Items.DIAMOND_PICKAXE);
|
||||
|
||||
if (upgrades.hasUpgrade(UpgradeItem.Type.SILK_TOUCH)) {
|
||||
tool.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
} else if (upgrades.hasUpgrade(UpgradeItem.Type.FORTUNE_3)) {
|
||||
tool.addEnchantment(Enchantments.FORTUNE, 3);
|
||||
} else if (upgrades.hasUpgrade(UpgradeItem.Type.FORTUNE_2)) {
|
||||
tool.addEnchantment(Enchantments.FORTUNE, 2);
|
||||
} else if (upgrades.hasUpgrade(UpgradeItem.Type.FORTUNE_1)) {
|
||||
tool.addEnchantment(Enchantments.FORTUNE, 1);
|
||||
}
|
||||
|
||||
return tool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int compare) {
|
||||
this.compare = compare;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWhitelistBlacklistMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelistBlacklistMode(int mode) {
|
||||
this.mode = mode;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT tag) {
|
||||
super.read(tag);
|
||||
|
||||
StackUtils.readItems(upgrades, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT tag) {
|
||||
super.write(tag);
|
||||
|
||||
StackUtils.writeItems(upgrades, 1, tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeConfiguration(CompoundNBT tag) {
|
||||
super.writeConfiguration(tag);
|
||||
|
||||
tag.putInt(NBT_COMPARE, compare);
|
||||
tag.putInt(NBT_MODE, mode);
|
||||
tag.putInt(NBT_TYPE, type);
|
||||
tag.putBoolean(NBT_PICKUP, pickupItem);
|
||||
|
||||
StackUtils.writeItems(itemFilters, 0, tag);
|
||||
|
||||
tag.put(NBT_FLUID_FILTERS, fluidFilters.writeToNbt());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readConfiguration(CompoundNBT tag) {
|
||||
super.readConfiguration(tag);
|
||||
|
||||
if (tag.contains(NBT_COMPARE)) {
|
||||
compare = tag.getInt(NBT_COMPARE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_MODE)) {
|
||||
mode = tag.getInt(NBT_MODE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_TYPE)) {
|
||||
type = tag.getInt(NBT_TYPE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_PICKUP)) {
|
||||
pickupItem = tag.getBoolean(NBT_PICKUP);
|
||||
}
|
||||
|
||||
StackUtils.readItems(itemFilters, 0, tag);
|
||||
|
||||
if (tag.contains(NBT_FLUID_FILTERS)) {
|
||||
fluidFilters.readFromNbt(tag.getCompound(NBT_FLUID_FILTERS));
|
||||
}
|
||||
}
|
||||
|
||||
public IItemHandler getUpgrades() {
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
public IItemHandler getInventory() {
|
||||
return itemFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getDrops() {
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return world.isRemote ? DestructorTile.TYPE.getValue() : type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemFilters() {
|
||||
return itemFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidInventory getFluidFilters() {
|
||||
return fluidFilters;
|
||||
}
|
||||
|
||||
public boolean isPickupItem() {
|
||||
return pickupItem;
|
||||
}
|
||||
|
||||
public void setPickupItem(boolean pickupItem) {
|
||||
this.pickupItem = pickupItem;
|
||||
}
|
||||
}
|
||||
@@ -1,329 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.inventory.fluid.FluidInventory;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.UpgradeItemHandler;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeFluidInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.inventory.listener.NetworkNodeInventoryListener;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.server.management.PlayerProfileCache;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class NetworkNodeDestructor extends NetworkNode implements IComparable, IWhitelistBlacklist, IType {
|
||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "destructor");
|
||||
|
||||
private static final String NBT_COMPARE = "Compare";
|
||||
private static final String NBT_MODE = "Mode";
|
||||
private static final String NBT_TYPE = "Type";
|
||||
private static final String NBT_PICKUP = "Pickup";
|
||||
private static final String NBT_FLUID_FILTERS = "FluidFilters";
|
||||
|
||||
private static final int BASE_SPEED = 20;
|
||||
|
||||
private BaseItemHandler itemFilters = new BaseItemHandler(9).addListener(new NetworkNodeInventoryListener(this));
|
||||
private FluidInventory fluidFilters = new FluidInventory(9).addListener(new NetworkNodeFluidInventoryListener(this));
|
||||
|
||||
private UpgradeItemHandler upgrades = (UpgradeItemHandler) new UpgradeItemHandler(4).addListener(new NetworkNodeInventoryListener(this)/* TODO, ItemUpgrade.TYPE_SPEED, ItemUpgrade.TYPE_SILK_TOUCH, ItemUpgrade.TYPE_FORTUNE_1, ItemUpgrade.TYPE_FORTUNE_2, ItemUpgrade.TYPE_FORTUNE_3*/);
|
||||
|
||||
private int compare = IComparer.COMPARE_NBT;
|
||||
private int mode = IWhitelistBlacklist.BLACKLIST;
|
||||
private int type = IType.ITEMS;
|
||||
private boolean pickupItem = false;
|
||||
|
||||
public NetworkNodeDestructor(World world, BlockPos pos) {
|
||||
super(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RS.INSTANCE.config.destructorUsage + upgrades.getEnergyUsage();
|
||||
}
|
||||
|
||||
private FakePlayer getFakePlayer() {
|
||||
ServerWorld world = (ServerWorld) this.world;
|
||||
|
||||
UUID owner = getOwner();
|
||||
|
||||
if (owner != null) {
|
||||
PlayerProfileCache profileCache = world.getServer().getPlayerProfileCache();
|
||||
|
||||
GameProfile profile = profileCache.getProfileByUUID(owner);
|
||||
|
||||
if (profile != null) {
|
||||
return FakePlayerFactory.get(world, profile);
|
||||
}
|
||||
}
|
||||
|
||||
return FakePlayerFactory.getMinecraft(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (canUpdate() && ticks % upgrades.getSpeed(BASE_SPEED, 4) == 0) {
|
||||
BlockPos front = pos.offset(getDirection());
|
||||
|
||||
if (pickupItem && type == IType.ITEMS) {
|
||||
List<Entity> droppedItems = new ArrayList<>();
|
||||
|
||||
Chunk chunk = world.getChunkAt(front);
|
||||
chunk.getEntitiesWithinAABBForEntity(null, new AxisAlignedBB(front), droppedItems, null);
|
||||
|
||||
for (Entity entity : droppedItems) {
|
||||
if (entity instanceof ItemEntity) {
|
||||
ItemStack droppedItem = ((ItemEntity) entity).getItem();
|
||||
|
||||
if (IWhitelistBlacklist.acceptsItem(itemFilters, mode, compare, droppedItem) && network.insertItem(droppedItem, droppedItem.getCount(), Action.SIMULATE).isEmpty()) {
|
||||
network.insertItemTracked(droppedItem.copy(), droppedItem.getCount());
|
||||
|
||||
// TODO world.removeEntity(entity);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == IType.ITEMS) {
|
||||
BlockState frontBlockState = world.getBlockState(front);
|
||||
Block frontBlock = frontBlockState.getBlock();
|
||||
|
||||
ItemStack frontStack = frontBlock.getPickBlock(
|
||||
frontBlockState,
|
||||
null,
|
||||
// TODO new BlockRayTraceResult(new Vec3d(pos.getX(), pos.getY(), pos.getZ()), getDirection().getOpposite()),
|
||||
world,
|
||||
front,
|
||||
getFakePlayer()
|
||||
);
|
||||
|
||||
if (!frontStack.isEmpty()) {
|
||||
if (IWhitelistBlacklist.acceptsItem(itemFilters, mode, compare, frontStack) && frontBlockState.getBlockHardness(world, front) != -1.0) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
|
||||
/* TODO if (frontBlock instanceof ShulkerBoxTileEntity) {
|
||||
drops.add(((BlockShulkerBox) frontBlock).getItem(world, front, frontBlockState));
|
||||
|
||||
TileEntity shulkerBoxTile = world.getTileEntity(front);
|
||||
|
||||
if (shulkerBoxTile instanceof TileEntityShulkerBox) {
|
||||
// Avoid dropping the shulker box when Block#breakBlock is called
|
||||
((TileEntityShulkerBox) shulkerBoxTile).setDestroyedByCreativePlayer(true);
|
||||
((TileEntityShulkerBox) shulkerBoxTile).clear();
|
||||
}
|
||||
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_SILK_TOUCH) && frontBlock.canSilkHarvest(world, front, frontBlockState, null)) {
|
||||
drops.add(frontStack);
|
||||
} else {
|
||||
frontBlock.getDrops(drops, world, front, frontBlockState, upgrades.getFortuneLevel());
|
||||
}*/
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
if (!network.insertItem(drop, drop.getCount(), Action.SIMULATE).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockEvent.BreakEvent e = new BlockEvent.BreakEvent(world, front, frontBlockState, getFakePlayer());
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(e)) {
|
||||
world.playEvent(null, 2001, front, Block.getStateId(frontBlockState));
|
||||
world.removeBlock(front, false);
|
||||
|
||||
for (ItemStack drop : drops) {
|
||||
// We check if the controller isn't null here because when a destructor faces a node and removes it
|
||||
// it will essentially remove this block itself from the network without knowing
|
||||
if (network == null) {
|
||||
InventoryHelper.spawnItemStack(world, front.getX(), front.getY(), front.getZ(), drop);
|
||||
} else {
|
||||
network.insertItemTracked(drop, drop.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == IType.FLUIDS) {
|
||||
Block frontBlock = world.getBlockState(front).getBlock();
|
||||
|
||||
IFluidHandler handler = null;
|
||||
/* TODO
|
||||
if (frontBlock instanceof BlockLiquid) {
|
||||
handler = new BlockLiquidWrapper((BlockLiquid) frontBlock, world, front);
|
||||
} else if (frontBlock instanceof IFluidBlock) {
|
||||
handler = new FluidBlockWrapper((IFluidBlock) frontBlock, world, front);
|
||||
}
|
||||
|
||||
if (handler != null) {
|
||||
FluidStack stack = handler.drain(Fluid.BUCKET_VOLUME, false);
|
||||
|
||||
if (stack != null && IWhitelistBlacklist.acceptsFluid(fluidFilters, mode, compare, stack) && network.insertFluid(stack, stack.amount, Action.SIMULATE) == null) {
|
||||
FluidStack drained = handler.drain(Fluid.BUCKET_VOLUME, true);
|
||||
|
||||
network.insertFluidTracked(drained, drained.amount);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompare(int compare) {
|
||||
this.compare = compare;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWhitelistBlacklistMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelistBlacklistMode(int mode) {
|
||||
this.mode = mode;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT tag) {
|
||||
super.read(tag);
|
||||
|
||||
StackUtils.readItems(upgrades, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT tag) {
|
||||
super.write(tag);
|
||||
|
||||
StackUtils.writeItems(upgrades, 1, tag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeConfiguration(CompoundNBT tag) {
|
||||
super.writeConfiguration(tag);
|
||||
|
||||
tag.putInt(NBT_COMPARE, compare);
|
||||
tag.putInt(NBT_MODE, mode);
|
||||
tag.putInt(NBT_TYPE, type);
|
||||
tag.putBoolean(NBT_PICKUP, pickupItem);
|
||||
|
||||
StackUtils.writeItems(itemFilters, 0, tag);
|
||||
|
||||
tag.put(NBT_FLUID_FILTERS, fluidFilters.writeToNbt());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readConfiguration(CompoundNBT tag) {
|
||||
super.readConfiguration(tag);
|
||||
|
||||
if (tag.contains(NBT_COMPARE)) {
|
||||
compare = tag.getInt(NBT_COMPARE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_MODE)) {
|
||||
mode = tag.getInt(NBT_MODE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_TYPE)) {
|
||||
type = tag.getInt(NBT_TYPE);
|
||||
}
|
||||
|
||||
if (tag.contains(NBT_PICKUP)) {
|
||||
pickupItem = tag.getBoolean(NBT_PICKUP);
|
||||
}
|
||||
|
||||
StackUtils.readItems(itemFilters, 0, tag);
|
||||
|
||||
if (tag.contains(NBT_FLUID_FILTERS)) {
|
||||
fluidFilters.readFromNbt(tag.getCompound(NBT_FLUID_FILTERS));
|
||||
}
|
||||
}
|
||||
|
||||
public IItemHandler getUpgrades() {
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
public IItemHandler getInventory() {
|
||||
return itemFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getDrops() {
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return world.isRemote ? TileDestructor.TYPE.getValue() : type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemFilters() {
|
||||
return itemFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidInventory getFluidFilters() {
|
||||
return fluidFilters;
|
||||
}
|
||||
|
||||
public boolean isPickupItem() {
|
||||
return pickupItem;
|
||||
}
|
||||
|
||||
public void setPickupItem(boolean pickupItem) {
|
||||
this.pickupItem = pickupItem;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
public class BlockDestructor extends CableBlock {
|
||||
/* TODO
|
||||
public BlockDestructor() {
|
||||
super(createBuilder("destructor").tileEntity(TileDestructor::new).create());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerModels(IModelRegistration modelRegistration) {
|
||||
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true"));
|
||||
|
||||
registerCoverAndFullbright(modelRegistration, RS.ID + ":blocks/destructor/cutouts/connected");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
||||
return RSBlocks.CONSTRUCTOR.getCollisions(tile, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
|
||||
if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return openNetworkGui(RSGui.DESTRUCTOR, player, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
|
||||
import com.raoulvdberge.refinedstorage.container.DestructorContainer;
|
||||
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerProvider;
|
||||
import com.raoulvdberge.refinedstorage.tile.DestructorTile;
|
||||
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.NetworkUtils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class DestructorBlock extends CableBlock {
|
||||
private static final VoxelShape HEAD_NORTH = VoxelShapes.or(makeCuboidShape(2, 2, 0, 14, 14, 2), HOLDER_NORTH);
|
||||
private static final VoxelShape HEAD_EAST = VoxelShapes.or(makeCuboidShape(14, 2, 2, 16, 14, 14), HOLDER_EAST);
|
||||
private static final VoxelShape HEAD_SOUTH = VoxelShapes.or(makeCuboidShape(2, 2, 14, 14, 14, 16), HOLDER_SOUTH);
|
||||
private static final VoxelShape HEAD_WEST = VoxelShapes.or(makeCuboidShape(0, 2, 2, 2, 14, 14), HOLDER_WEST);
|
||||
private static final VoxelShape HEAD_DOWN = VoxelShapes.or(makeCuboidShape(2, 0, 2, 14, 2, 14), HOLDER_DOWN);
|
||||
private static final VoxelShape HEAD_UP = VoxelShapes.or(makeCuboidShape(2, 14, 2, 14, 16, 14), HOLDER_UP);
|
||||
|
||||
public DestructorBlock() {
|
||||
super(BlockUtils.DEFAULT_GLASS_PROPERTIES);
|
||||
|
||||
this.setRegistryName(RS.ID, "destructor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new DestructorTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) {
|
||||
VoxelShape shape = super.getShape(state, world, pos, ctx);
|
||||
|
||||
Direction direction = state.get(getDirection().getProperty());
|
||||
|
||||
if (direction == Direction.NORTH) {
|
||||
shape = VoxelShapes.or(shape, HEAD_NORTH);
|
||||
}
|
||||
|
||||
if (direction == Direction.EAST) {
|
||||
shape = VoxelShapes.or(shape, HEAD_EAST);
|
||||
}
|
||||
|
||||
if (direction == Direction.SOUTH) {
|
||||
shape = VoxelShapes.or(shape, HEAD_SOUTH);
|
||||
}
|
||||
|
||||
if (direction == Direction.WEST) {
|
||||
shape = VoxelShapes.or(shape, HEAD_WEST);
|
||||
}
|
||||
|
||||
if (direction == Direction.UP) {
|
||||
shape = VoxelShapes.or(shape, HEAD_UP);
|
||||
}
|
||||
|
||||
if (direction == Direction.DOWN) {
|
||||
shape = VoxelShapes.or(shape, HEAD_DOWN);
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!world.isRemote) {
|
||||
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||
(ServerPlayerEntity) player,
|
||||
new PositionalTileContainerProvider<DestructorTile>(
|
||||
new TranslationTextComponent("gui.refinedstorage.destructor"),
|
||||
(tile, windowId, inventory, p) -> new DestructorContainer(tile, player, windowId),
|
||||
pos
|
||||
),
|
||||
pos
|
||||
));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ public class ServerConfig {
|
||||
private WirelessGrid wirelessGrid;
|
||||
private WirelessFluidGrid wirelessFluidGrid;
|
||||
private Constructor constructor;
|
||||
private Destructor destructor;
|
||||
|
||||
public ServerConfig() {
|
||||
upgrades = new Upgrades();
|
||||
@@ -52,6 +53,7 @@ public class ServerConfig {
|
||||
wirelessGrid = new WirelessGrid();
|
||||
wirelessFluidGrid = new WirelessFluidGrid();
|
||||
constructor = new Constructor();
|
||||
destructor = new Destructor();
|
||||
|
||||
spec = builder.build();
|
||||
}
|
||||
@@ -144,6 +146,10 @@ public class ServerConfig {
|
||||
return constructor;
|
||||
}
|
||||
|
||||
public Destructor getDestructor() {
|
||||
return destructor;
|
||||
}
|
||||
|
||||
public ForgeConfigSpec getSpec() {
|
||||
return spec;
|
||||
}
|
||||
@@ -697,4 +703,20 @@ public class ServerConfig {
|
||||
return usage.get();
|
||||
}
|
||||
}
|
||||
|
||||
public class Destructor {
|
||||
private final ForgeConfigSpec.IntValue usage;
|
||||
|
||||
public Destructor() {
|
||||
builder.push("destructor");
|
||||
|
||||
usage = builder.comment("The energy used by the Destructor").defineInRange("usage", 3, 0, Integer.MAX_VALUE);
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
public int getUsage() {
|
||||
return usage.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package com.raoulvdberge.refinedstorage.container;
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import com.raoulvdberge.refinedstorage.tile.DestructorTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class DestructorContainer extends BaseContainer {
|
||||
public DestructorContainer(TileDestructor destructor, PlayerEntity player, int windowId) {
|
||||
public DestructorContainer(DestructorTile destructor, PlayerEntity player, int windowId) {
|
||||
super(RSContainers.DESTRUCTOR, destructor, player, windowId);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
@@ -3,24 +3,25 @@ package com.raoulvdberge.refinedstorage.screen;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.container.DestructorContainer;
|
||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import com.raoulvdberge.refinedstorage.tile.DestructorTile;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class GuiDestructor extends BaseScreen<DestructorContainer> {
|
||||
public GuiDestructor(DestructorContainer container, PlayerInventory playerInventory) {
|
||||
super(container, 211, 137, playerInventory, null);
|
||||
public class DestructorScreen extends BaseScreen<DestructorContainer> {
|
||||
public DestructorScreen(DestructorContainer container, PlayerInventory playerInventory, ITextComponent title) {
|
||||
super(container, 211, 137, playerInventory, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addSideButton(new RedstoneModeSideButton(this, TileDestructor.REDSTONE_MODE));
|
||||
addSideButton(new RedstoneModeSideButton(this, DestructorTile.REDSTONE_MODE));
|
||||
|
||||
addSideButton(new TypeSideButton(this, TileDestructor.TYPE));
|
||||
addSideButton(new TypeSideButton(this, DestructorTile.TYPE));
|
||||
|
||||
addSideButton(new WhitelistBlacklistSideButton(this, TileDestructor.WHITELIST_BLACKLIST));
|
||||
addSideButton(new WhitelistBlacklistSideButton(this, DestructorTile.WHITELIST_BLACKLIST));
|
||||
|
||||
addSideButton(new ExactModeSideButton(this, TileDestructor.COMPARE));
|
||||
addSideButton(new ExactModeSideButton(this, DestructorTile.COMPARE));
|
||||
|
||||
addSideButton(new DestructorPickupSideButton(this));
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public class GuiDestructor extends BaseScreen<DestructorContainer> {
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, I18n.format("gui.refinedstorage:destructor"));
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileDestructor;
|
||||
import com.raoulvdberge.refinedstorage.tile.DestructorTile;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -13,16 +13,16 @@ public class DestructorPickupSideButton extends SideButton {
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 64 + (!TileDestructor.PICKUP.getValue() ? 16 : 0), 0, 16, 16);
|
||||
screen.blit(x, y, 64 + (!DestructorTile.PICKUP.getValue() ? 16 : 0), 0, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return I18n.format("sidebutton.refinedstorage.destructor.pickup") + "\n" + TextFormatting.GRAY + I18n.format(TileDestructor.PICKUP.getValue() ? "gui.yes" : "gui.no");
|
||||
return I18n.format("sidebutton.refinedstorage.destructor.pickup") + "\n" + TextFormatting.GRAY + I18n.format(DestructorTile.PICKUP.getValue() ? "gui.yes" : "gui.no");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPress() {
|
||||
TileDataManager.setParameter(TileDestructor.PICKUP, !TileDestructor.PICKUP.getValue());
|
||||
TileDataManager.setParameter(DestructorTile.PICKUP, !DestructorTile.PICKUP.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.raoulvdberge.refinedstorage.tile;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeDestructor;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.DestructorNetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IComparable;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IType;
|
||||
import com.raoulvdberge.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
@@ -12,16 +12,16 @@ import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TileDestructor extends NetworkNodeTile<NetworkNodeDestructor> {
|
||||
public static final TileDataParameter<Integer, TileDestructor> COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter<Integer, TileDestructor> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
||||
public static final TileDataParameter<Integer, TileDestructor> TYPE = IType.createParameter();
|
||||
public static final TileDataParameter<Boolean, TileDestructor> PICKUP = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isPickupItem(), (t, v) -> {
|
||||
public class DestructorTile extends NetworkNodeTile<DestructorNetworkNode> {
|
||||
public static final TileDataParameter<Integer, DestructorTile> COMPARE = IComparable.createParameter();
|
||||
public static final TileDataParameter<Integer, DestructorTile> WHITELIST_BLACKLIST = IWhitelistBlacklist.createParameter();
|
||||
public static final TileDataParameter<Integer, DestructorTile> TYPE = IType.createParameter();
|
||||
public static final TileDataParameter<Boolean, DestructorTile> PICKUP = new TileDataParameter<>(DataSerializers.BOOLEAN, false, t -> t.getNode().isPickupItem(), (t, v) -> {
|
||||
t.getNode().setPickupItem(v);
|
||||
t.getNode().markDirty();
|
||||
});
|
||||
|
||||
public TileDestructor() {
|
||||
public DestructorTile() {
|
||||
super(RSTiles.DESTRUCTOR);
|
||||
|
||||
dataManager.addWatchedParameter(COMPARE);
|
||||
@@ -32,7 +32,7 @@ public class TileDestructor extends NetworkNodeTile<NetworkNodeDestructor> {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NetworkNodeDestructor createNode(World world, BlockPos pos) {
|
||||
return new NetworkNodeDestructor(world, pos);
|
||||
public DestructorNetworkNode createNode(World world, BlockPos pos) {
|
||||
return new DestructorNetworkNode(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.raoulvdberge.refinedstorage.util;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.server.management.PlayerProfileCache;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -14,6 +16,9 @@ import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
@@ -22,6 +27,7 @@ import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class WorldUtils {
|
||||
public static void updateBlock(@Nullable World world, BlockPos pos) {
|
||||
@@ -56,6 +62,20 @@ public final class WorldUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FakePlayer getFakePlayer(ServerWorld world, @Nullable UUID owner) {
|
||||
if (owner != null) {
|
||||
PlayerProfileCache profileCache = world.getServer().getPlayerProfileCache();
|
||||
|
||||
GameProfile profile = profileCache.getProfileByUUID(owner);
|
||||
|
||||
if (profile != null) {
|
||||
return FakePlayerFactory.get(world, profile);
|
||||
}
|
||||
}
|
||||
|
||||
return FakePlayerFactory.getMinecraft(world);
|
||||
}
|
||||
|
||||
public static void sendNoPermissionMessage(PlayerEntity player) {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage:security.no_permission").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
}
|
||||
|
||||
@@ -1,95 +1,180 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {
|
||||
"front": "refinedstorage:blocks/destructor/destructor",
|
||||
"cutout": "refinedstorage:blocks/destructor/cutouts/disconnected"
|
||||
},
|
||||
"model": "refinedstorage:cable_core",
|
||||
"uvlock": true,
|
||||
"transform": "forge:default-block"
|
||||
},
|
||||
"variants": {
|
||||
"connected": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"cutout": "refinedstorage:blocks/destructor/cutouts/connected"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
"multipart": [
|
||||
{
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_core"
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"submodel": "refinedstorage:constructor_destructor"
|
||||
{
|
||||
"when": {
|
||||
"north": true
|
||||
},
|
||||
"east": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension"
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"east": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"y": 90
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": true
|
||||
},
|
||||
"south": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"west": true
|
||||
},
|
||||
"west": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"y": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"up": true
|
||||
},
|
||||
"up": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"down": true
|
||||
},
|
||||
"down": {
|
||||
"submodel": "refinedstorage:constructor_destructor",
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/cable_extension",
|
||||
"x": 90
|
||||
}
|
||||
},
|
||||
"north": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension"
|
||||
{
|
||||
"when": {
|
||||
"direction": "north",
|
||||
"connected": true
|
||||
},
|
||||
"false": {
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected"
|
||||
}
|
||||
},
|
||||
"east": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "east",
|
||||
"connected": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected",
|
||||
"y": 90
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"south": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "south",
|
||||
"connected": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected",
|
||||
"x": 180
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"west": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "west",
|
||||
"connected": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected",
|
||||
"y": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"up": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
{
|
||||
"when": {
|
||||
"direction": "up",
|
||||
"connected": true
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected",
|
||||
"x": 270
|
||||
},
|
||||
"false": {
|
||||
}
|
||||
},
|
||||
"down": {
|
||||
"true": {
|
||||
"submodel": "refinedstorage:cable_extension",
|
||||
"x": 90
|
||||
{
|
||||
"when": {
|
||||
"direction": "down",
|
||||
"connected": true
|
||||
},
|
||||
"false": {
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_connected",
|
||||
"x": 90
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "north",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected"
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "east",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected",
|
||||
"y": 90
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "south",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected",
|
||||
"x": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "west",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected",
|
||||
"y": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "up",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected",
|
||||
"x": 270
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"direction": "down",
|
||||
"connected": false
|
||||
},
|
||||
"apply": {
|
||||
"model": "refinedstorage:block/destructor_disconnected",
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
"gui.refinedstorage.importer": "Importer",
|
||||
"gui.refinedstorage.exporter": "Exporter",
|
||||
"gui.refinedstorage.detector": "Detector",
|
||||
"gui.refinedstorage:destructor": "Destructor",
|
||||
"gui.refinedstorage.destructor": "Destructor",
|
||||
"gui.refinedstorage.constructor": "Constructor",
|
||||
"gui.refinedstorage.relay": "Relay",
|
||||
"gui.refinedstorage.interface.import": "Interface Import",
|
||||
@@ -190,7 +190,7 @@
|
||||
"block.refinedstorage.exporter": "Exporter",
|
||||
"block.refinedstorage.detector": "Detector",
|
||||
"block.refinedstorage.machine_casing": "Machine Casing",
|
||||
"block.refinedstorage:destructor": "Destructor",
|
||||
"block.refinedstorage.destructor": "Destructor",
|
||||
"block.refinedstorage.constructor": "Constructor",
|
||||
"block.refinedstorage.1k_storage_block": "1k Storage Block",
|
||||
"block.refinedstorage.4k_storage_block": "4k Storage Block",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "refinedstorage:block/constructor_destructor",
|
||||
"textures": {
|
||||
"front": "refinedstorage:block/destructor/destructor",
|
||||
"cutout": "refinedstorage:block/destructor/cutouts/connected"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "refinedstorage:block/constructor_destructor",
|
||||
"textures": {
|
||||
"front": "refinedstorage:block/destructor/destructor",
|
||||
"cutout": "refinedstorage:block/destructor/cutouts/disconnected"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
{
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"cable": "refinedstorage:block/cable",
|
||||
"front": "refinedstorage:block/destructor/destructor",
|
||||
"cutout": "refinedstorage:block/destructor/cutouts/disconnected",
|
||||
"border": "refinedstorage:block/cable_part_border"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Core",
|
||||
"from": [
|
||||
6,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
10,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Part1",
|
||||
"from": [
|
||||
10,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
16,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"rotation": {
|
||||
"angle": 0,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
16,
|
||||
8,
|
||||
9
|
||||
]
|
||||
},
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Part2",
|
||||
"from": [
|
||||
0,
|
||||
6,
|
||||
6
|
||||
],
|
||||
"to": [
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"rotation": {
|
||||
"angle": 0,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
6,
|
||||
8,
|
||||
9
|
||||
]
|
||||
},
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
10,
|
||||
6,
|
||||
16,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
6,
|
||||
6,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
6,
|
||||
6,
|
||||
10
|
||||
],
|
||||
"texture": "#cable"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line1",
|
||||
"from": [
|
||||
7.0,
|
||||
7.0,
|
||||
2.0
|
||||
],
|
||||
"to": [
|
||||
9.0,
|
||||
9.0,
|
||||
6.0
|
||||
],
|
||||
"faces": {
|
||||
"east": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
4.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"up": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
4.0
|
||||
]
|
||||
},
|
||||
"down": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
4.0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line2",
|
||||
"from": [
|
||||
2.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
14.0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#front",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
16.0,
|
||||
16.0
|
||||
]
|
||||
},
|
||||
"east": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
14.0,
|
||||
0.0,
|
||||
16.0,
|
||||
16.0
|
||||
]
|
||||
},
|
||||
"south": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
16.0,
|
||||
16.0
|
||||
]
|
||||
},
|
||||
"west": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
2.0,
|
||||
16.0
|
||||
]
|
||||
},
|
||||
"up": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
2.0,
|
||||
0.0,
|
||||
14.0,
|
||||
2.0
|
||||
]
|
||||
},
|
||||
"down": {
|
||||
"texture": "#border",
|
||||
"uv": [
|
||||
2.0,
|
||||
14.0,
|
||||
14.0,
|
||||
16.0
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line3",
|
||||
"from": [
|
||||
2.0,
|
||||
2.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
14.0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"texture": "#cutout",
|
||||
"uv": [
|
||||
0.0,
|
||||
0.0,
|
||||
16.0,
|
||||
16.0
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "refinedstorage:destructor"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
"item": "refinedstorage:quartz_enriched_iron"
|
||||
},
|
||||
"D": {
|
||||
"item": "#destruction_core"
|
||||
"item": "refinedstorage:destruction_core"
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone"
|
||||
@@ -19,7 +19,7 @@
|
||||
"item": "refinedstorage:cable"
|
||||
},
|
||||
"I": {
|
||||
"item": "#improved_processor"
|
||||
"item": "refinedstorage:improved_processor"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
Reference in New Issue
Block a user