work 28-04-16

This commit is contained in:
Raoul Van den Berge
2016-04-28 20:49:19 +02:00
parent f34806ad54
commit a0521a0fda
29 changed files with 29 additions and 288 deletions

View File

@@ -19,7 +19,5 @@ public final class RefinedStorageBlocks {
public static final BlockRelay RELAY = new BlockRelay();
public static final BlockInterface INTERFACE = new BlockInterface();
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
public static final BlockCraftingCPU CRAFTING_CPU = new BlockCraftingCPU();
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
public static final BlockCraftingUnit CRAFTING_UNIT = new BlockCraftingUnit();
}

View File

@@ -1,60 +0,0 @@
package refinedstorage.block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import refinedstorage.item.ItemBlockBase;
import refinedstorage.item.ItemBlockStorage;
import refinedstorage.tile.autocrafting.TileCraftingCPU;
import java.util.List;
public class BlockCraftingCPU extends BlockMachine {
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumCraftingCPUType.class);
public BlockCraftingCPU() {
super("crafting_cpu");
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
for (int i = 0; i <= 3; ++i) {
subItems.add(ItemBlockStorage.initNBT(new ItemStack(item, 1, i)));
}
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[]{
DIRECTION,
CONNECTED,
TYPE
});
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(TYPE, EnumCraftingCPUType.getById(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumCraftingCPUType) state.getValue(TYPE)).getId();
}
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileCraftingCPU();
}
@Override
public Item createItemForBlock() {
return new ItemBlockBase(this, true);
}
}

View File

@@ -1,7 +0,0 @@
package refinedstorage.block;
public class BlockCraftingUnit extends BlockBase {
public BlockCraftingUnit() {
super("crafting_unit");
}
}

View File

@@ -1,41 +0,0 @@
package refinedstorage.block;
import net.minecraft.util.IStringSerializable;
public enum EnumCraftingCPUType implements IStringSerializable {
TYPE_1K(0, "1k"),
TYPE_4K(1, "4k"),
TYPE_16K(2, "16k"),
TYPE_64K(3, "64k");
private int id;
private String name;
EnumCraftingCPUType(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 EnumCraftingCPUType getById(int id) {
for (EnumCraftingCPUType type : EnumCraftingCPUType.values()) {
if (type.getId() == id) {
return type;
}
}
return TYPE_1K;
}
}

View File

@@ -53,8 +53,8 @@ public class GuiStorage extends GuiBase {
priorityField.setEnableBackgroundDrawing(false);
priorityField.setVisible(true);
priorityField.setTextColor(16777215);
priorityField.setCanLoseFocus(false);
priorityField.setFocused(true);
priorityField.setCanLoseFocus(true);
priorityField.setFocused(false);
}
@Override
@@ -92,6 +92,13 @@ public class GuiStorage extends GuiBase {
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
priorityField.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
protected void keyTyped(char character, int keyCode) throws IOException {
if (!checkHotbarKeys(keyCode) && priorityField.textboxKeyTyped(character, keyCode)) {

View File

@@ -10,7 +10,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import refinedstorage.RefinedStorageBlocks;
import refinedstorage.RefinedStorageItems;
import refinedstorage.block.EnumControllerType;
import refinedstorage.block.EnumCraftingCPUType;
import refinedstorage.block.EnumGridType;
import refinedstorage.block.EnumStorageType;
import refinedstorage.item.*;
@@ -119,23 +118,10 @@ public class ClientProxy extends CommonProxy {
.build()
);
ModelLoader.setCustomStateMapper(RefinedStorageBlocks.CRAFTING_CPU, (new StateMap.Builder())
.ignore(RefinedStorageBlocks.CRAFTING_CPU.DIRECTION)
.ignore(RefinedStorageBlocks.CRAFTING_CPU.CONNECTED)
.build()
);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.STORAGE), EnumStorageType.TYPE_1K.getId(), new ModelResourceLocation("refinedstorage:storage", "type=1k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.STORAGE), EnumStorageType.TYPE_4K.getId(), new ModelResourceLocation("refinedstorage:storage", "type=4k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.STORAGE), EnumStorageType.TYPE_16K.getId(), new ModelResourceLocation("refinedstorage:storage", "type=16k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.STORAGE), EnumStorageType.TYPE_64K.getId(), new ModelResourceLocation("refinedstorage:storage", "type=64k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.STORAGE), EnumStorageType.TYPE_CREATIVE.getId(), new ModelResourceLocation("refinedstorage:storage", "type=creative"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CRAFTING_UNIT), 0, new ModelResourceLocation("refinedstorage:crafting_unit", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CRAFTING_CPU), EnumCraftingCPUType.TYPE_1K.getId(), new ModelResourceLocation("refinedstorage:crafting_cpu", "type=1k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CRAFTING_CPU), EnumCraftingCPUType.TYPE_4K.getId(), new ModelResourceLocation("refinedstorage:crafting_cpu", "type=4k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CRAFTING_CPU), EnumCraftingCPUType.TYPE_16K.getId(), new ModelResourceLocation("refinedstorage:crafting_cpu", "type=16k"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RefinedStorageBlocks.CRAFTING_CPU), EnumCraftingCPUType.TYPE_64K.getId(), new ModelResourceLocation("refinedstorage:crafting_cpu", "type=64k"));
}
}

