mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
EVC Quality Of Life
More EVC research notes. The Essentia Terminal can be used to drain or fill the EVC.
This commit is contained in:
1 parent
cd35680c9b
commit
b7a3b50835
12 files changed
+475
-103
No files matched your search
@@ -2,6 +2,8 @@
|
||||
Added E.V.C GUI.
|
||||
API Change: Tile whitelist now requires capacity, and includes a dual add method.
|
||||
Fixes #216: Arcane crafting patterns can no longer substitute items, must match exactly.
|
||||
More EVC research notes.
|
||||
The Essentia Terminal can be used to drain or fill the EVC.
|
||||
|
||||
7/21/2015 0.8.10.8
|
||||
Added Essentia Vibration Chamber recipe & research.
|
||||
|
||||
@@ -135,7 +135,7 @@ public class ThaumicEnergistics
|
||||
|
||||
// Register the standard thaumcraft container items and tiles
|
||||
EssentiaTileContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
EssentiaItemContainerHelper.INSTANCE.registerThaumcraftContainers();
|
||||
EssentiaItemContainerHelper.INSTANCE.registerDefaultContainers();
|
||||
|
||||
// Register features
|
||||
ThaumicEnergistics.proxy.registerFeatures();
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -18,8 +19,8 @@ import thaumicenergistics.gui.ThEGuiHandler;
|
||||
import thaumicenergistics.registries.BlockEnum;
|
||||
import thaumicenergistics.texture.BlockTextureManager;
|
||||
import thaumicenergistics.tileentities.TileEssentiaVibrationChamber;
|
||||
import thaumicenergistics.tileentities.abstraction.TileEVCBase;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -42,6 +43,33 @@ public class BlockEssentiaVibrationChamber
|
||||
this.setCreativeTab( ThaumicEnergistics.ThETab );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the EVC tile entity, if found and is valid.
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private TileEssentiaVibrationChamber getEVCTile( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
// Ensure the world is not null
|
||||
if( world != null )
|
||||
{
|
||||
// Get the tile entity
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
|
||||
// Ensure it is an EVC
|
||||
if( te instanceof TileEssentiaVibrationChamber )
|
||||
{
|
||||
return (TileEssentiaVibrationChamber)te;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onBlockActivated( final World world, final int x, final int y, final int z, final EntityPlayer player )
|
||||
{
|
||||
@@ -55,7 +83,7 @@ public class BlockEssentiaVibrationChamber
|
||||
if( EffectiveSide.isServerSide() )
|
||||
{
|
||||
// Is the tile valid?
|
||||
if( world.getTileEntity( x, y, z ) instanceof TileEssentiaVibrationChamber )
|
||||
if( this.getEVCTile( world, x, y, z ) != null )
|
||||
{
|
||||
// Launch the GUI
|
||||
ThEGuiHandler.launchGui( ThEGuiHandler.ESSENTIA_VIBRATION_CHAMBER, player, world, x, y, z );
|
||||
@@ -65,6 +93,50 @@ public class BlockEssentiaVibrationChamber
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack onDismantled( final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Ignore client side.
|
||||
if( EffectiveSide.isClientSide() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the chamber
|
||||
TileEssentiaVibrationChamber chamber = this.getEVCTile( world, x, y, z );
|
||||
|
||||
// Validate
|
||||
if( chamber == null )
|
||||
{
|
||||
// Invalid EVC tile
|
||||
return null;
|
||||
}
|
||||
|
||||
// Anything to save?
|
||||
if( !chamber.hasSaveDataForDismanle() )
|
||||
{
|
||||
// Nothing unique to save
|
||||
return null;
|
||||
}
|
||||
|
||||
// Reset processing speed
|
||||
chamber.resetForDismantle();
|
||||
|
||||
// Create the tag
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
// Save into the tag
|
||||
chamber.onNBTSave( tag );
|
||||
|
||||
// Create the stack
|
||||
ItemStack representive = new ItemStack( this );
|
||||
|
||||
// Set the tag
|
||||
representive.setTagCompound( tag );
|
||||
|
||||
return representive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity( final World world, final int metaData )
|
||||
{
|
||||
@@ -86,14 +158,13 @@ public class BlockEssentiaVibrationChamber
|
||||
public IIcon getIcon( final IBlockAccess world, final int x, final int y, final int z, final int side )
|
||||
{
|
||||
// Get the chamber
|
||||
TileEntity tileChamber = world.getTileEntity( x, y, z );
|
||||
TileEssentiaVibrationChamber chamber = this.getEVCTile( world, x, y, z );
|
||||
|
||||
// Ensure the chamber is present
|
||||
if( !( tileChamber instanceof TileEssentiaVibrationChamber ) )
|
||||
// Is the tile valid?
|
||||
if( chamber == null )
|
||||
{
|
||||
return this.getIcon( side, 0 );
|
||||
}
|
||||
TileEssentiaVibrationChamber chamber = ( (TileEssentiaVibrationChamber)tileChamber );
|
||||
|
||||
// Is this side the face?
|
||||
if( ( chamber.getForward() != null ) && ( side == chamber.getForward().ordinal() ) )
|
||||
@@ -151,62 +222,66 @@ public class BlockEssentiaVibrationChamber
|
||||
@Override
|
||||
public void onBlockPlacedBy( final World world, final int x, final int y, final int z, final EntityLivingBase player, final ItemStack itemStack )
|
||||
{
|
||||
// Get the chamber
|
||||
TileEntity tileChamber = world.getTileEntity( x, y, z );
|
||||
// Get the chamber tile
|
||||
TileEssentiaVibrationChamber chamber = this.getEVCTile( world, x, y, z );
|
||||
|
||||
// Ensure the chamber is present
|
||||
if( tileChamber instanceof TileEVCBase )
|
||||
// Is the tile valid?
|
||||
if( chamber == null )
|
||||
{
|
||||
if( itemStack.getTagCompound() != null )
|
||||
{
|
||||
//TODO: Load the saved data
|
||||
//chamber.onLoadNBT( itemStack.getTagCompound() );
|
||||
}
|
||||
|
||||
if( player instanceof EntityPlayer )
|
||||
{
|
||||
// Set the owner
|
||||
( (TileEVCBase)tileChamber ).setOwner( (EntityPlayer)player );
|
||||
}
|
||||
|
||||
ForgeDirection face = ForgeDirection.NORTH;
|
||||
|
||||
// Is the player looking down?
|
||||
if( player.rotationPitch > 50 )
|
||||
{
|
||||
face = ForgeDirection.UP;
|
||||
}
|
||||
// Is the player looking up?
|
||||
else if( player.rotationPitch < -50 )
|
||||
{
|
||||
face = ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Get the side index based on which direction the player is turned
|
||||
int sideIndex = MathHelper.floor_double( ( player.rotationYaw * 4.0F / 360.0F ) + 0.5D ) & 3;
|
||||
|
||||
switch ( sideIndex )
|
||||
{
|
||||
case 0:
|
||||
face = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
face = ForgeDirection.EAST;
|
||||
break;
|
||||
case 2:
|
||||
face = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 3:
|
||||
face = ForgeDirection.WEST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the orientation
|
||||
( (TileEVCBase)tileChamber ).setOrientation( face, ForgeDirection.UP );
|
||||
// Invalid tile
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( itemStack.getTagCompound() != null ) && ( EffectiveSide.isServerSide() ) )
|
||||
{
|
||||
// Load the saved data
|
||||
chamber.onNBTLoad( itemStack.getTagCompound() );
|
||||
}
|
||||
|
||||
if( player instanceof EntityPlayer )
|
||||
{
|
||||
// Set the owner
|
||||
chamber.setOwner( (EntityPlayer)player );
|
||||
}
|
||||
|
||||
ForgeDirection face = ForgeDirection.NORTH;
|
||||
|
||||
// Is the player looking down?
|
||||
if( player.rotationPitch > 50 )
|
||||
{
|
||||
face = ForgeDirection.UP;
|
||||
}
|
||||
// Is the player looking up?
|
||||
else if( player.rotationPitch < -50 )
|
||||
{
|
||||
face = ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Get the side index based on which direction the player is turned
|
||||
int sideIndex = MathHelper.floor_double( ( player.rotationYaw * 4.0F / 360.0F ) + 0.5D ) & 3;
|
||||
|
||||
switch ( sideIndex )
|
||||
{
|
||||
case 0:
|
||||
face = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 1:
|
||||
face = ForgeDirection.EAST;
|
||||
break;
|
||||
case 2:
|
||||
face = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 3:
|
||||
face = ForgeDirection.WEST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the orientation
|
||||
chamber.setOrientation( face, ForgeDirection.UP );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,28 +295,27 @@ public class BlockEssentiaVibrationChamber
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock( final World world, final int x, final int y, final int z, final ForgeDirection side )
|
||||
public boolean rotateBlock( final World world, final int x, final int y, final int z, final ForgeDirection axis )
|
||||
{
|
||||
// Get the chamber
|
||||
TileEntity tileChamber = world.getTileEntity( x, y, z );
|
||||
// Cast
|
||||
TileEssentiaVibrationChamber chamber = this.getEVCTile( world, x, y, z );
|
||||
|
||||
// Ensure the chamber is present
|
||||
if( !( tileChamber instanceof TileEVCBase ) )
|
||||
// Validate
|
||||
if( chamber == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increment the direction
|
||||
int sideIndex = ( (TileEVCBase)tileChamber ).getForward().ordinal() + 1;
|
||||
// Get the current facing
|
||||
ForgeDirection forward = chamber.getForward();
|
||||
ForgeDirection up = chamber.getUp();
|
||||
|
||||
// Bounds check direction
|
||||
if( sideIndex >= ForgeDirection.VALID_DIRECTIONS.length )
|
||||
{
|
||||
sideIndex = 0;
|
||||
}
|
||||
// Rotate
|
||||
forward = Platform.rotateAround( forward, axis );
|
||||
up = Platform.rotateAround( up, axis );
|
||||
|
||||
// Apply rotation
|
||||
( (TileEVCBase)tileChamber ).setOrientation( ForgeDirection.getOrientation( sideIndex ), ForgeDirection.UP );
|
||||
chamber.setOrientation( forward, up );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@ public class FeatureEssentiaVibrationChamber
|
||||
|
||||
// Create the pages
|
||||
ResearchPage[] storagePages = new ResearchPage[] { new ResearchPage( ResearchTypes.ESSENTIAVIBRATIONCHAMBER.getPageName( 1 ) ),
|
||||
new ResearchPage( RecipeRegistry.BLOCK_ESSENTIA_VIBRATION_CHAMBER ) };
|
||||
new ResearchPage( RecipeRegistry.BLOCK_ESSENTIA_VIBRATION_CHAMBER ),
|
||||
new ResearchPage( ResearchTypes.ESSENTIAVIBRATIONCHAMBER.getPageName( 2 ) ),
|
||||
new ResearchPage( ResearchTypes.ESSENTIAVIBRATIONCHAMBER.getPageName( 3 ) ) };
|
||||
|
||||
// Create the research
|
||||
ResearchTypes.ESSENTIAVIBRATIONCHAMBER.createResearchItem( chamberAspects, ResearchRegistry.COMPLEXITY_MEDIUM, chamberIcon, storagePages );
|
||||
|
||||
@@ -19,6 +19,8 @@ import thaumicenergistics.api.IThEEssentiaContainerPermission;
|
||||
import thaumicenergistics.api.IThETransportPermissions;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.aspect.AspectStack;
|
||||
import thaumicenergistics.items.ItemBlockEssentiaVibrationChamber;
|
||||
import thaumicenergistics.tileentities.abstraction.TileEVCBase;
|
||||
|
||||
/**
|
||||
* Helper class for working with Thaumcraft item essentia containers.
|
||||
@@ -330,7 +332,7 @@ public final class EssentiaItemContainerHelper
|
||||
resultStack = container.copy();
|
||||
|
||||
// Reduce the list amount
|
||||
aspectList.reduce( aspectStack.aspect, amountToDrain );
|
||||
aspectList.remove( aspectStack.aspect, amountToDrain );
|
||||
|
||||
// Set the stored amount
|
||||
( (IEssentiaContainerItem)resultStack.getItem() ).setAspects( resultStack, aspectList );
|
||||
@@ -655,21 +657,39 @@ public final class EssentiaItemContainerHelper
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is the container a labeled jar?
|
||||
if( this.doesJarHaveLabel( container ) )
|
||||
// Get the container item
|
||||
Item containerItem = container.getItem();
|
||||
if( containerItem == null )
|
||||
{
|
||||
// Does the label match the aspect we are going to fill
|
||||
// with?
|
||||
if( aspectStack.aspect != this.getJarLabelAspect( container ) )
|
||||
// Invalid item
|
||||
return null;
|
||||
}
|
||||
|
||||
// Is the container a labeled jar?
|
||||
if( containerItem instanceof ItemJarFilled )
|
||||
{
|
||||
if( this.doesJarHaveLabel( container ) )
|
||||
{
|
||||
// Aspect does not match the jar's label
|
||||
// Does the label match the aspect we are going to fill
|
||||
// with?
|
||||
if( aspectStack.aspect != this.getJarLabelAspect( container ) )
|
||||
{
|
||||
// Aspect does not match the jar's label
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is the container restricted?
|
||||
else if( containerItem instanceof IRestrictedEssentiaContainerItem )
|
||||
{
|
||||
// Ensure the container accepts this essentia
|
||||
if( !( ( (IRestrictedEssentiaContainerItem)containerItem ).acceptsAspect( aspectStack.aspect ) ) )
|
||||
{
|
||||
// Not acceptable
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the container item
|
||||
Item containerItem = container.getItem();
|
||||
|
||||
// Get the info about the container
|
||||
IThEEssentiaContainerPermission info = this.getContainerInfo( containerItem, container.getItemDamage() );
|
||||
|
||||
@@ -678,6 +698,7 @@ public final class EssentiaItemContainerHelper
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get how much essentia is in the container
|
||||
int containerAmountStored = this.getContainerStoredAmount( container );
|
||||
|
||||
@@ -736,21 +757,32 @@ public final class EssentiaItemContainerHelper
|
||||
// Have we already set the result?
|
||||
if( resultStack == null )
|
||||
{
|
||||
// Make a copy of the request
|
||||
resultStack = container.copy();
|
||||
|
||||
// Get the currently stored list.
|
||||
AspectList aspectList = ( (IEssentiaContainerItem)containerItem ).getAspects( container );
|
||||
|
||||
// Did not we get a list?
|
||||
// Is the containers list null?
|
||||
if( aspectList == null )
|
||||
{
|
||||
// Create a new aspect list
|
||||
aspectList = new AspectList();
|
||||
}
|
||||
// Does the list have anything in it?
|
||||
else if( aspectList.size() > 0 )
|
||||
{
|
||||
// Does the stored aspect match the aspect to inject?
|
||||
if( aspectStack.aspect != aspectList.getAspects()[0] )
|
||||
{
|
||||
// Don't mix aspects
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase the list amount
|
||||
aspectList.add( aspectStack.aspect, amountToFill );
|
||||
|
||||
// Make a copy of the request
|
||||
resultStack = container.copy();
|
||||
|
||||
// Set the stored amount
|
||||
( (IEssentiaContainerItem)resultStack.getItem() ).setAspects( resultStack, aspectList );
|
||||
}
|
||||
@@ -807,7 +839,7 @@ public final class EssentiaItemContainerHelper
|
||||
/**
|
||||
* Setup the standard white list
|
||||
*/
|
||||
public void registerThaumcraftContainers()
|
||||
public void registerDefaultContainers()
|
||||
{
|
||||
// Phials
|
||||
this.perms.addEssentiaContainerItemToTransportPermissions( ItemEssence.class, PHIAL_CAPACITY, 0, false );
|
||||
@@ -819,8 +851,8 @@ public final class EssentiaItemContainerHelper
|
||||
// Void jar
|
||||
this.perms.addEssentiaContainerItemToTransportPermissions( ItemJarFilled.class, JAR_CAPACITY, 3, true );
|
||||
|
||||
// Label
|
||||
//this.emptyJarLabel = new ItemStack( thaumcraft.common.config.ConfigItems.itemResource, 1, 13 );
|
||||
// Vibration chamber
|
||||
this.perms.addEssentiaContainerItemToTransportPermissions( ItemBlockEssentiaVibrationChamber.class, TileEVCBase.MAX_ESSENTIA_STORED, 0, true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package thaumicenergistics.integration.tc;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
|
||||
public interface IRestrictedEssentiaContainerItem
|
||||
extends IEssentiaContainerItem
|
||||
{
|
||||
/**
|
||||
* Returns true if the container accepts the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
public boolean acceptsAspect( Aspect aspect );
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package thaumicenergistics.items;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumicenergistics.aspect.AspectStack;
|
||||
import thaumicenergistics.integration.tc.IRestrictedEssentiaContainerItem;
|
||||
import thaumicenergistics.registries.ThEStrings;
|
||||
import thaumicenergistics.tileentities.abstraction.TileEVCBase;
|
||||
|
||||
public class ItemBlockEssentiaVibrationChamber
|
||||
extends ItemBlock
|
||||
implements IRestrictedEssentiaContainerItem
|
||||
{
|
||||
public ItemBlockEssentiaVibrationChamber( final Block block )
|
||||
{
|
||||
super( block );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the aspect stack from the EVC item.
|
||||
*
|
||||
* @param evcStack
|
||||
* @return AspectStack or null
|
||||
*/
|
||||
private AspectStack getStoredAspectStack( final ItemStack evcStack )
|
||||
{
|
||||
// Get the tag
|
||||
NBTTagCompound data = evcStack.getTagCompound();
|
||||
|
||||
// Is there essentia stored?
|
||||
if( ( data == null ) || ( !data.hasKey( TileEVCBase.NBTKEY_STORED ) ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return AspectStack.loadAspectStackFromNBT( data.getCompoundTag( TileEVCBase.NBTKEY_STORED ) );
|
||||
}
|
||||
|
||||
private void setStoredAspectStack( final ItemStack evcStack, final AspectStack aspectStack )
|
||||
{
|
||||
// Get the tag
|
||||
NBTTagCompound data = evcStack.getTagCompound();
|
||||
if( data == null )
|
||||
{
|
||||
data = new NBTTagCompound();
|
||||
}
|
||||
|
||||
// Is the stack empty?
|
||||
if( aspectStack == null )
|
||||
{
|
||||
// Remove the stored data
|
||||
data.removeTag( TileEVCBase.NBTKEY_STORED );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create the subtag
|
||||
NBTTagCompound storedTag = new NBTTagCompound();
|
||||
|
||||
// Write the aspect stack into it
|
||||
aspectStack.writeToNBT( storedTag );
|
||||
|
||||
// Write the stored tag
|
||||
data.setTag( TileEVCBase.NBTKEY_STORED, storedTag );
|
||||
}
|
||||
|
||||
// Is the data tag empty?
|
||||
if( data.hasNoTags() )
|
||||
{
|
||||
// Set to null
|
||||
data = null;
|
||||
}
|
||||
|
||||
// Set tag
|
||||
evcStack.setTagCompound( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsAspect( final Aspect aspect )
|
||||
{
|
||||
return TileEVCBase.acceptsAspect( aspect );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation( final ItemStack evcStack, final EntityPlayer player, final List displayList, final boolean advancedItemTooltips )
|
||||
{
|
||||
// Ignore stacks without a tag
|
||||
if( !evcStack.hasTagCompound() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Is shift being held?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || ( Keyboard.isKeyDown( Keyboard.KEY_RSHIFT ) ) )
|
||||
{
|
||||
|
||||
// Load the stack
|
||||
AspectStack storedEssentia = this.getStoredAspectStack( evcStack );
|
||||
|
||||
// Add stored info
|
||||
if( storedEssentia != null )
|
||||
{
|
||||
displayList.add( String.format( "%s x %d", storedEssentia.aspect.getName(), storedEssentia.stackSize ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let the user know they can hold shift
|
||||
displayList.add( EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString() +
|
||||
ThEStrings.Tooltip_CellDetails.getLocalized() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects( final ItemStack evcStack )
|
||||
{
|
||||
AspectList list = new AspectList();
|
||||
|
||||
// Ignore stacks without a tag
|
||||
if( evcStack.hasTagCompound() )
|
||||
{
|
||||
// Get the stored aspect
|
||||
AspectStack stored = this.getStoredAspectStack( evcStack );
|
||||
if( ( stored != null ) && ( stored.stackSize > 0 ) )
|
||||
{
|
||||
// Add it
|
||||
list.add( stored.aspect, (int)stored.stackSize );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects( final ItemStack evcStack, final AspectList list )
|
||||
{
|
||||
AspectStack aspectStack = null;
|
||||
|
||||
if( list.size() > 0 )
|
||||
{
|
||||
Aspect aspect = list.getAspects()[0];
|
||||
|
||||
// Create the aspect stack
|
||||
aspectStack = new AspectStack( aspect, list.getAmount( aspect ) );
|
||||
}
|
||||
|
||||
// Set the tag
|
||||
this.setStoredAspectStack( evcStack, aspectStack );
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class CommonProxy
|
||||
{
|
||||
for( BlockEnum block : BlockEnum.VALUES )
|
||||
{
|
||||
GameRegistry.registerBlock( block.getBlock(), block.getUnlocalizedName() );
|
||||
GameRegistry.registerBlock( block.getBlock(), block.getItemClass(), block.getUnlocalizedName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package thaumicenergistics.registries;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import thaumicenergistics.blocks.BlockArcaneAssembler;
|
||||
import thaumicenergistics.blocks.BlockEssentiaCellWorkbench;
|
||||
import thaumicenergistics.blocks.BlockEssentiaProvider;
|
||||
@@ -9,6 +10,7 @@ import thaumicenergistics.blocks.BlockGearBox;
|
||||
import thaumicenergistics.blocks.BlockGolemGearBox;
|
||||
import thaumicenergistics.blocks.BlockInfusionProvider;
|
||||
import thaumicenergistics.blocks.BlockKnowledgeInscriber;
|
||||
import thaumicenergistics.items.ItemBlockEssentiaVibrationChamber;
|
||||
|
||||
public enum BlockEnum
|
||||
{
|
||||
@@ -19,18 +21,48 @@ public enum BlockEnum
|
||||
ESSENTIA_CELL_WORKBENCH (ThEStrings.Block_EssentiaCellWorkbench, new BlockEssentiaCellWorkbench()),
|
||||
ARCANE_ASSEMBLER (ThEStrings.Block_ArcaneAssembler, new BlockArcaneAssembler()),
|
||||
KNOWLEDGE_INSCRIBER (ThEStrings.Block_KnowledgeInscriber, new BlockKnowledgeInscriber()),
|
||||
ESSENTIA_VIBRATION_CHAMBER (ThEStrings.Block_EssentiaVibrationChamber, new BlockEssentiaVibrationChamber());
|
||||
ESSENTIA_VIBRATION_CHAMBER (ThEStrings.Block_EssentiaVibrationChamber, new BlockEssentiaVibrationChamber(),
|
||||
ItemBlockEssentiaVibrationChamber.class);
|
||||
|
||||
private Block block;
|
||||
/**
|
||||
* The block object.
|
||||
*/
|
||||
private final Block block;
|
||||
|
||||
private ThEStrings unlocalizedName;
|
||||
/**
|
||||
* Unlocalized name of the block.
|
||||
*/
|
||||
private final ThEStrings unlocalizedName;
|
||||
|
||||
/**
|
||||
* Custom item
|
||||
*/
|
||||
private final Class<? extends ItemBlock> itemBlockClass;
|
||||
|
||||
/**
|
||||
* Cache of the enum values
|
||||
*/
|
||||
public static final BlockEnum[] VALUES = BlockEnum.values();
|
||||
|
||||
/**
|
||||
* Constructs the block with the default itemblock.
|
||||
*
|
||||
* @param unlocalizedName
|
||||
* @param block
|
||||
*/
|
||||
private BlockEnum( final ThEStrings unlocalizedName, final Block block )
|
||||
{
|
||||
this( unlocalizedName, block, ItemBlock.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the block with the specified itemBlock.
|
||||
*
|
||||
* @param unlocalizedName
|
||||
* @param block
|
||||
* @param itemBlockClass
|
||||
*/
|
||||
private BlockEnum( final ThEStrings unlocalizedName, final Block block, final Class<? extends ItemBlock> itemBlockClass )
|
||||
{
|
||||
// Set the block
|
||||
this.block = block;
|
||||
@@ -40,6 +72,9 @@ public enum BlockEnum
|
||||
|
||||
// Set the block's name
|
||||
block.setBlockName( this.unlocalizedName.getUnlocalized() );
|
||||
|
||||
// Set item
|
||||
this.itemBlockClass = itemBlockClass;
|
||||
}
|
||||
|
||||
// Return the block
|
||||
@@ -48,6 +83,11 @@ public enum BlockEnum
|
||||
return this.block;
|
||||
}
|
||||
|
||||
public Class<? extends ItemBlock> getItemClass()
|
||||
{
|
||||
return this.itemBlockClass;
|
||||
}
|
||||
|
||||
// Return the name
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
|
||||
@@ -83,7 +83,8 @@ public class TileEssentiaVibrationChamber
|
||||
private int processingSpeed = 0;
|
||||
|
||||
/**
|
||||
* How much power is produced per tick.
|
||||
* How much power is produced per processing tick.
|
||||
* Note: This is not the same as a minecraft tick. Processing ticks are dilated by processing speed.
|
||||
*/
|
||||
private double powerProducedPerProcessingTick = 0;
|
||||
|
||||
@@ -418,15 +419,15 @@ public class TileEssentiaVibrationChamber
|
||||
@Override
|
||||
protected void NBTWrite( final NBTTagCompound data )
|
||||
{
|
||||
// Write time remaining
|
||||
data.setInteger( TileEssentiaVibrationChamber.NBTKEY_TIME_REMAINING, this.processingTicksRemaining );
|
||||
|
||||
if( this.processingTicksRemaining > 0 )
|
||||
{
|
||||
// Write time remaining
|
||||
data.setInteger( TileEssentiaVibrationChamber.NBTKEY_TIME_REMAINING, this.processingTicksRemaining );
|
||||
|
||||
// Write processing speed
|
||||
data.setInteger( TileEssentiaVibrationChamber.NBTKEY_PROCESSING_SPEED, this.processingSpeed );
|
||||
|
||||
// Write power per tick
|
||||
// Write power per processing tick
|
||||
data.setDouble( TileEssentiaVibrationChamber.NBTKEY_POWER_PER_TICK, this.powerProducedPerProcessingTick );
|
||||
|
||||
// Is there an aspect?
|
||||
@@ -521,6 +522,28 @@ public class TileEssentiaVibrationChamber
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if there is data that should be saved during a dismantle.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasSaveDataForDismanle()
|
||||
{
|
||||
// Anything stored?
|
||||
if( ( this.storedEssentia != null ) && ( this.storedEssentia.stackSize > 0 ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Anything being processed?
|
||||
if( this.processingTicksRemaining > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener with the EVC
|
||||
*
|
||||
@@ -541,6 +564,15 @@ public class TileEssentiaVibrationChamber
|
||||
this.listeners.remove( listener );
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called when the EVC is being dismantled.
|
||||
*/
|
||||
public void resetForDismantle()
|
||||
{
|
||||
this.processingSpeed = TileEssentiaVibrationChamber.PROCESS_SPEED_MIN;
|
||||
this.processingTicksRemaining = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the network ticks.
|
||||
*
|
||||
|
||||
@@ -34,7 +34,10 @@ public abstract class TileEVCBase
|
||||
extends AENetworkTile
|
||||
implements IEssentiaTransportWithSimulate, IAspectSource
|
||||
{
|
||||
private static final String NBTKEY_STORED = "StoredEssentia";
|
||||
/**
|
||||
* NBT Key for the stored aspect stack.
|
||||
*/
|
||||
public static final String NBTKEY_STORED = "StoredEssentia";
|
||||
|
||||
/**
|
||||
* The maximum amount of stored essentia.
|
||||
@@ -46,6 +49,17 @@ public abstract class TileEVCBase
|
||||
*/
|
||||
protected AspectStack storedEssentia = null;
|
||||
|
||||
/**
|
||||
* Returns true if the EVC accepts the specified aspect.
|
||||
*
|
||||
* @param aspect
|
||||
* @return
|
||||
*/
|
||||
public static boolean acceptsAspect( final Aspect aspect )
|
||||
{
|
||||
return( ( aspect == Aspect.FIRE ) || ( aspect == Aspect.ENERGY ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 1-100: Ignis, 100-200: Potentia
|
||||
*/
|
||||
@@ -138,7 +152,7 @@ public abstract class TileEVCBase
|
||||
}
|
||||
|
||||
// Nothing is stored, accepts ignis or potentia
|
||||
return( ( aspect == Aspect.FIRE ) || ( aspect == Aspect.ENERGY ) );
|
||||
return TileEVCBase.acceptsAspect( aspect );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -166,4 +166,5 @@ thaumicenergistics.research_page.TEFOCUSWRENCH.1=This wand focus interacts with
|
||||
tc.research_name.thaumicenergistics.TEESSVIBCMBR=Vibration Chamber
|
||||
tc.research_text.thaumicenergistics.TEESSVIBCMBR=Essentia Powered Network
|
||||
thaumicenergistics.research_page.TEESSVIBCMBR.1=Getting power for your network until this point has relied on burning items in the §lVibration Chamber§r. That is about to change!<BR>You have constructed a simple device that unleashes the energies of essentia to fuel the vibration chamber. By using distilled §lIgnis or Potentia§r essentia, you can generate more power than simply burning the item.<BR>Be aware that it has the same regulation behavior as the original chamber: It minimizes wasted power by slowing the reaction if the network is fully powered, but so long as there is essentia to use, it will use it.
|
||||
|
||||
thaumicenergistics.research_page.TEESSVIBCMBR.2=§l§nOperation§r<BR>By breaking down an item, such as coal, into Ignis or Potentia much more power can be generated from the essentia. Your early estimates show an increase of roughly 350% for processing coal essentia v.s. burning the coal directly. Potentia essentia seems to be much more potent than Ignis.<BR>The §lE.V.C.§r will rotate which essentia it is requesting on a regular interval when empty. When essentia is stored, it will only request more of the stored essentia.
|
||||
thaumicenergistics.research_page.TEESSVIBCMBR.3=Opening the GUI shows how much and what type of essentia is stored. What is currently being processed, and the time remaining. As well as the current power production level.<LINE>§l§nNotes§r<BR>The §lE.V.C.§r can be placed in an §lEssentia Terminal§r to quickly fill or drain the stored essentia.<BR>The §lEssentia Export Bus§r, §lEssentia Provider§r, and essentia tubes can be used to keep the §lE.V.C.§r full.
|
||||
Reference in new issue
Block a user