Implementing Crafting Upgrade.
This commit is contained in:
@@ -288,6 +288,8 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
|||||||
return Upgrades.SPEED;
|
return Upgrades.SPEED;
|
||||||
case CardInverter:
|
case CardInverter:
|
||||||
return Upgrades.INVERTER;
|
return Upgrades.INVERTER;
|
||||||
|
case CardCrafting:
|
||||||
|
return Upgrades.CRAFTING;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public enum MaterialType
|
|||||||
EnderDust(46, AEFeature.QuantumNetworkBridge, "dustEnder", EntitySingularity.class), Singularity(47, AEFeature.QuantumNetworkBridge,
|
EnderDust(46, AEFeature.QuantumNetworkBridge, "dustEnder", EntitySingularity.class), Singularity(47, AEFeature.QuantumNetworkBridge,
|
||||||
EntitySingularity.class), QESingularity(48, AEFeature.QuantumNetworkBridge, EntitySingularity.class),
|
EntitySingularity.class), QESingularity(48, AEFeature.QuantumNetworkBridge, EntitySingularity.class),
|
||||||
|
|
||||||
BlankPattern(52);
|
BlankPattern(52), CardCrafting(53);
|
||||||
|
|
||||||
private String oreName;
|
private String oreName;
|
||||||
private EnumSet<AEFeature> features;
|
private EnumSet<AEFeature> features;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
|||||||
private int RedstoneUpgrades = 0;
|
private int RedstoneUpgrades = 0;
|
||||||
private int CapacityUpgrades = 0;
|
private int CapacityUpgrades = 0;
|
||||||
private int InverterUpgrades = 0;
|
private int InverterUpgrades = 0;
|
||||||
|
private int CraftingUpgrades = 0;
|
||||||
|
|
||||||
public UpgradeInventory(Object itemOrBlock, IAEAppEngInventory _te, int s) {
|
public UpgradeInventory(Object itemOrBlock, IAEAppEngInventory _te, int s) {
|
||||||
super( null, s );
|
super( null, s );
|
||||||
@@ -98,7 +99,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
|||||||
private void updateUpgradeInfo()
|
private void updateUpgradeInfo()
|
||||||
{
|
{
|
||||||
cached = true;
|
cached = true;
|
||||||
InverterUpgrades = CapacityUpgrades = RedstoneUpgrades = SpeedUpgrades = FuzzyUpgrades = 0;
|
InverterUpgrades = CapacityUpgrades = RedstoneUpgrades = SpeedUpgrades = FuzzyUpgrades = CraftingUpgrades = 0;
|
||||||
|
|
||||||
for (ItemStack is : this)
|
for (ItemStack is : this)
|
||||||
{
|
{
|
||||||
@@ -123,6 +124,9 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
|||||||
case INVERTER:
|
case INVERTER:
|
||||||
InverterUpgrades++;
|
InverterUpgrades++;
|
||||||
break;
|
break;
|
||||||
|
case CRAFTING:
|
||||||
|
CraftingUpgrades++;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -133,6 +137,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
|||||||
RedstoneUpgrades = Math.min( RedstoneUpgrades, getMaxInstalled( Upgrades.REDSTONE ) );
|
RedstoneUpgrades = Math.min( RedstoneUpgrades, getMaxInstalled( Upgrades.REDSTONE ) );
|
||||||
SpeedUpgrades = Math.min( SpeedUpgrades, getMaxInstalled( Upgrades.SPEED ) );
|
SpeedUpgrades = Math.min( SpeedUpgrades, getMaxInstalled( Upgrades.SPEED ) );
|
||||||
InverterUpgrades = Math.min( InverterUpgrades, getMaxInstalled( Upgrades.INVERTER ) );
|
InverterUpgrades = Math.min( InverterUpgrades, getMaxInstalled( Upgrades.INVERTER ) );
|
||||||
|
CraftingUpgrades = Math.min( CraftingUpgrades, getMaxInstalled( Upgrades.CRAFTING ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInstalledUpgrades(Upgrades u)
|
public int getInstalledUpgrades(Upgrades u)
|
||||||
@@ -152,6 +157,8 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
|||||||
return SpeedUpgrades;
|
return SpeedUpgrades;
|
||||||
case INVERTER:
|
case INVERTER:
|
||||||
return InverterUpgrades;
|
return InverterUpgrades;
|
||||||
|
case CRAFTING:
|
||||||
|
return CraftingUpgrades;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package appeng.tile.crafting;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.implementations.IPowerChannelState;
|
import appeng.api.implementations.IPowerChannelState;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
@@ -15,6 +16,8 @@ import appeng.me.cluster.implementations.CraftingCPUCalculator;
|
|||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||||
import appeng.me.helpers.AENetworkProxy;
|
import appeng.me.helpers.AENetworkProxy;
|
||||||
import appeng.me.helpers.AENetworkProxyMultiblock;
|
import appeng.me.helpers.AENetworkProxyMultiblock;
|
||||||
|
import appeng.tile.events.AETileEventHandler;
|
||||||
|
import appeng.tile.events.TileEventType;
|
||||||
import appeng.tile.grid.AENetworkTile;
|
import appeng.tile.grid.AENetworkTile;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
@@ -25,6 +28,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
|||||||
final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
|
final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
|
||||||
public ISimplifiedBundle lightCache;
|
public ISimplifiedBundle lightCache;
|
||||||
|
|
||||||
|
public NBTTagCompound previousState = null;
|
||||||
|
public boolean isCoreBlock = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AENetworkProxy createProxy()
|
protected AENetworkProxy createProxy()
|
||||||
{
|
{
|
||||||
@@ -42,7 +48,38 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
|||||||
calc.calculateMultiblock( worldObj, getLocation() );
|
calc.calculateMultiblock( worldObj, getLocation() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CraftingHandler extends AETileEventHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
public CraftingHandler() {
|
||||||
|
super( TileEventType.WORLD_NBT );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
data.setBoolean( "core", isCoreBlock );
|
||||||
|
if ( isCoreBlock && clust != null )
|
||||||
|
clust.writeToNBT( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
isCoreBlock = data.getBoolean( "core" );
|
||||||
|
if ( isCoreBlock )
|
||||||
|
{
|
||||||
|
if ( clust != null )
|
||||||
|
clust.readFromNBT( data );
|
||||||
|
else
|
||||||
|
previousState = (NBTTagCompound) data.copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
public TileCraftingTile() {
|
public TileCraftingTile() {
|
||||||
|
addNewHandler( new CraftingHandler() );
|
||||||
gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
|
gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
|
||||||
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user