View File

@@ -20,7 +20,6 @@ import refinedstorage.item.*;
import refinedstorage.network.*;
import refinedstorage.storage.NBTStorage;
import refinedstorage.tile.*;
import refinedstorage.tile.autocrafting.TileCraftingCPU;
import refinedstorage.tile.autocrafting.TileCraftingMonitor;
import refinedstorage.tile.grid.TileGrid;
import refinedstorage.tile.solderer.*;
@@ -68,7 +67,6 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileRelay.class, ID + ":relay");
GameRegistry.registerTileEntity(TileInterface.class, ID + ":interface");
GameRegistry.registerTileEntity(TileCraftingMonitor.class, ID + ":crafting_monitor");
GameRegistry.registerTileEntity(TileCraftingCPU.class, ID + ":crafting_cpu");
GameRegistry.registerTileEntity(TileWirelessTransmitter.class, ID + ":wireless_transmitter");
registerBlock(RefinedStorageBlocks.CONTROLLER);
@@ -87,9 +85,7 @@ public class CommonProxy {
registerBlock(RefinedStorageBlocks.RELAY);
registerBlock(RefinedStorageBlocks.INTERFACE);
registerBlock(RefinedStorageBlocks.CRAFTING_MONITOR);
registerBlock(RefinedStorageBlocks.CRAFTING_CPU);
registerBlock(RefinedStorageBlocks.WIRELESS_TRANSMITTER);
registerBlock(RefinedStorageBlocks.CRAFTING_UNIT);
registerItem(RefinedStorageItems.STORAGE_DISK);
registerItem(RefinedStorageItems.PATTERN);
@@ -395,24 +391,6 @@ public class CommonProxy {
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_16K, ItemStoragePart.TYPE_16K));
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_64K, ItemStoragePart.TYPE_64K));
// Crafting Unit
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.CRAFTING_UNIT),
"ECE",
"PMP",
"EDE",
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
);
// Crafting CPUs
SoldererRegistry.addRecipe(new SoldererRecipeCraftingCPU(EnumCraftingCPUType.TYPE_1K, ItemStoragePart.TYPE_1K));
SoldererRegistry.addRecipe(new SoldererRecipeCraftingCPU(EnumCraftingCPUType.TYPE_4K, ItemStoragePart.TYPE_4K));
SoldererRegistry.addRecipe(new SoldererRecipeCraftingCPU(EnumCraftingCPUType.TYPE_16K, ItemStoragePart.TYPE_16K));
SoldererRegistry.addRecipe(new SoldererRecipeCraftingCPU(EnumCraftingCPUType.TYPE_64K, ItemStoragePart.TYPE_64K));
// Crafting Monitor
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.CRAFTING_MONITOR),
"EGE",

View File

