finish controller
@@ -16,7 +16,7 @@ import storagecraft.tile.TileController;
|
||||
|
||||
public class BlockController extends BlockBase
|
||||
{
|
||||
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 15);
|
||||
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 8);
|
||||
|
||||
public BlockController()
|
||||
{
|
||||
@@ -37,7 +37,7 @@ public class BlockController extends BlockBase
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
return super.getActualState(state, world, pos)
|
||||
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaled(15));
|
||||
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaled(8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -106,5 +106,6 @@ public class ClientProxy extends CommonProxy
|
||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.IMPORTER), 0, new ModelResourceLocation("storagecraft:importer", "inventory"));
|
||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.EXTERNAL_STORAGE), 0, new ModelResourceLocation("storagecraft:external_storage", "inventory"));
|
||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.DRIVE), 0, new ModelResourceLocation("storagecraft:drive", "inventory"));
|
||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.CONTROLLER), 0, new ModelResourceLocation("storagecraft:controller", "inventory"));
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import storagecraft.StorageCraftBlocks;
|
||||
import storagecraft.storage.IStorage;
|
||||
import storagecraft.storage.IStorageProvider;
|
||||
import storagecraft.storage.StorageItem;
|
||||
@@ -27,7 +28,7 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
|
||||
private List<BlockPos> visitedCables = new ArrayList<BlockPos>();
|
||||
|
||||
private EnergyStorage energy = new EnergyStorage(32000);
|
||||
private EnergyStorage energy = new EnergyStorage(1000);
|
||||
private int energyUsage;
|
||||
|
||||
private boolean destroyed = false;
|
||||
@@ -44,6 +45,8 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
int lastEnergy = energy.getEnergyStored();
|
||||
|
||||
if (ticks % 40 == 0)
|
||||
{
|
||||
if (!isActive())
|
||||
@@ -111,6 +114,11 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
}
|
||||
|
||||
energy.extractEnergy(energyUsage, false);
|
||||
|
||||
if (lastEnergy != energy.getEnergyStored()) {
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
worldObj.updateComparatorOutputLevel(pos, StorageCraftBlocks.CONTROLLER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,8 +334,7 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return true;
|
||||
// @TODO: return energy.getEnergyStored() >= getEnergyUsage() && redstoneMode.isEnabled(worldObj, pos);
|
||||
return energy.getEnergyStored() >= getEnergyUsage() && redstoneMode.isEnabled(worldObj, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
88
src/main/resources/assets/storagecraft/blockstates/controller.json
Executable file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "orientable",
|
||||
"textures": {
|
||||
"side": "storagecraft:blocks/side",
|
||||
"top": "storagecraft:blocks/side",
|
||||
"front": "storagecraft:blocks/controller_0"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"y": 0
|
||||
}
|
||||
],
|
||||
"energy": {
|
||||
"0": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_0"
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_1"
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_2"
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_3"
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_4"
|
||||
}
|
||||
},
|
||||
"5": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_5"
|
||||
}
|
||||
},
|
||||
"6": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_6"
|
||||
}
|
||||
},
|
||||
"7": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_7"
|
||||
}
|
||||
},
|
||||
"8": {
|
||||
"textures": {
|
||||
"front": "storagecraft:blocks/controller_8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
},
|
||||
"up": {
|
||||
"x": 270
|
||||
},
|
||||
"down": {
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 387 B |