Implement controller block (only the block) and machine casing

This commit is contained in:
raoulvdberge
2019-09-18 21:27:29 +02:00
parent da5ecdae47
commit b57e4dcacd
43 changed files with 506 additions and 547 deletions

View File

@@ -0,0 +1,58 @@
package com.raoulvdberge.refinedstorage;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import net.minecraftforge.common.ForgeConfigSpec;
import java.nio.file.Paths;
public class Config {
private ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
private ForgeConfigSpec spec;
private Controller controller;
public Config() {
controller = new Controller();
spec = builder.build();
spec.setConfig(CommentedFileConfig.builder(Paths.get("config", "refinedstorage.toml")).build());
}
public Controller getController() {
return controller;
}
public class Controller {
private final ForgeConfigSpec.IntValue baseUsage;
private final ForgeConfigSpec.IntValue maxReceive;
private final ForgeConfigSpec.IntValue capacity;
private final ForgeConfigSpec.BooleanValue useEnergy;
public Controller() {
builder.push("controller");
baseUsage = builder.comment("The base energy used by the Controller").defineInRange("baseUsage", 0, 0, Integer.MAX_VALUE);
maxReceive = builder.comment("The maximum energy the Controller receives per tick").defineInRange("maxReceive", Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
capacity = builder.comment("The energy capacity of the Controller").defineInRange("capacity", 32000, 0, Integer.MAX_VALUE);
useEnergy = builder.comment("Whether the Controller uses energy").define("useEnergy", true);
builder.pop();
}
public int getBaseUsage() {
return baseUsage.get();
}
public int getMaxReceive() {
return maxReceive.get();
}
public int getCapacity() {
return capacity.get();
}
public boolean getUseEnergy() {
return useEnergy.get();
}
}
}

View File

@@ -5,13 +5,17 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.FluidStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.ItemStorageType;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskFactoryFluid;
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.StorageDiskFactoryItem;
import com.raoulvdberge.refinedstorage.block.ControllerBlock;
import com.raoulvdberge.refinedstorage.block.MachineCasingBlock;
import com.raoulvdberge.refinedstorage.block.QuartzEnrichedIronBlock;
import com.raoulvdberge.refinedstorage.container.ContainerFilter;
import com.raoulvdberge.refinedstorage.item.*;
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
import com.raoulvdberge.refinedstorage.recipe.UpgradeWithEnchantedBookRecipeSerializer;
import com.raoulvdberge.refinedstorage.screen.FilterScreen;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import com.raoulvdberge.refinedstorage.util.BlockUtils;
import net.minecraft.block.Block;
import net.minecraft.client.gui.ScreenManager;
@@ -19,6 +23,7 @@ import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -32,15 +37,17 @@ public final class RS {
public static final String ID = "refinedstorage";
public static RS INSTANCE;
public RSConfig config;
public RSOldConfig config = new RSOldConfig();
public static final NetworkHandler NETWORK_HANDLER = new NetworkHandler();
public static final ItemGroup MAIN_GROUP = new MainItemGroup();
public static final Config CONFIG = new Config();
public RS() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onCommonSetup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Block.class, this::onRegisterBlocks);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(TileEntityType.class, this::onRegisterTiles);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, this::onRegisterItems);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(IRecipeSerializer.class, this::onRegisterRecipeSerializers);
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(ContainerType.class, this::onRegisterContainers);
@@ -67,6 +74,15 @@ public final class RS {
@SubscribeEvent
public void onRegisterBlocks(RegistryEvent.Register<Block> e) {
e.getRegistry().register(new QuartzEnrichedIronBlock());
e.getRegistry().register(new ControllerBlock(ControllerBlock.Type.NORMAL));
e.getRegistry().register(new ControllerBlock(ControllerBlock.Type.CREATIVE));
e.getRegistry().register(new MachineCasingBlock());
}
@SubscribeEvent
public void onRegisterTiles(RegistryEvent.Register<TileEntityType<?>> e) {
e.getRegistry().register(TileEntityType.Builder.create(() -> new ControllerTile(ControllerBlock.Type.NORMAL), RSBlocks.CONTROLLER).build(null).setRegistryName(RS.ID, "controller"));
e.getRegistry().register(TileEntityType.Builder.create(() -> new ControllerTile(ControllerBlock.Type.CREATIVE), RSBlocks.CREATIVE_CONTROLLER).build(null).setRegistryName(RS.ID, "creative_controller"));
}
@SubscribeEvent
@@ -118,6 +134,9 @@ public final class RS {
e.getRegistry().register(new FilterItem());
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.QUARTZ_ENRICHED_IRON));
e.getRegistry().register(new ControllerBlockItem(RSBlocks.CONTROLLER));
e.getRegistry().register(new ControllerBlockItem(RSBlocks.CREATIVE_CONTROLLER));
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.MACHINE_CASING));
}
/* TODO

View File

@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.block.*;
import net.minecraftforge.registries.ObjectHolder;
public final class RSBlocks {
public static final BlockController CONTROLLER = new BlockController();
public static final BlockCable CABLE = new BlockCable();
public static final BlockGrid GRID = new BlockGrid();
public static final BlockDiskDrive DISK_DRIVE = new BlockDiskDrive();
@@ -12,7 +11,6 @@ public final class RSBlocks {
public static final BlockImporter IMPORTER = new BlockImporter();
public static final BlockExporter EXPORTER = new BlockExporter();
public static final BlockDetector DETECTOR = new BlockDetector();
public static final BlockMachineCasing MACHINE_CASING = new BlockMachineCasing();
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
public static final BlockStorage STORAGE = new BlockStorage();
@@ -33,6 +31,14 @@ public final class RSBlocks {
@ObjectHolder(RS.ID + ":quartz_enriched_iron_block")
public static final QuartzEnrichedIronBlock QUARTZ_ENRICHED_IRON = null;
@ObjectHolder(RS.ID + ":machine_casing")
public static final MachineCasingBlock MACHINE_CASING = null;
@ObjectHolder(RS.ID + ":controller")
public static final ControllerBlock CONTROLLER = null;
@ObjectHolder(RS.ID + ":creative_controller")
public static final ControllerBlock CREATIVE_CONTROLLER = null;
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();

View File

@@ -1,17 +1,12 @@
package com.raoulvdberge.refinedstorage;
import net.minecraftforge.common.MinecraftForge;
import javax.annotation.Nullable;
import java.io.File;
public class RSConfig {
public class RSOldConfig {
// private Configuration config;
private RSConfig originalClientVersion;
private RSOldConfig originalClientVersion;
//region Energy
public int controllerBaseUsage;
public int controllerMaxReceive;
public int cableUsage;
public int constructorUsage;
public int crafterUsage;
@@ -43,11 +38,6 @@ public class RSConfig {
public int securityManagerPerSecurityCardUsage;
//endregion
//region Controller
public int controllerCapacity;
public boolean controllerUsesEnergy;
//endregion
//region Grid
public int maxRowsStretch;
public boolean largeFont;
@@ -131,25 +121,26 @@ public class RSConfig {
private static final String AUTOCRAFTING = "autocrafting";
//endregion
/*
public RSConfig(@Nullable RSConfig originalClientVersion, File configFile) {
this(originalClientVersion/*, new Configuration(configFile)*/);
this(originalClientVersion, new Configuration(configFile));
}
public RSConfig(@Nullable RSConfig originalClientVersion/*, Configuration config*/) {
public RSConfig(@Nullable RSConfig originalClientVersion, Configuration config) {
this.originalClientVersion = originalClientVersion;
// this.config = config;
MinecraftForge.EVENT_BUS.register(this);
// this.loadConfig();
}
}*/
/*public Configuration getConfig() {
return config;
}*/
@Nullable
public RSConfig getOriginalClientVersion() {
public RSOldConfig getOriginalClientVersion() {
return originalClientVersion;
}

View File

@@ -5,12 +5,18 @@ import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.registries.ObjectHolder;
public class RSTiles {
//@ObjectHolder(RS.ID + ":constructor")
public static final TileEntityType<TileConstructor> CONSTRUCTOR = null;
//@ObjectHolder(RS.ID + ":controller")
public static final TileEntityType<TileController> CONTROLLER = null;
@ObjectHolder(RS.ID + ":controller")
public static final TileEntityType<ControllerTile> CONTROLLER = null;
@ObjectHolder(RS.ID + ":creative_controller")
public static final TileEntityType<ControllerTile> CREATIVE_CONTROLLER = null;
//@ObjectHolder(RS.ID + ":crafter")
public static final TileEntityType<TileCrafter> CRAFTER = null;
//@ObjectHolder(RS.ID + ":crafter_manager")

View File

@@ -12,7 +12,7 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingTaskError;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.tile.TileController;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
@@ -31,7 +31,7 @@ public class CraftingManager implements ICraftingManager {
private static final String NBT_TASK_TYPE = "Type";
private static final String NBT_TASK_DATA = "Task";
private TileController network;
private ControllerTile network;
private Map<String, List<IItemHandlerModifiable>> containerInventories = new LinkedHashMap<>();
@@ -46,7 +46,7 @@ public class CraftingManager implements ICraftingManager {
private Set<ICraftingMonitorListener> listeners = new HashSet<>();
public CraftingManager(TileController network) {
public CraftingManager(ControllerTile network) {
this.network = network;
}

View File

@@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.block.info.BlockDirection;
import com.raoulvdberge.refinedstorage.block.info.IBlockInfo;
import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockBase;
import com.raoulvdberge.refinedstorage.item.blockitem.ItemBlockBase;
import com.raoulvdberge.refinedstorage.render.IModelRegistration;
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
import com.raoulvdberge.refinedstorage.util.CollisionUtils;

View File

@@ -1,106 +0,0 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.block.enums.ControllerEnergyType;
import com.raoulvdberge.refinedstorage.block.enums.ControllerType;
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockController;
import com.raoulvdberge.refinedstorage.tile.TileController;
import net.minecraft.item.Item;
import net.minecraft.state.EnumProperty;
import net.minecraft.util.BlockRenderLayer;
public class BlockController extends BlockNodeProxy {
public static final EnumProperty<ControllerType> TYPE = EnumProperty.create("type", ControllerType.class);
public static final EnumProperty<ControllerEnergyType> ENERGY_TYPE = EnumProperty.create("energy_type", ControllerEnergyType.class);
public BlockController() {
super(BlockInfoBuilder.forId("controller").tileEntity(TileController::new).create());
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
/*
@Override
@OnlyIn(Dist.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModelMeshDefinition(this, new ItemMeshDefinitionController());
modelRegistration.setStateMapper(this, new StateMap.Builder().ignore(TYPE).build());
modelRegistration.addBakedModelOverride(info.getId(), base -> new BakedModelFullbright(
base,
RS.ID + ":blocks/controller/cutouts/nearly_off",
RS.ID + ":blocks/controller/cutouts/nearly_on",
RS.ID + ":blocks/controller/cutouts/on"
));
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> items) {
items.add(ItemBlockController.createStack(new ItemStack(this, 1, 0), 0));
items.add(ItemBlockController.createStack(new ItemStack(this, 1, 0), RS.INSTANCE.config.controllerCapacity));
items.add(ItemBlockController.createStack(new ItemStack(this, 1, 1), 0));
}
@Override
protected BlockStateContainer createBlockState() {
return createBlockStateBuilder()
.add(TYPE)
.add(ENERGY_TYPE)
.build();
}
@Override
public BlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(TYPE, meta == 0 ? ControllerType.NORMAL : ControllerType.CREATIVE);
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(TYPE) == ControllerType.NORMAL ? 0 : 1;
}
@Override
public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) {
return super.getActualState(state, world, pos)
.withProperty(ENERGY_TYPE, ((TileController) world.getTileEntity(pos)).getEnergyType());
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
return openNetworkGui(RSGui.CONTROLLER, player, world, pos, side);
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
if (!world.isRemote) {
TileController controller = (TileController) world.getTileEntity(pos);
CompoundNBT tag = stack.getTagCompound();
if (tag != null && tag.hasKey(TileController.NBT_ENERGY)) {
controller.getEnergy().setStored(tag.getInteger(TileController.NBT_ENERGY));
}
}
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
ItemStack stack = new ItemStack(this, 1, getMetaFromState(state));
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().putInt(TileController.NBT_ENERGY, ((TileController) world.getTileEntity(pos)).getEnergy().getStored());
drops.add(stack);
}*/
@Override
public Item createItem() {
return new ItemBlockController(this);
}
}

View File

@@ -1,15 +0,0 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
public class BlockMachineCasing extends BlockBase {
public BlockMachineCasing() {
super(BlockInfoBuilder.forId("machine_casing").create());
}
/* TODO
@Override
@OnlyIn(Dist.CLIENT)
public void registerModels(IModelRegistration modelRegistration) {
modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory"));
} */
}

View File

@@ -0,0 +1,116 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import com.raoulvdberge.refinedstorage.util.BlockUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.world.IBlockReader;
import javax.annotation.Nullable;
// TODO - Fullbright models
public class ControllerBlock extends Block {
public enum Type {
NORMAL,
CREATIVE
}
public enum EnergyType implements IStringSerializable {
OFF("off"),
NEARLY_OFF("nearly_off"),
NEARLY_ON("nearly_on"),
ON("on");
private String name;
EnergyType(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
@Override
public String toString() {
return name;
}
}
public static final EnumProperty<EnergyType> ENERGY_TYPE = EnumProperty.create("energy_type", EnergyType.class);
private Type type;
public ControllerBlock(Type type) {
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
this.type = type;
this.setRegistryName(RS.ID, type == Type.CREATIVE ? "creative_controller" : "controller");
this.setDefaultState(getStateContainer().getBaseState().with(ENERGY_TYPE, EnergyType.OFF));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(ENERGY_TYPE);
}
public Type getType() {
return type;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new ControllerTile(type);
}
/*
@Override
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) {
return openNetworkGui(RSGui.CONTROLLER, player, world, pos, side);
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
if (!world.isRemote) {
TileController controller = (TileController) world.getTileEntity(pos);
CompoundNBT tag = stack.getTagCompound();
if (tag != null && tag.hasKey(TileController.NBT_ENERGY)) {
controller.getEnergy().setStored(tag.getInteger(TileController.NBT_ENERGY));
}
}
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
ItemStack stack = new ItemStack(this, 1, getMetaFromState(state));
stack.setTagCompound(new CompoundNBT());
stack.getTagCompound().putInt(TileController.NBT_ENERGY, ((TileController) world.getTileEntity(pos)).getEnergy().getStored());
drops.add(stack);
}*/
}

View File

@@ -0,0 +1,13 @@
package com.raoulvdberge.refinedstorage.block;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.util.BlockUtils;
import net.minecraft.block.Block;
public class MachineCasingBlock extends Block {
public MachineCasingBlock() {
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
this.setRegistryName(RS.ID, "machine_casing");
}
}

View File

@@ -1,42 +0,0 @@
package com.raoulvdberge.refinedstorage.block.enums;
import net.minecraft.util.IStringSerializable;
public enum ControllerEnergyType implements IStringSerializable {
OFF(0, "off"),
NEARLY_OFF(1, "nearly_off"),
NEARLY_ON(2, "nearly_on"),
ON(3, "on");
private int id;
private String name;
ControllerEnergyType(int id, String name) {
this.id = id;
this.name = name;
}
@Override
public String getName() {
return name;
}
public int getId() {
return id;
}
@Override
public String toString() {
return name;
}
public static ControllerEnergyType getById(int id) {
for (ControllerEnergyType type : values()) {
if (type.id == id) {
return type;
}
}
return OFF;
}
}

View File

@@ -1,30 +0,0 @@
package com.raoulvdberge.refinedstorage.block.enums;
import net.minecraft.util.IStringSerializable;
public enum ControllerType implements IStringSerializable {
NORMAL(0, "normal"),
CREATIVE(1, "creative");
private int id;
private String name;
ControllerType(int id, String name) {
this.id = id;
this.name = name;
}
@Override
public String getName() {
return name;
}
public int getId() {
return id;
}
@Override
public String toString() {
return name;
}
}

View File

@@ -1,11 +1,11 @@
package com.raoulvdberge.refinedstorage.container;
import com.raoulvdberge.refinedstorage.RSContainers;
import com.raoulvdberge.refinedstorage.tile.TileController;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import net.minecraft.entity.player.PlayerEntity;
public class ContainerController extends ContainerBase {
public ContainerController(TileController controller, PlayerEntity player, int windowId) {
public ContainerController(ControllerTile controller, PlayerEntity player, int windowId) {
super(RSContainers.CONTROLLER, controller, player, windowId);
addPlayerInventory(8, 99);

View File

@@ -0,0 +1,75 @@
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.block.ControllerBlock;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
// TODO: Convert to energy cap.
public class ControllerBlockItem extends BlockItem {
private ControllerBlock controller;
public ControllerBlockItem(ControllerBlock block) {
super(block, new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1));
this.controller = block;
this.setRegistryName(block.getRegistryName());
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - ((double) getEnergyStored(stack) / (double) RS.CONFIG.getController().getCapacity());
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return MathHelper.hsvToRGB(Math.max(0.0F, (float) getEnergyStored(stack) / (float) RS.CONFIG.getController().getCapacity()) / 3.0F, 1.0F, 1.0F);
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return controller.getType() != ControllerBlock.Type.CREATIVE;
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (controller.getType() != ControllerBlock.Type.CREATIVE) {
tooltip.add(new TranslationTextComponent("misc.refinedstorage.energy_stored", getEnergyStored(stack), RS.CONFIG.getController().getCapacity()).setStyle(new Style().setColor(TextFormatting.GRAY)));
}
}
public static int getEnergyStored(ItemStack stack) {
return (stack.hasTag() && stack.getTag().contains(ControllerTile.NBT_ENERGY)) ? stack.getTag().getInt(ControllerTile.NBT_ENERGY) : 0;
}
@Override
public void onCreated(ItemStack stack, World world, PlayerEntity player) {
super.onCreated(stack, world, player);
CompoundNBT tag = stack.getTag();
if (tag == null) {
tag = new CompoundNBT();
}
tag.putInt(ControllerTile.NBT_ENERGY, 0);
stack.setTag(tag);
}
}

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.block.BlockBase;
import net.minecraft.item.BlockItem;

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.block.BlockBase;
import com.raoulvdberge.refinedstorage.item.capabilityprovider.CapabilityProviderEnergy;

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.block.BlockFluidStorage;

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.block.BlockPortableGrid;

View File

@@ -1,4 +1,4 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
package com.raoulvdberge.refinedstorage.item.blockitem;
import com.raoulvdberge.refinedstorage.block.BlockStorage;

View File

@@ -1,7 +1,7 @@
package com.raoulvdberge.refinedstorage.item.group;
import com.raoulvdberge.refinedstorage.RS;
import net.minecraft.block.Blocks;
import com.raoulvdberge.refinedstorage.RSBlocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@@ -12,6 +12,6 @@ public class MainItemGroup extends ItemGroup {
@Override
public ItemStack createIcon() {
return new ItemStack(Blocks.DIRT);
return new ItemStack(RSBlocks.CREATIVE_CONTROLLER);
}
}

View File

@@ -1,60 +0,0 @@
package com.raoulvdberge.refinedstorage.item.itemblock;
import com.raoulvdberge.refinedstorage.block.BlockController;
public class ItemBlockController extends ItemBlockBase {
public ItemBlockController(BlockController block) {
super(block);
// setMaxStackSize(1);
}
/* TODO
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return 1D - ((double) getEnergyStored(stack) / (double) RS.INSTANCE.config.controllerCapacity);
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
return MathHelper.hsvToRGB(Math.max(0.0F, (float) getEnergyStored(stack) / (float) RS.INSTANCE.config.controllerCapacity) / 3.0F, 1.0F, 1.0F);
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return stack.getMetadata() != ControllerType.CREATIVE.getId();
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
if (stack.getMetadata() != ControllerType.CREATIVE.getId()) {
tooltip.add(I18n.format("misc.refinedstorage.energy_stored", getEnergyStored(stack), RS.INSTANCE.config.controllerCapacity));
}
}
public static int getEnergyStored(ItemStack stack) {
return (stack.hasTagCompound() && stack.getTagCompound().hasKey(TileController.NBT_ENERGY)) ? stack.getTagCompound().getInteger(TileController.NBT_ENERGY) : 0;
}
@Override
public void onCreated(ItemStack stack, World world, PlayerEntity player) {
super.onCreated(stack, world, player);
createStack(stack, 0);
}
public static ItemStack createStack(ItemStack stack, int energy) {
CompoundNBT tag = stack.getTagCompound();
if (tag == null) {
tag = new CompoundNBT();
}
tag.putInt(TileController.NBT_ENERGY, stack.getMetadata() == ControllerType.CREATIVE.getId() ? RS.INSTANCE.config.controllerCapacity : energy);
stack.setTagCompound(tag);
return stack;
}*/
}

View File

@@ -1,7 +1,7 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSConfig;
import com.raoulvdberge.refinedstorage.RSOldConfig;
import io.netty.buffer.ByteBuf;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;

View File

@@ -6,7 +6,7 @@ import com.raoulvdberge.refinedstorage.container.ContainerController;
import com.raoulvdberge.refinedstorage.screen.widget.ScrollbarWidget;
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.SideButtonRedstoneMode;
import com.raoulvdberge.refinedstorage.tile.ClientNode;
import com.raoulvdberge.refinedstorage.tile.TileController;
import com.raoulvdberge.refinedstorage.tile.ControllerTile;
import com.raoulvdberge.refinedstorage.util.RenderUtils;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
@@ -17,7 +17,7 @@ import java.util.List;
public class GuiController extends BaseScreen<ContainerController> {
private static final int VISIBLE_ROWS = 2;
private TileController controller;
private ControllerTile controller;
private int barX = 8;
private int barY = 20;
@@ -26,7 +26,7 @@ public class GuiController extends BaseScreen<ContainerController> {
private ScrollbarWidget scrollbar;
public GuiController(ContainerController container, TileController controller, PlayerInventory inventory) {
public GuiController(ContainerController container, ControllerTile controller, PlayerInventory inventory) {
super(container, 176, 181, inventory, null);
this.controller = controller;
@@ -36,7 +36,7 @@ public class GuiController extends BaseScreen<ContainerController> {
@Override
public void init(int x, int y) {
addSideButton(new SideButtonRedstoneMode(this, TileController.REDSTONE_MODE));
addSideButton(new SideButtonRedstoneMode(this, ControllerTile.REDSTONE_MODE));
}
@Override
@@ -53,14 +53,14 @@ public class GuiController extends BaseScreen<ContainerController> {
blit(x, y, 0, 0, xSize, ySize);
int barHeightNew = TileController.getEnergyScaled(TileController.ENERGY_STORED.getValue(), TileController.ENERGY_CAPACITY.getValue(), barHeight);
int barHeightNew = ControllerTile.getEnergyScaled(ControllerTile.ENERGY_STORED.getValue(), ControllerTile.ENERGY_CAPACITY.getValue(), barHeight);
blit(x + barX, y + barY + barHeight - barHeightNew, 178, barHeight - barHeightNew, barWidth, barHeightNew);
}
@Override
public void renderForeground(int mouseX, int mouseY) {
renderString(7, 7, I18n.format("gui.refinedstorage:controller." + controller.getControllerType().getId()));
// TODO renderString(7, 7, I18n.format("gui.refinedstorage:controller." + controller.getControllerType().getId()));
renderString(7, 87, I18n.format("container.inventory"));
int x = 33;
@@ -70,7 +70,7 @@ public class GuiController extends BaseScreen<ContainerController> {
RenderHelper.enableGUIStandardItemLighting();
List<ClientNode> nodes = TileController.NODES.getValue();
List<ClientNode> nodes = ControllerTile.NODES.getValue();
ClientNode nodeHovering = null;
@@ -114,12 +114,12 @@ public class GuiController extends BaseScreen<ContainerController> {
}
if (RenderUtils.inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
renderTooltip(mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage", TileController.ENERGY_USAGE.getValue()) + "\n" + I18n.format("misc.refinedstorage.energy_stored", TileController.ENERGY_STORED.getValue(), TileController.ENERGY_CAPACITY.getValue()));
renderTooltip(mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage", ControllerTile.ENERGY_USAGE.getValue()) + "\n" + I18n.format("misc.refinedstorage.energy_stored", ControllerTile.ENERGY_STORED.getValue(), ControllerTile.ENERGY_CAPACITY.getValue()));
}
}
private int getRows() {
return Math.max(0, (int) Math.ceil((float) TileController.NODES.getValue().size() / 2F));
return Math.max(0, (int) Math.ceil((float) ControllerTile.NODES.getValue().size() / 2F));
}
private String trimNameIfNeeded(boolean scaled, String name) {

View File

@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.tile;
import com.google.common.base.Preconditions;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSBlocks;
import com.raoulvdberge.refinedstorage.RSTiles;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingManager;
import com.raoulvdberge.refinedstorage.api.energy.IEnergy;
@@ -36,16 +35,13 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheFluid;
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheItem;
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageTrackerFluid;
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageTrackerItem;
import com.raoulvdberge.refinedstorage.block.BlockController;
import com.raoulvdberge.refinedstorage.block.enums.ControllerEnergyType;
import com.raoulvdberge.refinedstorage.block.enums.ControllerType;
import com.raoulvdberge.refinedstorage.block.ControllerBlock;
import com.raoulvdberge.refinedstorage.integration.forgeenergy.EnergyProxy;
import com.raoulvdberge.refinedstorage.tile.config.IRedstoneConfigurable;
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
import com.raoulvdberge.refinedstorage.tile.data.RSSerializers;
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import com.raoulvdberge.refinedstorage.util.WorldUtils;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -73,7 +69,7 @@ import java.util.function.Predicate;
import static com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY;
// TODO: Change INetwork to be offloaded from the tile.
public class TileController extends TileBase implements ITickableTileEntity, INetwork, IRedstoneConfigurable, INetworkNode, INetworkNodeProxy<TileController>, INetworkNodeVisitor {
public class ControllerTile extends TileBase implements ITickableTileEntity, INetwork, IRedstoneConfigurable, INetworkNode, INetworkNodeProxy<ControllerTile>, INetworkNodeVisitor {
private static final Comparator<ClientNode> CLIENT_NODE_COMPARATOR = (left, right) -> {
if (left.getEnergyUsage() == right.getEnergyUsage()) {
return 0;
@@ -82,11 +78,11 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
return (left.getEnergyUsage() > right.getEnergyUsage()) ? -1 : 1;
};
public static final TileDataParameter<Integer, TileController> REDSTONE_MODE = RedstoneMode.createParameter();
public static final TileDataParameter<Integer, TileController> ENERGY_USAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, TileController::getEnergyUsage);
public static final TileDataParameter<Integer, TileController> ENERGY_STORED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getEnergy().getStored());
public static final TileDataParameter<Integer, TileController> ENERGY_CAPACITY = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getEnergy().getCapacity());
public static final TileDataParameter<List<ClientNode>, TileController> NODES = new TileDataParameter<>(RSSerializers.CLIENT_NODE_SERIALIZER, new ArrayList<>(), t -> {
public static final TileDataParameter<Integer, ControllerTile> REDSTONE_MODE = RedstoneMode.createParameter();
public static final TileDataParameter<Integer, ControllerTile> ENERGY_USAGE = new TileDataParameter<>(DataSerializers.VARINT, 0, ControllerTile::getEnergyUsage);
public static final TileDataParameter<Integer, ControllerTile> ENERGY_STORED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getEnergy().getStored());
public static final TileDataParameter<Integer, ControllerTile> ENERGY_CAPACITY = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getEnergy().getCapacity());
public static final TileDataParameter<List<ClientNode>, ControllerTile> NODES = new TileDataParameter<>(RSSerializers.CLIENT_NODE_SERIALIZER, new ArrayList<>(), t -> {
List<ClientNode> nodes = new ArrayList<>();
for (INetworkNode node : t.nodeGraph.all()) {
@@ -142,23 +138,25 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
private IReaderWriterManager readerWriterManager = new ReaderWriterManager(this);
private final IEnergy energy = new Energy(RS.INSTANCE.config.controllerCapacity);
private final EnergyProxy energyProxy = new EnergyProxy(this.energy, RS.INSTANCE.config.controllerMaxReceive, 0);
private final IEnergy energy = new Energy(RS.CONFIG.getController().getCapacity());
private final EnergyProxy energyProxy = new EnergyProxy(this.energy, RS.CONFIG.getController().getMaxReceive());
private final LazyOptional<IEnergyStorage> energyProxyCap = LazyOptional.of(() -> energyProxy);
private final LazyOptional<INetworkNodeProxy<TileController>> networkNodeProxyCap = LazyOptional.of(() -> this);
private final LazyOptional<INetworkNodeProxy<ControllerTile>> networkNodeProxyCap = LazyOptional.of(() -> this);
private boolean throttlingDisabled = true; // Will be enabled after first update
private boolean couldRun;
private int ticksSinceUpdateChanged;
private ControllerType type;
private ControllerEnergyType energyType = ControllerEnergyType.OFF;
private ControllerBlock.Type type;
private ControllerBlock.EnergyType lastEnergyType = ControllerBlock.EnergyType.OFF;
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
public TileController() {
super(RSTiles.CONTROLLER);
public ControllerTile(ControllerBlock.Type type) {
super(type == ControllerBlock.Type.CREATIVE ? RSTiles.CREATIVE_CONTROLLER : RSTiles.CONTROLLER);
this.type = type;
dataManager.addWatchedParameter(REDSTONE_MODE);
dataManager.addWatchedParameter(ENERGY_USAGE);
@@ -177,7 +175,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
}
});
nodeGraph.addListener(() -> dataManager.sendParameterToWatchers(TileController.NODES));
nodeGraph.addListener(() -> dataManager.sendParameterToWatchers(ControllerTile.NODES));
}
@Override
@@ -223,15 +221,15 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
}
}
if (getControllerType() == ControllerType.NORMAL) {
if (!RS.INSTANCE.config.controllerUsesEnergy) {
if (type == ControllerBlock.Type.NORMAL) {
if (!RS.CONFIG.getController().getUseEnergy()) {
this.energy.setStored(this.energy.getCapacity());
} else if (this.energy.extract(getEnergyUsage(), Action.SIMULATE) >= 0) {
this.energy.extract(getEnergyUsage(), Action.PERFORM);
} else {
this.energy.setStored(0);
}
} else if (getControllerType() == ControllerType.CREATIVE) {
} else if (type == ControllerBlock.Type.CREATIVE) {
this.energy.setStored(this.energy.getCapacity());
}
@@ -252,12 +250,12 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
ticksSinceUpdateChanged = 0;
}
ControllerEnergyType energyType = getEnergyType();
ControllerBlock.EnergyType energyType = getEnergyType();
if (this.energyType != energyType) {
this.energyType = energyType;
if (lastEnergyType != energyType) {
lastEnergyType = energyType;
WorldUtils.updateBlock(world, pos);
world.setBlockState(pos, world.getBlockState(pos).with(ControllerBlock.ENERGY_TYPE, energyType));
}
}
}
@@ -561,7 +559,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
public CompoundNBT writeUpdate(CompoundNBT tag) {
super.writeUpdate(tag);
tag.putInt(NBT_ENERGY_TYPE, getEnergyType().getId());
tag.putInt(NBT_ENERGY_TYPE, getEnergyType().ordinal());
return tag;
}
@@ -569,7 +567,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
@Override
public void readUpdate(CompoundNBT tag) {
if (tag.contains(NBT_ENERGY_TYPE)) {
this.energyType = ControllerEnergyType.getById(tag.getInt(NBT_ENERGY_TYPE));
world.setBlockState(pos, world.getBlockState(pos).with(ControllerBlock.ENERGY_TYPE, ControllerBlock.EnergyType.values()[tag.getInt(NBT_ENERGY_TYPE)]));
}
super.readUpdate(tag);
@@ -579,32 +577,28 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
return (int) ((float) stored / (float) capacity * (float) scale);
}
public static ControllerEnergyType getEnergyType(int stored, int capacity) {
int energy = getEnergyScaled(stored, capacity, 100);
if (energy <= 0) {
return ControllerEnergyType.OFF;
} else if (energy <= 10) {
return ControllerEnergyType.NEARLY_OFF;
} else if (energy <= 20) {
return ControllerEnergyType.NEARLY_ON;
}
return ControllerEnergyType.ON;
}
public ControllerEnergyType getEnergyType() {
if (world.isRemote) {
return energyType;
}
private ControllerBlock.EnergyType getEnergyType() {
if (!redstoneMode.isEnabled(world, pos)) {
return ControllerEnergyType.OFF;
return ControllerBlock.EnergyType.OFF;
}
return getEnergyType(this.energy.getStored(), this.energy.getCapacity());
}
private static ControllerBlock.EnergyType getEnergyType(int stored, int capacity) {
int energy = getEnergyScaled(stored, capacity, 100);
if (energy <= 0) {
return ControllerBlock.EnergyType.OFF;
} else if (energy <= 10) {
return ControllerBlock.EnergyType.NEARLY_OFF;
} else if (energy <= 20) {
return ControllerBlock.EnergyType.NEARLY_ON;
}
return ControllerBlock.EnergyType.ON;
}
@Override
public RedstoneMode getRedstoneMode() {
return redstoneMode;
@@ -619,7 +613,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
@Override
public int getEnergyUsage() {
int usage = RS.INSTANCE.config.controllerBaseUsage;
int usage = RS.CONFIG.getController().getBaseUsage();
for (INetworkNode node : nodeGraph.all()) {
if (node.canUpdate()) {
@@ -665,18 +659,6 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
// This is update from INetworkNode
}
public ControllerType getControllerType() {
if (type == null) {
BlockState state = world.getBlockState(pos);
if (state.getBlock() == RSBlocks.CONTROLLER) {
this.type = state.get(BlockController.TYPE);
}
}
return type == null ? ControllerType.NORMAL : type;
}
@Nonnull
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) {
@@ -693,7 +675,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
@Override
@Nonnull
public TileController getNode() {
public ControllerTile getNode() {
return this;
}
@@ -724,7 +706,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
// Cannot use API#getNetworkNodeHashCode or API#isNetworkNodeEqual: it will crash with a AbstractMethodError (getPos).
@Override
public boolean equals(Object o) {
if (!(o instanceof TileController)) {
if (!(o instanceof ControllerTile)) {
return false;
}
@@ -732,7 +714,7 @@ public class TileController extends TileBase implements ITickableTileEntity, INe
return true;
}
TileController otherController = (TileController) o;
ControllerTile otherController = (ControllerTile) o;
if (world.getDimension().getType() != otherController.world.getDimension().getType()) {
return false;

View File

@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
import com.raoulvdberge.refinedstorage.tile.direction.DirectionHandlerTile;
import com.raoulvdberge.refinedstorage.tile.direction.IDirectionHandler;
import com.raoulvdberge.refinedstorage.util.WorldUtils;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
@@ -66,13 +65,13 @@ public abstract class TileBase extends TileEntity {
}
public void readUpdate(CompoundNBT tag) {
boolean doRender = canCauseRenderUpdate(tag);
/*boolean doRender = canCauseRenderUpdate(tag);
clientDirection = Direction.byIndex(tag.getInt(NBT_DIRECTION));
if (doRender) {
WorldUtils.updateBlock(world, pos);
}
}*/
}
protected boolean canCauseRenderUpdate(CompoundNBT tag) {

View File

@@ -22,6 +22,7 @@ import net.minecraftforge.items.wrapper.SidedInvWrapper;
import javax.annotation.Nullable;
public final class WorldUtils {
// TODO REMOVE. Can just use setBlockState now.
public static void updateBlock(@Nullable World world, BlockPos pos) {
if (world != null) {
BlockState state = world.getBlockState(pos);

View File

@@ -1,44 +1,16 @@
{
"forge_marker": 1,
"defaults": {
"model": "refinedstorage:cube_all_cutout",
"textures": {
"particle": "refinedstorage:blocks/controller/controller_off",
"all": "refinedstorage:blocks/controller/controller_off",
"cutout": "refinedstorage:blocks/controller/cutouts/off"
}
},
"variants": {
"inventory": [
{
"transform": "forge:default-block"
}
],
"energy_type": {
"off": {
},
"nearly_off": {
"model": "refinedstorage:controller_nearly_on_off",
"textures": {
"all": "refinedstorage:blocks/controller/controller",
"cutout": "refinedstorage:blocks/controller/cutouts/nearly_off",
"cutout_gray": "refinedstorage:blocks/controller/cutouts/nearly_off_gray"
}
},
"nearly_on": {
"model": "refinedstorage:controller_nearly_on_off",
"textures": {
"all": "refinedstorage:blocks/controller/controller",
"cutout": "refinedstorage:blocks/controller/cutouts/nearly_on",
"cutout_gray": "refinedstorage:blocks/controller/cutouts/nearly_on_gray"
}
},
"on": {
"textures": {
"all": "refinedstorage:blocks/controller/controller",
"cutout": "refinedstorage:blocks/controller/cutouts/on"
}
}
"energy_type=off": {
"model": "refinedstorage:block/controller/controller_off"
},
"energy_type=nearly_off": {
"model": "refinedstorage:block/controller/controller_nearly_off"
},
"energy_type=nearly_on": {
"model": "refinedstorage:block/controller/controller_nearly_on"
},
"energy_type=on": {
"model": "refinedstorage:block/controller/controller_on"
}
}
}
}

View File

@@ -0,0 +1,16 @@
{
"variants": {
"energy_type=off": {
"model": "refinedstorage:block/controller/controller_off"
},
"energy_type=nearly_off": {
"model": "refinedstorage:block/controller/controller_nearly_off"
},
"energy_type=nearly_on": {
"model": "refinedstorage:block/controller/controller_nearly_on"
},
"energy_type=on": {
"model": "refinedstorage:block/controller/controller_on"
}
}
}

View File

@@ -1,19 +1,7 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"textures": {
"all": "refinedstorage:blocks/machine_casing"
}
},
"variants": {
"inventory": [
{
"transform": "forge:default-block"
}
],
"normal": {
"model": "cube_all"
"": {
"model": "refinedstorage:block/machine_casing"
}
}
}

View File

@@ -176,8 +176,8 @@
"sidebutton.refinedstorage:access_type.0": "Insert and extract",
"sidebutton.refinedstorage:access_type.1": "Insert only",
"sidebutton.refinedstorage:access_type.2": "Extract only",
"block.refinedstorage:controller.0": "Controller",
"block.refinedstorage:controller.1": "Creative Controller",
"block.refinedstorage.controller": "Controller",
"block.refinedstorage.creative_controller": "Creative Controller",
"block.refinedstorage:cable": "Cable",
"block.refinedstorage:grid.0": "Grid",
"block.refinedstorage:grid.1": "Crafting Grid",
@@ -189,7 +189,7 @@
"block.refinedstorage:importer": "Importer",
"block.refinedstorage:exporter": "Exporter",
"block.refinedstorage:detector": "Detector",
"block.refinedstorage:machine_casing": "Machine Casing",
"block.refinedstorage.machine_casing": "Machine Casing",
"block.refinedstorage:destructor": "Destructor",
"block.refinedstorage:constructor": "Constructor",
"block.refinedstorage:storage.0": "1k Storage Block",

View File

@@ -0,0 +1,43 @@
{
"parent": "refinedstorage:block/cube_all_cutout",
"elements": [
{
"from": [
0,
0,
0
],
"to": [
16,
16,
16
],
"faces": {
"up": {
"texture": "#cutout_gray",
"cullface": "up"
},
"down": {
"texture": "#cutout_gray",
"cullface": "down"
},
"north": {
"texture": "#cutout_gray",
"cullface": "north"
},
"south": {
"texture": "#cutout_gray",
"cullface": "south"
},
"west": {
"texture": "#cutout_gray",
"cullface": "west"
},
"east": {
"texture": "#cutout_gray",
"cullface": "east"
}
}
}
]
}

View File

@@ -0,0 +1,9 @@
{
"parent": "refinedstorage:block/controller/controller_nearly",
"textures": {
"particle": "refinedstorage:block/controller/controller_off",
"all": "refinedstorage:block/controller/controller",
"cutout": "refinedstorage:block/controller/cutouts/nearly_off",
"cutout_gray": "refinedstorage:block/controller/cutouts/nearly_off_gray"
}
}

View File

@@ -0,0 +1,9 @@
{
"parent": "refinedstorage:block/controller/controller_nearly",
"textures": {
"particle": "refinedstorage:block/controller/controller_off",
"all": "refinedstorage:block/controller/controller",
"cutout": "refinedstorage:block/controller/cutouts/nearly_on",
"cutout_gray": "refinedstorage:block/controller/cutouts/nearly_on_gray"
}
}

View File

@@ -0,0 +1,8 @@
{
"parent": "refinedstorage:block/cube_all_cutout",
"textures": {
"particle": "refinedstorage:block/controller/controller_off",
"all": "refinedstorage:block/controller/controller_off",
"cutout": "refinedstorage:block/controller/cutouts/off"
}
}

View File

@@ -0,0 +1,8 @@
{
"parent": "refinedstorage:block/cube_all_cutout",
"textures": {
"particle": "refinedstorage:block/controller/controller_off",
"all": "refinedstorage:block/controller/controller",
"cutout": "refinedstorage:block/controller/cutouts/on"
}
}

View File

@@ -1,119 +0,0 @@
{
"parent": "block/cube",
"elements": [
{
"from": [
0,
0,
0
],
"to": [
16,
16,
16
],
"faces": {
"down": {
"texture": "#all",
"cullface": "down"
},
"up": {
"texture": "#all",
"cullface": "up"
},
"north": {
"texture": "#all",
"cullface": "north"
},
"south": {
"texture": "#all",
"cullface": "south"
},
"west": {
"texture": "#all",
"cullface": "west"
},
"east": {
"texture": "#all",
"cullface": "east"
}
}
},
{
"from": [
0,
0,
0
],
"to": [
16,
16,
16
],
"faces": {
"up": {
"texture": "#cutout",
"cullface": "up"
},
"down": {
"texture": "#cutout",
"cullface": "down"
},
"north": {
"texture": "#cutout",
"cullface": "north"
},
"south": {
"texture": "#cutout",
"cullface": "south"
},
"west": {
"texture": "#cutout",
"cullface": "west"
},
"east": {
"texture": "#cutout",
"cullface": "east"
}
}
},
{
"from": [
0,
0,
0
],
"to": [
16,
16,
16
],
"faces": {
"up": {
"texture": "#cutout_gray",
"cullface": "up"
},
"down": {
"texture": "#cutout_gray",
"cullface": "down"
},
"north": {
"texture": "#cutout_gray",
"cullface": "north"
},
"south": {
"texture": "#cutout_gray",
"cullface": "south"
},
"west": {
"texture": "#cutout_gray",
"cullface": "west"
},
"east": {
"texture": "#cutout_gray",
"cullface": "east"
}
}
}
]
}

View File

@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "refinedstorage:block/machine_casing"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/controller/controller_off"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/controller/controller_on"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "refinedstorage:block/machine_casing"
}

View File

@@ -10,18 +10,16 @@
"item": "refinedstorage:quartz_enriched_iron"
},
"P": {
"item": "#advanced_processor"
"item": "refinedstorage:advanced_processor"
},
"S": {
"type": "forge:ore_dict",
"ore": "itemSilicon"
"tag": "refinedstorage:silicons"
},
"M": {
"item": "refinedstorage:machine_casing"
}
},
"result": {
"item": "refinedstorage:controller",
"data": 0
"item": "refinedstorage:controller"
}
}

View File

@@ -10,8 +10,7 @@
"item": "refinedstorage:quartz_enriched_iron"
},
"S": {
"type": "forge:ore_dict",
"ore": "stone"
"tag": "forge:stone"
}
},
"result": {