@@ -70,6 +70,8 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
private boolean destroyed = false;
private long lastEnergyRerender;
private boolean machinesHavePosition(List<TileMachine> tiles, BlockPos pos) {
for (TileEntity tile : tiles) {
if (tile.getPos().getX() == pos.getX() && tile.getPos().getY() == pos.getY() && tile.getPos().getZ() == pos.getZ()) {
@@ -515,7 +517,9 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
energy.setEnergyStored(buf.readInt());
if (lastEnergy != energy.getEnergyStored()) {
if (lastEnergy != energy.getEnergyStored() && System.currentTimeMillis() - lastEnergyRerender > 3000) {
lastEnergyRerender = System.currentTimeMillis();
worldObj.notifyBlockUpdate(pos, worldObj.getBlockState(pos), worldObj.getBlockState(pos), 2 | 4);
}
}

View File

@@ -45,17 +45,25 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
if (newRecipe == null) {
reset();
} else if (newRecipe != recipe && inventory.getStackInSlot(3) == null) {
recipe = newRecipe;
progress = 0;
working = true;
} else if (newRecipe != recipe) {
boolean isSameItem = inventory.getStackInSlot(3) != null ? InventoryUtils.compareStackNoQuantity(inventory.getStackInSlot(3), newRecipe.getResult()) : false;
markDirty();
if (inventory.getStackInSlot(3) == null || (isSameItem && ((inventory.getStackInSlot(3).stackSize + newRecipe.getResult().stackSize) < inventory.getStackInSlot(3).getMaxStackSize()))) {
recipe = newRecipe;
progress = 0;
working = true;
markDirty();
}
} else if (working) {
progress++;
if (progress == recipe.getDuration()) {
inventory.setInventorySlotContents(3, recipe.getResult());
if (inventory.getStackInSlot(3) != null) {
inventory.getStackInSlot(3).stackSize += recipe.getResult().stackSize;
} else {
inventory.setInventorySlotContents(3, recipe.getResult());
}
for (int i = 0; i < 3; ++i) {
if (recipe.getRow(i) != null) {

View File

@@ -1,20 +0,0 @@
package refinedstorage.tile.autocrafting;
import net.minecraft.inventory.Container;
import refinedstorage.tile.TileMachine;
public class TileCraftingCPU extends TileMachine {
@Override
public int getEnergyUsage() {
return 0;
}
@Override
public void updateMachine() {
}
@Override
public Class<? extends Container> getContainer() {
return null;
}
}

View File

@@ -1,41 +0,0 @@
package refinedstorage.tile.solderer;
import net.minecraft.item.ItemStack;
import refinedstorage.RefinedStorageBlocks;
import refinedstorage.RefinedStorageItems;
import refinedstorage.block.EnumCraftingCPUType;
import refinedstorage.item.ItemBlockStorage;
import refinedstorage.item.ItemProcessor;
public class SoldererRecipeCraftingCPU implements ISoldererRecipe {
private EnumCraftingCPUType type;
private int storagePart;
public SoldererRecipeCraftingCPU(EnumCraftingCPUType type, int storagePart) {
this.type = type;
this.storagePart = storagePart;
}
@Override
public ItemStack getRow(int row) {
if (row == 0) {
return new ItemStack(RefinedStorageItems.STORAGE_PART, 1, storagePart);
} else if (row == 1) {
return new ItemStack(RefinedStorageBlocks.CRAFTING_UNIT);
} else if (row == 2) {
return new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
}
return null;
}
@Override
public ItemStack getResult() {
return ItemBlockStorage.initNBT(new ItemStack(RefinedStorageBlocks.CRAFTING_CPU, 1, type.getId()));
}
@Override
public int getDuration() {
return 200;
}
}

View File

@@ -1,31 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"transform": "forge:default-block"
},
"variants": {
"type": {
"1k": {
"textures": {
"all": "refinedstorage:blocks/1k_crafting_cpu"
}
},
"4k": {
"textures": {
"all": "refinedstorage:blocks/4k_crafting_cpu"
}
},
"16k": {
"textures": {
"all": "refinedstorage:blocks/16k_crafting_cpu"
}
},
"64k": {
"textures": {
"all": "refinedstorage:blocks/64k_crafting_cpu"
}
}
}
}
}

View File

@@ -1,30 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"textures": {
"all": "refinedstorage:blocks/crafting_unit"
}
},
"variants": {
"inventory": [
{
"transform": "forge:default-block"
}
],
"direction": {
"north": {
},
"east": {
},
"south": {
},
"west": {
},
"up": {
},
"down": {
}
}
}
}

View File

@@ -97,11 +97,6 @@ block.refinedstorage:storage.4.name=Creative Storage Block
block.refinedstorage:relay.name=Relay
block.refinedstorage:interface.name=Interface
block.refinedstorage:crafting_monitor.name=Crafting Monitor
block.refinedstorage:crafting_unit.name=Crafting Unit
block.refinedstorage:crafting_cpu.0.name=1k Crafting CPU
block.refinedstorage:crafting_cpu.1.name=4k Crafting CPU
block.refinedstorage:crafting_cpu.2.name=16k Crafting CPU
block.refinedstorage:crafting_cpu.3.name=64k Crafting CPU
block.refinedstorage:wireless_transmitter.name=Wireless Transmitter
item.refinedstorage:storage_disk.0.name=1k Storage Disk

View File

@@ -97,11 +97,6 @@ block.refinedstorage:storage.4.name=Creative Opslag Blok
block.refinedstorage:relay.name=Relais
block.refinedstorage:interface.name=Interface
block.refinedstorage:crafting_monitor.name=Crafting Monitor
block.refinedstorage:crafting_unit.name=Crafting Eenheid
block.refinedstorage:crafting_cpu.0.name=1k Crafting CPU
block.refinedstorage:crafting_cpu.1.name=4k Crafting CPU
block.refinedstorage:crafting_cpu.2.name=16k Crafting CPU
block.refinedstorage:crafting_cpu.3.name=64k Crafting CPU
block.refinedstorage:wireless_transmitter.name=Draadloze Zender
item.refinedstorage:storage_disk.0.name=1k Opslagschijf

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B