Some additional fixes from other branch.

This commit is contained in:
Sebastian Hartte
2020-05-30 22:18:26 +02:00
parent 16d6d55d7f
commit ec3b464655
139 changed files with 1489 additions and 1485 deletions
+216 -243
View File
@@ -26,32 +26,29 @@ import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.state.IProperty;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapePart;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.util.LookDirection;
import appeng.util.Platform;
public abstract class AEBaseBlock extends Block
@@ -62,222 +59,210 @@ public abstract class AEBaseBlock extends Block
private boolean hasSubtypes = false;
private boolean isInventory = false;
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
protected VoxelShape boundingBox = VoxelShapes.fullCube();
protected AEBaseBlock( final Material mat )
protected AEBaseBlock( final Block.Properties props )
{
super( mat );
super( props );
if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
{
this.setSoundType( SoundType.GLASS );
}
else if( mat == Material.ROCK )
{
this.setSoundType( SoundType.STONE );
}
else if( mat == Material.WOOD )
{
this.setSoundType( SoundType.WOOD );
}
else
{
this.setSoundType( SoundType.METAL );
}
// FIXME: Move to block registration
// FIXME if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
// FIXME {
// FIXME this.setSoundType( SoundType.GLASS );
// FIXME }
// FIXME else if( mat == Material.ROCK )
// FIXME {
// FIXME this.setSoundType( SoundType.STONE );
// FIXME }
// FIXME else if( mat == Material.WOOD )
// FIXME {
// FIXME this.setSoundType( SoundType.WOOD );
// FIXME }
// FIXME else
// FIXME {
// FIXME this.setSoundType( SoundType.METAL );
// FIXME }
this.setLightOpacity( 255 );
this.setLightLevel( 0 );
this.setHardness( 2.2F );
this.setHarvestLevel( "pickaxe", 0 );
// Workaround as vanilla sets it way too early.
this.fullBlock = this.isFullSize();
// FIXME this.setLightOpacity( 255 );
// FIXME this.setLightLevel( 0 );
// FIXME this.setHardness( 2.2F );
// FIXME this.setHarvestLevel( "pickaxe", 0 );
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer( this, this.getAEStates() );
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(getAEStates());
}
@Override
public final boolean isNormalCube( BlockState state )
{
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return this.isFullSize() && this.isOpaque();
}
@Override
public AxisAlignedBB getBoundingBox( BlockState state, IBlockReader source, BlockPos pos )
{
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return this.boundingBox;
}
@SuppressWarnings( "deprecation" )
@Override
public void addCollisionBoxToList( final BlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
// FIXME @SuppressWarnings( "deprecation" )
// FIXME @Override
// FIXME public void addCollisionBoxToList(final BlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
// FIXME {
// FIXME final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
// FIXME
// FIXME if( collisionHandler != null && bb != null )
// FIXME {
// FIXME final List<AxisAlignedBB> tmp = new ArrayList<>();
// FIXME collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
// FIXME for( final AxisAlignedBB b : tmp )
// FIXME {
// FIXME final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
// FIXME if( bb.intersects( offset ) )
// FIXME {
// FIXME out.add( offset );
// FIXME }
// FIXME }
// FIXME }
// FIXME else
// FIXME {
// FIXME super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
// FIXME }
// FIXME }
// FIXME
if( collisionHandler != null && bb != null )
{
final List<AxisAlignedBB> tmp = new ArrayList<>();
collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
for( final AxisAlignedBB b : tmp )
{
final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
if( bb.intersects( offset ) )
{
out.add( offset );
}
}
}
else
{
super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
}
}
// FIXME @SuppressWarnings( "deprecation" )
// FIXME @Override
// FIXME @OnlyIn( Dist.CLIENT )
// FIXME public VoxelShape getRaytraceShape(BlockState state, IBlockReader w, BlockPos pos)
// FIXME {
// FIXME final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
// FIXME
// FIXME if( collisionHandler != null )
// FIXME {
// FIXME if( Platform.isClient() )
// FIXME {
// FIXME final PlayerEntity player = Minecraft.getInstance().player;
// FIXME final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
// FIXME
// FIXME final Iterable<VoxelShape> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getInstance().player, true );
// FIXME VoxelShape br = null;
// FIXME
// FIXME double lastDist = 0;
// FIXME
// FIXME for( final VoxelShape bb : bbs )
// FIXME {
// FIXME final RayTraceResult r = bb.rayTrace(ld.getA(), ld.getB(), pos);
// FIXME
// FIXME if( r != null )
// FIXME {
// FIXME final double xLen = ( ld.getA().x - r.getHitVec().x );
// FIXME final double yLen = ( ld.getA().y - r.getHitVec().y );
// FIXME final double zLen = ( ld.getA().z - r.getHitVec().z );
// FIXME
// FIXME final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
// FIXME
// FIXME if( br == null || lastDist > thisDist )
// FIXME {
// FIXME lastDist = thisDist;
// FIXME br = bb;
// FIXME }
// FIXME }
// FIXME }
// FIXME
// FIXME if( br != null )
// FIXME {
// FIXME return br;
// FIXME }
// FIXME }
// FIXME
// FIXME VoxelShape b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
// FIXME
// FIXME for( final VoxelShape bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
// FIXME {
// FIXME if( b == null )
// FIXME {
// FIXME b = bx;
// FIXME continue;
// FIXME }
// FIXME
// FIXME final double minX = Math.min( b.minX, bx.minX );
// FIXME final double minY = Math.min( b.minY, bx.minY );
// FIXME final double minZ = Math.min( b.minZ, bx.minZ );
// FIXME final double maxX = Math.max( b.maxX, bx.maxX );
// FIXME final double maxY = Math.max( b.maxY, bx.maxY );
// FIXME final double maxZ = Math.max( b.maxZ, bx.maxZ );
// FIXME
// FIXME b = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
// FIXME }
// FIXME
// FIXME if( b == null )
// FIXME {
// FIXME b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
// FIXME }
// FIXME else
// FIXME {
// FIXME b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
// FIXME .getZ() );
// FIXME }
// FIXME
// FIXME return b;
// FIXME }
// FIXME
// FIXME return super.getSelectedBoundingBox( state, w, pos );
// FIXME }
@SuppressWarnings( "deprecation" )
@Override
@OnlyIn( Dist.CLIENT )
public AxisAlignedBB getSelectedBoundingBox( BlockState state, final World w, final BlockPos pos )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
if( collisionHandler != null )
{
if( Platform.isClient() )
{
final PlayerEntity player = Minecraft.getInstance().player;
final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getInstance().player, true );
AxisAlignedBB br = null;
double lastDist = 0;
for( final AxisAlignedBB bb : bbs )
{
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
final double xLen = ( ld.getA().x - r.hitVec.x );
final double yLen = ( ld.getA().y - r.hitVec.y );
final double zLen = ( ld.getA().z - r.hitVec.z );
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if( br == null || lastDist > thisDist )
{
lastDist = thisDist;
br = bb;
}
}
}
if( br != null )
{
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
.getY(), br.maxZ + pos.getZ() );
return br;
}
}
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
{
if( b == null )
{
b = bx;
continue;
}
final double minX = Math.min( b.minX, bx.minX );
final double minY = Math.min( b.minY, bx.minY );
final double minZ = Math.min( b.minZ, bx.minZ );
final double maxX = Math.max( b.maxX, bx.maxX );
final double maxY = Math.max( b.maxY, bx.maxY );
final double maxZ = Math.max( b.maxZ, bx.maxZ );
b = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
if( b == null )
{
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
else
{
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
.getZ() );
}
return b;
}
return super.getSelectedBoundingBox( state, w, pos );
}
@Override
public final boolean isOpaqueCube( BlockState state )
{
return this.isOpaque();
}
@SuppressWarnings( "deprecation" )
@Override
public RayTraceResult collisionRayTrace( final BlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
if( collisionHandler != null )
{
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, true );
RayTraceResult br = null;
double lastDist = 0;
for( final AxisAlignedBB bb : bbs )
{
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
final double xLen = ( a.x - r.hitVec.x );
final double yLen = ( a.y - r.hitVec.y );
final double zLen = ( a.z - r.hitVec.z );
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if( br == null || lastDist > thisDist )
{
lastDist = thisDist;
br = r;
}
}
}
if( br != null )
{
return br;
}
return null;
}
this.boundingBox = FULL_BLOCK_AABB;
return super.collisionRayTrace( state, w, pos, a, b );
}
// FIXME: Move to state
// FIXME @Override
// FIXME public final boolean isOpaqueCube( BlockState state )
// {
// return this.isOpaque();
// }
//FIXME @SuppressWarnings( "deprecation" )
//FIXME @Override
//FIXME public RayTraceResult collisionRayTrace(final BlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b )
//FIXME {
//FIXME final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
//FIXME
//FIXME if( collisionHandler != null )
//FIXME {
//FIXME final Iterable<VoxelShape> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, true );
//FIXME RayTraceResult br = null;
//FIXME
//FIXME double lastDist = 0;
//FIXME
//FIXME for( final VoxelShape bb : bbs )
//FIXME {
//FIXME final RayTraceResult r = bb.rayTrace( state, w, pos, a, b );
//FIXME
//FIXME if( r != null )
//FIXME {
//FIXME final double xLen = ( a.x - r.hitVec.x );
//FIXME final double yLen = ( a.y - r.hitVec.y );
//FIXME final double zLen = ( a.z - r.hitVec.z );
//FIXME
//FIXME final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
//FIXME if( br == null || lastDist > thisDist )
//FIXME {
//FIXME lastDist = thisDist;
//FIXME br = r;
//FIXME }
//FIXME }
//FIXME }
//FIXME
//FIXME if( br != null )
//FIXME {
//FIXME return br;
//FIXME }
//FIXME
//FIXME return null;
//FIXME }
//FIXME
//FIXME this.boundingBox = FULL_BLOCK_AABB;
//FIXME return super.collisionRayTrace( state, w, pos, a, b );
//FIXME }
//FIXME
@Override
public boolean hasComparatorInputOverride( BlockState state )
{
@@ -285,28 +270,22 @@ public abstract class AEBaseBlock extends Block
}
@Override
public int getComparatorInputOverride( BlockState state, final World worldIn, final BlockPos pos )
public int getComparatorInputOverride(BlockState state, final World worldIn, final BlockPos pos )
{
return 0;
}
@Override
public final boolean isNormalCube( BlockState state, final IBlockReader world, final BlockPos pos )
{
return this.isFullSize();
}
@Override
public boolean rotateBlock( final World w, final BlockPos pos, final Direction axis )
{
public BlockState rotate(BlockState state, IWorld w, BlockPos pos, Rotation direction) {
final IOrientable rotatable = this.getOrientable( w, pos );
if( rotatable != null && rotatable.canBeRotated() )
{
if( this.hasCustomRotation() )
{
this.customRotateBlock( rotatable, axis );
return true;
// FIXME this.customRotateBlock( rotatable, axis );
// FIXME return true;
throw new IllegalStateException();
}
else
{
@@ -315,40 +294,34 @@ public abstract class AEBaseBlock extends Block
for( int rs = 0; rs < 4; rs++ )
{
forward = Platform.rotateAround( forward, axis );
up = Platform.rotateAround( up, axis );
// FIXME forward = Platform.rotateAround( forward, axis );
// FIXME up = Platform.rotateAround( up, axis );
if( this.isValidOrientation( w, pos, forward, up ) )
{
rotatable.setOrientation( forward, up );
return true;
// FIXME
throw new IllegalStateException();
}
}
}
}
return super.rotateBlock( w, pos, axis );
return state;
}
@Override
public Direction[] getValidRotations( final World w, final BlockPos pos )
public Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
{
return new Direction[0];
}
@OnlyIn( Dist.CLIENT )
@Override
public void addInformation( final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips )
{
}
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
public boolean onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
{
return false;
}
public final Direction mapRotation( final IOrientable ori, final Direction dir )
public final Direction mapRotation(final IOrientable ori, final Direction dir )
{
// case DOWN: return bottomIcon;
// case UP: return blockIcon;
@@ -365,14 +338,14 @@ public abstract class AEBaseBlock extends Block
return dir;
}
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
Direction west = null;
for( final Direction dx : Direction.VALUES )
for( final Direction dx : Direction.values() )
{
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
if( dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z )
{
west = dx;
}
@@ -416,11 +389,11 @@ public abstract class AEBaseBlock extends Block
@Override
public String toString()
{
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
protected String getTranslationKey( final ItemStack is )
protected String getUnlocalizedName( final ItemStack is )
{
return this.getTranslationKey();
}
@@ -435,7 +408,7 @@ public abstract class AEBaseBlock extends Block
}
protected IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
protected IOrientable getOrientable( final IWorldReader w, final BlockPos pos )
{
if( this instanceof IOrientableBlock )
{
@@ -445,12 +418,12 @@ public abstract class AEBaseBlock extends Block
return null;
}
protected boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up )
protected boolean isValidOrientation(final IWorld w, final BlockPos pos, final Direction forward, final Direction up )
{
return true;
}
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
protected ICustomCollision getCustomCollision( final IBlockReader w, final BlockPos pos )
{
if( this instanceof ICustomCollision )
{
@@ -164,7 +164,7 @@ public class AEBaseBlockItem extends BlockItem
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
up = side;
forward = Direction.SOUTH;
if( up.getFrontOffsetY() == 0 )
if( up.getYOffset() == 0 )
{
forward = Direction.UP;
}
@@ -52,12 +52,12 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
@OnlyIn( Dist.CLIENT )
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
{
final CompoundNBT tag = stack.getTagCompound();
double internalCurrentPower = 0;
final double internalMaxPower = this.getMaxEnergyCapacity();
if( internalMaxPower > 0 )
{
final CompoundNBT tag = stack.getTag();
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
@@ -143,13 +143,13 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
private double getInternal( final ItemStack is )
{
final CompoundNBT nbt = Platform.openNbtData( is );
final CompoundNBT nbt = is.getOrCreateTag();
return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal( final ItemStack is, final double amt )
{
final CompoundNBT nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
final CompoundNBT nbt = is.getOrCreateTag();
nbt.putDouble("internalCurrentPower", amt);
}
}
@@ -92,8 +92,8 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
if( !w.isRemote )
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter );
w.spawnEntity( primedTinyTNTEntity );
w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED,
w.addEntity( primedTinyTNTEntity );
w.playSound( null, primedTinyTNTEntity.getPosX(), primedTinyTNTEntity.getPosY(), primedTinyTNTEntity.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED,
SoundCategory.BLOCKS, 1, 1 );
}
}
@@ -150,7 +150,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp
.getExplosivePlacedBy() );
primedTinyTNTEntity.setFuse( w.rand.nextInt( primedTinyTNTEntity.getFuse() / 4 ) + primedTinyTNTEntity.getFuse() / 8 );
w.spawnEntity( primedTinyTNTEntity );
w.addEntity( primedTinyTNTEntity );
}
}
@@ -19,7 +19,7 @@
package appeng.block.networking;
import net.minecraft.block.properties.IProperty;
import net.minecraft.state.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.BlockState;
import net.minecraft.creativetab.CreativeTabs;
@@ -31,7 +31,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.util.Platform;
public class BlockEnergyCell extends AEBaseTileBlock
@@ -63,9 +62,9 @@ public class BlockEnergyCell extends AEBaseTileBlock
super.getSubBlocks( tabs, itemStacks );
final ItemStack charged = new ItemStack( this, 1 );
final CompoundNBT tag = Platform.openNbtData( charged );
tag.setDouble( "internalCurrentPower", this.getMaxPower() );
tag.setDouble( "internalMaxPower", this.getMaxPower() );
final CompoundNBT tag = charged.getOrCreateTag();
tag.putDouble("internalCurrentPower", this.getMaxPower());
tag.putDouble("internalMaxPower", this.getMaxPower());
itemStacks.add( charged );
}
@@ -120,9 +120,9 @@ class QnbFormedBakedModel implements IBakedModel
{
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs( facing.getFrontOffsetX() * 0.01f );
float yOffset = Math.abs( facing.getFrontOffsetY() * 0.01f );
float zOffset = Math.abs( facing.getFrontOffsetZ() * 0.01f );
float xOffset = Math.abs( facing.getXOffset() * 0.01f );
float yOffset = Math.abs( facing.getYOffset() * 0.01f );
float zOffset = Math.abs( facing.getZOffset() * 0.01f );
builder.setDrawFaces( EnumSet.of( facing ) );
builder.addCube(
@@ -149,9 +149,9 @@ class QnbFormedBakedModel implements IBakedModel
{
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs( facing.getFrontOffsetX() * 0.01f );
float yOffset = Math.abs( facing.getFrontOffsetY() * 0.01f );
float zOffset = Math.abs( facing.getFrontOffsetZ() * 0.01f );
float xOffset = Math.abs( facing.getXOffset() * 0.01f );
float yOffset = Math.abs( facing.getYOffset() * 0.01f );
float zOffset = Math.abs( facing.getZOffset() * 0.01f );
builder.setDrawFaces( EnumSet.of( facing ) );
builder.addCube(
@@ -111,18 +111,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
o = sk.getUp();
}
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
// for x/z top and bottom is swapped
final double minX = Math.max( 0.0, offsetX + ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetX() * AABB_OFFSET_TOP ) ) );
final double minY = Math.max( 0.0, offsetY + ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetY() * AABB_OFFSET_BOTTOM ) ) );
final double minZ = Math.max( 0.0, offsetZ + ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetZ() * AABB_OFFSET_TOP ) ) );
final double minX = Math.max( 0.0, offsetX + ( o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : ( o.getXOffset() * AABB_OFFSET_TOP ) ) );
final double minY = Math.max( 0.0, offsetY + ( o.getYOffset() < 0 ? AABB_OFFSET_TOP : ( o.getYOffset() * AABB_OFFSET_BOTTOM ) ) );
final double minZ = Math.max( 0.0, offsetZ + ( o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : ( o.getZOffset() * AABB_OFFSET_TOP ) ) );
final double maxX = Math.min( 1.0, 1.0 - offsetX - ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetX() * AABB_OFFSET_BOTTOM ) ) );
final double maxY = Math.min( 1.0, 1.0 - offsetY - ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetY() * AABB_OFFSET_TOP ) ) );
final double maxZ = Math.min( 1.0, 1.0 - offsetZ - ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM ) ) );
final double maxX = Math.min( 1.0, 1.0 - offsetX - ( o.getXOffset() < 0 ? AABB_OFFSET_TOP : ( o.getXOffset() * AABB_OFFSET_BOTTOM ) ) );
final double maxY = Math.min( 1.0, 1.0 - offsetY - ( o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : ( o.getYOffset() * AABB_OFFSET_TOP ) ) );
final double maxZ = Math.min( 1.0, 1.0 - offsetZ - ( o.getZOffset() < 0 ? AABB_OFFSET_TOP : ( o.getZOffset() * AABB_OFFSET_BOTTOM ) ) );
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
+2 -3
View File
@@ -2,12 +2,11 @@
package appeng.client;
import org.lwjgl.input.Keyboard;
import org.lwjgl.glfw.GLFW;
public enum ActionKey
{
TOGGLE_FOCUS( Keyboard.KEY_TAB );
TOGGLE_FOCUS( GLFW.GLFW_KEY_TAB );
private final int defaultKey;
@@ -35,6 +35,10 @@ import com.google.common.base.Joiner;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.Slot;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -194,7 +198,7 @@ public abstract class AEBaseGui extends GuiContainer
final int right = left + slot.getWidth();
final int bottom = top + slot.getHeight();
slot.drawContent( this.mc, mouseX, mouseY, partialTicks );
slot.drawContent( this.minecraft, mouseX, mouseY, partialTicks );
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.mc.player ) )
{
@@ -23,8 +23,8 @@ import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
+1 -1
View File
@@ -19,7 +19,7 @@
package appeng.client.gui;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.container.Container;
public class GuiNull extends AEBaseGui
@@ -8,7 +8,7 @@ import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
@@ -22,7 +22,7 @@ package appeng.client.gui.config;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
@@ -35,7 +35,7 @@ import appeng.core.AppEng;
public class AEConfigGui extends GuiConfig
{
public AEConfigGui( final GuiScreen parent )
public AEConfigGui( final Screen parent )
{
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance().getFilePath() ) );
}
@@ -22,7 +22,7 @@ package appeng.client.gui.config;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraftforge.fml.client.IModGuiFactory;
@@ -47,7 +47,7 @@ public class AEConfigGuiFactory implements IModGuiFactory
}
/**
* Return an initialized {@link GuiScreen}. This screen will be displayed
* Return an initialized {@link Screen}. This screen will be displayed
* when the "config" button is pressed in the mod list. It will
* have a single argument constructor - the "parent" screen, the same as all
* Minecraft GUIs. The expected behaviour is that this screen will replace the
@@ -67,7 +67,7 @@ public class AEConfigGuiFactory implements IModGuiFactory
* or null if no GUI is desired.
*/
@Override
public GuiScreen createConfigGui( GuiScreen parentScreen )
public Screen createConfigGui(Screen parentScreen )
{
return new AEConfigGui( parentScreen );
}
@@ -133,7 +133,7 @@ public class GuiCraftAmount extends AEBaseGui
this.amountToCraft.setMaxStringLength( 16 );
this.amountToCraft.setTextColor( 0xFFFFFF );
this.amountToCraft.setVisible( true );
this.amountToCraft.setFocused( true );
this.amountToCraft.setFocused2( true );
this.amountToCraft.setText( "1" );
}
@@ -93,7 +93,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.searchField.setMaxStringLength( 25 );
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setVisible( true );
this.searchField.setFocused( true );
this.searchField.setFocused2( true );
}
@Override
@@ -231,7 +231,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
for( int x = 0; x < current.getInventory().getSlots(); x++ )
{
final String which = Integer.toString( x );
if( invData.hasKey( which ) )
if( invData.contains(which) )
{
current.getInventory().setStackInSlot( x, new ItemStack( invData.getCompoundTag( which ) ) );
}
@@ -76,7 +76,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
this.level.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF );
this.level.setVisible( true );
this.level.setFocused( true );
this.level.setFocused2( true );
( (ContainerLevelEmitter) this.inventorySlots ).setTextField( this.level );
}
@@ -95,7 +95,7 @@ public class GuiPriority extends AEBaseGui
this.priority.setMaxStringLength( 16 );
this.priority.setTextColor( 0xFFFFFF );
this.priority.setVisible( true );
this.priority.setFocused( true );
this.priority.setFocused2( true );
( (ContainerPriority) this.inventorySlots ).setTextField( this.priority );
}
@@ -54,7 +54,7 @@ public class GuiQuartzKnife extends AEBaseGui
this.name.setMaxStringLength( 32 );
this.name.setTextColor( 0xFFFFFF );
this.name.setVisible( true );
this.name.setFocused( true );
this.name.setFocused2( true );
}
@Override
@@ -24,10 +24,10 @@ import java.util.Map;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
@@ -52,7 +52,7 @@ import appeng.api.config.YesNo;
import appeng.core.localization.ButtonToolTips;
public class GuiImgButton extends GuiButton implements ITooltip
public class GuiImgButton extends Button implements ITooltip
{
private static final Pattern COMPILE = Pattern.compile( "%s" );
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
@@ -298,8 +298,8 @@ public class GuiImgButton extends GuiButton implements ITooltip
if( displayName != null )
{
String name = I18n.translateToLocal( displayName );
String value = I18n.translateToLocal( displayValue );
String name = I18n.format( displayName );
String value = I18n.format( displayValue );
if( name == null || name.isEmpty() )
{
@@ -20,10 +20,10 @@ package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.widget.TextFieldWidget;
public class GuiNumberBox extends GuiTextField
public class GuiNumberBox extends TextFieldWidget
{
private final Class type;
@@ -20,14 +20,14 @@ package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.ResourceLocation;
import appeng.container.interfaces.IProgressProvider;
import appeng.core.localization.GuiText;
public class GuiProgressBar extends GuiButton implements ITooltip
public class GuiProgressBar extends Button implements ITooltip
{
private final IProgressProvider source;
@@ -20,7 +20,7 @@ package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
@@ -28,7 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class GuiTabButton extends GuiButton implements ITooltip
public class GuiTabButton extends Button implements ITooltip
{
private final RenderItem itemRenderer;
private final String message;
@@ -22,13 +22,13 @@ package appeng.client.gui.widgets;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
public class GuiToggleButton extends GuiButton implements ITooltip
public class GuiToggleButton extends Button implements ITooltip
{
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
private final int iconIdxOn;
@@ -87,8 +87,8 @@ public class GuiToggleButton extends GuiButton implements ITooltip
{
if( this.displayName != null )
{
String name = I18n.translateToLocal( this.displayName );
String value = I18n.translateToLocal( this.displayHint );
String name = I18n.format( this.displayName );
String value = I18n.format( this.displayHint );
if( name == null || name.isEmpty() )
{
@@ -20,7 +20,7 @@ package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -35,7 +35,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
*
* The rendering does pay attention to the size of the '_' caret.
*/
public class MEGuiTextField extends GuiTextField
public class MEGuiTextField extends TextFieldWidget
{
private static final int PADDING = 2;
@@ -75,7 +75,7 @@ public class MEGuiTextField extends GuiTextField
final boolean requiresFocus = this.isMouseIn( xPos, yPos );
if( !this.isFocused() )
{
this.setFocused( requiresFocus );
this.setFocused2( requiresFocus );
}
return true;
@@ -21,7 +21,7 @@ package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import appeng.tile.inventory.AppEngInternalInventory;
@@ -45,10 +45,10 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
public String getName()
{
final String s = I18n.translateToLocal( this.unlocalizedName + ".name" );
final String s = I18n.format( this.unlocalizedName + ".name" );
if( s.equals( this.unlocalizedName + ".name" ) )
{
return I18n.translateToLocal( this.unlocalizedName );
return I18n.format( this.unlocalizedName );
}
return s;
}
@@ -40,6 +40,7 @@ import appeng.core.AEConfig;
import appeng.fluids.util.FluidSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import net.minecraft.util.text.ITextComponent;
/**
@@ -132,11 +133,11 @@ public class FluidRepo
if( terminalSearchToolTips && notDone && !searchMod )
{
final List<String> tooltip = Platform.getTooltip( fs );
final List<ITextComponent> tooltip = Platform.getTooltip( fs );
for( final String line : tooltip )
for( final ITextComponent line : tooltip )
{
if( m.matcher( line ).find() )
if( m.matcher( line.getString() ).find() )
{
foundMatchingFluidStack = true;
break;
+4 -3
View File
@@ -45,6 +45,7 @@ import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import net.minecraft.util.text.ITextComponent;
public class ItemRepo
@@ -180,11 +181,11 @@ public class ItemRepo
if( terminalSearchToolTips && notDone && !searchMod )
{
final List<String> tooltip = Platform.getTooltip( is );
final List<ITextComponent> tooltip = Platform.getTooltip( is );
for( final String line : tooltip )
for( final ITextComponent line : tooltip )
{
if( m.matcher( line ).find() )
if( m.matcher( line.getString() ).find() )
{
foundMatchingItemStack = true;
notDone = false;
@@ -40,7 +40,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ItemLayerModel;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -24,7 +24,7 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.GlStateManager;
@@ -55,7 +55,7 @@ public class SpatialSkyRender extends IRenderHandler
}
@Override
public void render( final float partialTicks, final WorldClient world, final Minecraft mc )
public void render(final float partialTicks, final ClientWorld world, final Minecraft mc )
{
final long now = System.currentTimeMillis();
@@ -46,7 +46,7 @@ public class TesrRenderHelper
*/
public static void moveToFace( Direction face )
{
GlStateManager.translate( face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50 );
GlStateManager.translate( face.getXOffset() * 0.50, face.getYOffset() * 0.50, face.getZOffset() * 0.50 );
}
/**
@@ -434,7 +434,7 @@ public class CubeBuilder
builder.put( i, x, y, z );
break;
case NORMAL:
builder.put( i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ() );
builder.put( i, face.getXOffset(), face.getYOffset(), face.getZOffset() );
break;
case COLOR:
// Color format is RGBA
@@ -222,7 +222,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel
@Override
public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity )
{
boolean shiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
boolean shiftHeld = Keyboard.isKeyDown( GLFW.GLFW_KEY_LSHIFT ) || Keyboard.isKeyDown( GLFW.GLFW_KEY_RSHIFT );
if( shiftHeld )
{
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
@@ -19,7 +19,10 @@
package appeng.client.render.effects;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
@@ -48,8 +51,8 @@ public class AssemblerFX extends Particle implements ICanDie
this.speed = speed;
final ItemStack displayItem = is.asItemStackRepresentation();
this.fi = new EntityFloatingItem( this, w, x, y, z, displayItem );
w.spawnEntity( this.fi );
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
w.addEntity( this.fi );
this.maxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
}
@Override
@@ -66,13 +69,13 @@ public class AssemblerFX extends Particle implements ICanDie
}
@Override
public void onUpdate()
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if( this.particleAge++ >= this.particleMaxAge )
if( this.age++ >= this.maxAge )
{
this.setExpired();
}
@@ -85,19 +88,25 @@ public class AssemblerFX extends Particle implements ICanDie
if( this.isExpired )
{
this.fi.setDead();
this.fi.remove();
}
else
{
final float lifeSpan = (float) this.particleAge / (float) this.particleMaxAge;
final float lifeSpan = (float) this.age / (float) this.maxAge;
this.fi.setProgress( lifeSpan );
}
}
@Override
public void renderParticle( final BufferBuilder par1Tessellator, final Entity p_180434_2_, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )
public IParticleRenderType getRenderType() {
// TODO: FIXME
return IParticleRenderType.NO_RENDER;
}
@Override
public void renderParticle( IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks )
{
this.time += l;
this.time += partialTicks;
if( this.time > 4.0 )
{
this.time -= 4.0;
@@ -19,11 +19,11 @@
package appeng.client.render.effects;
import net.minecraft.client.particle.ParticleRedstone;
import net.minecraft.client.particle.RedstoneParticle;
import net.minecraft.world.World;
public class ChargedOreFX extends ParticleRedstone
public class ChargedOreFX extends RedstoneParticle
{
public ChargedOreFX( final World w, final double x, final double y, final double z, final float r, final float g, final float b )
@@ -19,7 +19,8 @@
package appeng.client.render.effects;
import net.minecraft.client.particle.ParticleBreaking;
import net.minecraft.client.particle.BreakingParticle;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
@@ -34,7 +35,7 @@ import appeng.client.render.textures.ParticleTextures;
@OnlyIn( Dist.CLIENT )
public class CraftingFx extends ParticleBreaking
public class CraftingFx extends BreakingParticle
{
private final TextureAtlasSprite particleTextureIndex;
@@ -53,11 +54,11 @@ public class CraftingFx extends ParticleBreaking
this.particleAlpha = 1.3f;
this.particleScale = 1.5f;
this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
this.particleMaxAge /= 1.2;
this.maxAge /= 1.2;
this.startBlkX = MathHelper.floor( this.posX );
this.startBlkY = MathHelper.floor( this.posY );
this.startBlkZ = MathHelper.floor( this.posZ );
this.startBlkX = MathHelper.floor( this.getPosX() );
this.startBlkY = MathHelper.floor( this.getPosY() );
this.startBlkZ = MathHelper.floor( this.getPosZ() );
}
@Override
@@ -66,6 +67,12 @@ public class CraftingFx extends ParticleBreaking
return 1;
}
@Override
public IParticleRenderType getRenderType() {
// TODO: FIXME
return IParticleRenderType.NO_RENDER;
}
@Override
public void renderParticle( final BufferBuilder par1Tessellator, final Entity p_180434_2_, final float partialTick, final float x, final float y, final float z, final float rx, final float rz )
{
@@ -80,9 +87,9 @@ public class CraftingFx extends ParticleBreaking
final float f9 = this.particleTextureIndex.getMaxV();
final float scale = 0.1F * this.particleScale;
float offX = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
float offX = (float) ( this.prevPosX + ( this.getPosX() - this.prevPosX ) * partialTick );
float offY = (float) ( this.prevPosY + ( this.getPosY() - this.prevPosY ) * partialTick );
float offZ = (float) ( this.prevPosZ + ( this.getPosZ() - this.prevPosZ ) * partialTick );
final int blkX = MathHelper.floor( offX );
final int blkY = MathHelper.floor( offY );
@@ -124,20 +131,20 @@ public class CraftingFx extends ParticleBreaking
public void fromItem( final AEPartLocation d )
{
this.posX += 0.2 * d.xOffset;
this.posY += 0.2 * d.yOffset;
this.posZ += 0.2 * d.zOffset;
this.getPosX() += 0.2 * d.xOffset;
this.getPosY() += 0.2 * d.yOffset;
this.getPosZ() += 0.2 * d.zOffset;
this.particleScale *= 0.8f;
}
@Override
public void onUpdate()
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.prevPosX = this.getPosX();
this.prevPosY = this.getPosY();
this.prevPosZ = this.getPosZ();
if( this.particleAge++ >= this.particleMaxAge )
if( this.age++ >= this.maxAge )
{
this.setExpired();
}
@@ -19,7 +19,8 @@
package appeng.client.render.effects;
import net.minecraft.client.particle.ParticleBreaking;
import net.minecraft.client.particle.BreakingParticle;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
@@ -34,7 +35,7 @@ import appeng.client.render.textures.ParticleTextures;
@OnlyIn( Dist.CLIENT )
public class EnergyFx extends ParticleBreaking
public class EnergyFx extends BreakingParticle
{
private final TextureAtlasSprite particleTextureIndex;
@@ -54,9 +55,9 @@ public class EnergyFx extends ParticleBreaking
this.particleScale = 3.5f;
this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
this.startBlkX = MathHelper.floor( this.posX );
this.startBlkY = MathHelper.floor( this.posY );
this.startBlkZ = MathHelper.floor( this.posZ );
this.startBlkX = MathHelper.floor( this.getPosX() );
this.startBlkY = MathHelper.floor( this.getPosY() );
this.startBlkZ = MathHelper.floor( this.getPosZ() );
}
@Override
@@ -65,6 +66,12 @@ public class EnergyFx extends ParticleBreaking
return 1;
}
@Override
public IParticleRenderType getRenderType() {
// TODO: FIXME
return IParticleRenderType.NO_RENDER;
}
@Override
public void renderParticle( final BufferBuilder par1Tessellator, final Entity p_180434_2_, final float partialTicks, final float par3, final float par4, final float par5, final float par6, final float par7 )
{
@@ -74,13 +81,13 @@ public class EnergyFx extends ParticleBreaking
final float f9 = this.particleTextureIndex.getMaxV();
final float f10 = 0.1F * this.particleScale;
final float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTicks - interpPosX );
final float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTicks - interpPosY );
final float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTicks - interpPosZ );
final float f11 = (float) ( this.prevPosX + ( this.getPosX() - this.prevPosX ) * partialTicks - interpPosX );
final float f12 = (float) ( this.prevPosY + ( this.getPosY() - this.prevPosY ) * partialTicks - interpPosY );
final float f13 = (float) ( this.prevPosZ + ( this.getPosZ() - this.prevPosZ ) * partialTicks - interpPosZ );
final int blkX = MathHelper.floor( this.posX );
final int blkY = MathHelper.floor( this.posY );
final int blkZ = MathHelper.floor( this.posZ );
final int blkX = MathHelper.floor( this.getPosX() );
final int blkY = MathHelper.floor( this.getPosY() );
final int blkZ = MathHelper.floor( this.getPosZ() );
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
@@ -114,20 +121,20 @@ public class EnergyFx extends ParticleBreaking
public void fromItem( final AEPartLocation d )
{
this.posX += 0.2 * d.xOffset;
this.posY += 0.2 * d.yOffset;
this.posZ += 0.2 * d.zOffset;
this.getPosX() += 0.2 * d.xOffset;
this.getPosY() += 0.2 * d.yOffset;
this.getPosZ() += 0.2 * d.zOffset;
this.particleScale *= 0.8f;
}
@Override
public void onUpdate()
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.prevPosX = this.getPosX();
this.prevPosY = this.getPosY();
this.prevPosZ = this.getPosZ();
if( this.particleAge++ >= this.particleMaxAge )
if( this.age++ >= this.maxAge )
{
this.setExpired();
}
@@ -22,6 +22,7 @@ package appeng.client.render.effects;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
@@ -55,7 +56,7 @@ public class LightningFX extends Particle
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
this.particleMaxAge = maxAge;
this.maxAge = maxAge;
}
protected void regen()
@@ -77,13 +78,19 @@ public class LightningFX extends Particle
}
@Override
public void onUpdate()
public IParticleRenderType getRenderType() {
// TODO: FIXME
return IParticleRenderType.NO_RENDER;
}
@Override
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if( this.particleAge++ >= this.particleMaxAge )
if( this.age++ >= this.maxAge )
{
this.setExpired();
}
@@ -104,7 +111,7 @@ public class LightningFX extends Particle
float blue = this.particleBlue * j;
final float alpha = this.particleAlpha;
if( this.particleAge == 3 )
if( this.age == 3 )
{
this.regen();
}
@@ -157,9 +164,9 @@ public class LightningFX extends Particle
{
this.clear();
double x = ( this.prevPosX + ( this.posX - this.prevPosX ) * l - interpPosX ) - offX;
double y = ( this.prevPosY + ( this.posY - this.prevPosY ) * l - interpPosY ) - offY;
double z = ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * l - interpPosZ ) - offZ;
double x = ( this.prevPosX + ( this.getPosX() - this.prevPosX ) * l - interpPosX ) - offX;
double y = ( this.prevPosY + ( this.getPosY() - this.prevPosY ) * l - interpPosY ) - offY;
double z = ( this.prevPosZ + ( this.getPosZ() - this.prevPosZ ) * l - interpPosZ ) - offZ;
for( int s = 0; s < LightningFX.STEPS; s++ )
{
@@ -19,23 +19,24 @@
package appeng.client.render.effects;
import net.minecraft.client.particle.ParticleBreaking;
import net.minecraft.client.particle.BreakingParticle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.client.render.textures.ParticleTextures;
public class MatterCannonFX extends ParticleBreaking
public class MatterCannonFX extends BreakingParticle
{
private final TextureAtlasSprite particleTextureIndex;
public MatterCannonFX( final World par1World, final double par2, final double par4, final double par6, final Item par8Item )
public MatterCannonFX( final World par1World, final double par2, final double par4, final double par6, final ItemStack par8Item )
{
super( par1World, par2, par4, par6, par8Item );
this.particleGravity = 0;
@@ -56,13 +57,13 @@ public class MatterCannonFX extends ParticleBreaking
}
@Override
public void onUpdate()
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if( this.particleAge++ >= this.particleMaxAge )
if( this.age++ >= this.maxAge )
{
this.setExpired();
}
@@ -42,10 +42,10 @@ public class VibrantFX extends Particle
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.particleMaxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
this.prevPosX = this.getPosX();
this.prevPosY = this.getPosY();
this.prevPosZ = this.getPosZ();
this.maxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
}
@Override
@@ -59,18 +59,18 @@ public class VibrantFX extends Particle
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
public void tick()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.prevPosX = this.getPosX();
this.prevPosY = this.getPosY();
this.prevPosZ = this.getPosZ();
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.particleScale *= 0.95;
if( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
if( this.maxAge <= 0 || this.particleScale < 0.1 )
{
this.setExpired();
}
this.particleMaxAge--;
this.maxAge--;
}
}
@@ -344,7 +344,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
}
}
data.setBoolean( "clear", true );
data.putBoolean("clear", true);
for( final Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet() )
{
@@ -376,8 +376,8 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
if( tag.hasNoTags() )
{
tag.setLong( "sortBy", inv.sortBy );
tag.setString( "un", inv.unlocalizedName );
tag.putLong( "sortBy", inv.sortBy );
tag.putString("un", inv.unlocalizedName);
}
for( int x = 0; x < length; x++ )
@@ -391,7 +391,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
if( !is.isEmpty() )
{
is.writeToNBT( itemNBT );
is.write(itemNBT);
}
tag.setTag( Integer.toString( x + offset ), itemNBT );
@@ -27,7 +27,6 @@ import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.util.Platform;
public class ContainerNetworkTool extends AEBaseContainer
@@ -59,8 +58,8 @@ public class ContainerNetworkTool extends AEBaseContainer
public void toggleFacadeMode()
{
final CompoundNBT data = Platform.openNbtData( this.toolInv.getItemStack() );
data.setBoolean( "hideFacades", !data.getBoolean( "hideFacades" ) );
final CompoundNBT data = this.toolInv.getItemStack().getOrCreateTag();
data.putBoolean("hideFacades", !data.getBoolean( "hideFacades" ));
this.detectAndSendChanges();
}
@@ -90,7 +89,7 @@ public class ContainerNetworkTool extends AEBaseContainer
if( this.isValidContainer() )
{
final CompoundNBT data = Platform.openNbtData( currentItem );
final CompoundNBT data = currentItem.getOrCreateTag();
this.setFacadeMode( data.getBoolean( "hideFacades" ) );
}
@@ -263,8 +263,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "crafting", this.isCraftingMode() );
encodedValue.setBoolean( "substitute", this.isSubstitute() );
encodedValue.putBoolean("crafting", this.isCraftingMode());
encodedValue.putBoolean("substitute", this.isSubstitute());
output.setTagCompound( encodedValue );
}
@@ -348,7 +348,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
if( !i.isEmpty() )
{
i.writeToNBT( c );
i.write(c);
}
return c;
@@ -123,8 +123,8 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
return AEApi.instance().definitions().materials().namePress().maybeStack( 1 ).map( namePressStack ->
{
final CompoundNBT compound = Platform.openNbtData( namePressStack );
compound.setString( "InscribeName", ContainerQuartzKnife.this.myName );
final CompoundNBT compound = namePressStack.getOrCreateTag();
compound.putString("InscribeName", ContainerQuartzKnife.this.myName);
return namePressStack;
} ).orElse( ItemStack.EMPTY );
@@ -152,7 +152,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
{
final List<ItemStack> drops = new ArrayList<>();
drops.add( extra );
Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
Platform.spawnDrops( who.world, new BlockPos( (int) who.getPosX(), (int) who.getPosY(), (int) who.getPosZ() ), drops );
return;
}
}
@@ -319,7 +319,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if( drops.size() > 0 )
{
Platform.spawnDrops( p.world, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
Platform.spawnDrops( p.world, new BlockPos( (int) p.getPosX(), (int) p.getPosY(), (int) p.getPosZ() ), drops );
}
}
+430 -368
View File
@@ -19,43 +19,41 @@
package appeng.core;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import com.google.common.collect.Sets;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import appeng.api.config.CondenserOutput;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.config.*;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.core.features.AEFeature;
import appeng.core.settings.TickRates;
import appeng.items.materials.MaterialType;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import org.apache.commons.lang3.tuple.Pair;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public final class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
import static net.minecraftforge.common.ForgeConfigSpec.*;
@Mod.EventBusSubscriber(modid = AppEng.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public final class AEConfig implements IConfigurableObject, IConfigManagerHost
{
public static final ClientConfig CLIENT;
public static final ForgeConfigSpec CLIENT_SPEC;
static {
final Pair<ClientConfig, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new);
CLIENT_SPEC = specPair.getRight();
CLIENT = specPair.getLeft();
}
public static final String VERSION = "@version@";
public static final String CHANNEL = "@aechannel@";
public static final String PACKET_CHANNEL = "AE";
@@ -76,265 +74,201 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private final IConfigManager settings = new ConfigManager( this );
private final EnumSet<AEFeature> featureFlags = EnumSet.noneOf( AEFeature.class );
private final File configFile;
private boolean updatable = false;
// Misc
private boolean removeCrashingItemsOnLoad = false;
private int formationPlaneEntityLimit = 128;
private boolean enableEffects = true;
private boolean useLargeFonts = false;
private boolean removeCrashingItemsOnLoad;
private int formationPlaneEntityLimit;
private boolean enableEffects;
private boolean useLargeFonts;
private boolean useColoredCraftingStatus;
private boolean disableColoredCableRecipesInJEI = true;
private int craftingCalculationTimePerTick = 5;
private PowerUnits selectedPowerUnit = PowerUnits.AE;
private boolean disableColoredCableRecipesInJEI;
private int craftingCalculationTimePerTick;
private PowerUnits selectedPowerUnit;
// GUI Buttons
private final int[] craftByStacks = { 1, 10, 100, 1000 };
private final int[] priorityByStacks = { 1, 10, 100, 1000 };
private final int[] levelByStacks = { 1, 10, 100, 1000 };
private int[] craftByStacks = new int[4];
private int[] priorityByStacks = new int[4];
private int[] levelByStacks = new int[4];
private final int[] levelByMillibuckets = { 10, 100, 1000, 10000 };
// Spatial IO/Dimension
private int storageProviderID = -1;
private int storageDimensionID = -1;
private double spatialPowerExponent = 1.35;
private double spatialPowerMultiplier = 1250.0;
private String storageProviderID;
private String storageDimensionID;
private double spatialPowerExponent;
private double spatialPowerMultiplier;
// Grindstone
private String[] grinderOres = Stream.of( ORES_VANILLA, ORES_AE, ORES_COMMON, ORES_MISC ).flatMap( Stream::of ).toArray( String[]::new );
private List<String> grinderOres;
private Set<String> grinderBlackList;
private double oreDoublePercentage = 90.0;
private double oreDoublePercentage;
// Batteries
private int wirelessTerminalBattery = 1600000;
private int entropyManipulatorBattery = 200000;
private int matterCannonBattery = 200000;
private int portableCellBattery = 20000;
private int colorApplicatorBattery = 20000;
private int chargedStaffBattery = 8000;
private int wirelessTerminalBattery;
private int entropyManipulatorBattery;
private int matterCannonBattery;
private int portableCellBattery;
private int colorApplicatorBattery;
private int chargedStaffBattery;
// Certus quartz
private float spawnChargedChance = 0.92f;
private int quartzOresPerCluster = 4;
private int quartzOresClusterAmount = 15;
private int chargedChange = 4;
private float spawnChargedChance;
private int quartzOresPerCluster;
private int quartzOresClusterAmount;
// Meteors
private int minMeteoriteDistance = 707;
private int minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
private double meteoriteClusterChance = 0.1;
private int meteoriteMaximumSpawnHeight = 180;
private int[] meteoriteDimensionWhitelist = { 0 };
private int minMeteoriteDistance;
private int minMeteoriteDistanceSq;
private double meteoriteClusterChance;
private int meteoriteMaximumSpawnHeight;
private Set<String> meteoriteDimensionWhitelist;
// Wireless
private double wirelessBaseCost = 8;
private double wirelessCostMultiplier = 1;
private double wirelessTerminalDrainMultiplier = 1;
private double wirelessBaseRange = 16;
private double wirelessBoosterRangeMultiplier = 1;
private double wirelessBoosterExp = 1.5;
private double wirelessHighWirelessCount = 64;
private double wirelessBaseCost;
private double wirelessCostMultiplier;
private double wirelessTerminalDrainMultiplier;
private double wirelessBaseRange;
private double wirelessBoosterRangeMultiplier;
private double wirelessBoosterExp;
private double wirelessHighWirelessCount;
// Tunnels
public static final double TUNNEL_POWER_LOSS = 0.05;
private AEConfig( final File configFile )
{
super( configFile );
this.configFile = configFile;
// FIXME: this is shit, move this concern out of the config class
@SubscribeEvent
public static void onModConfigEvent(final ModConfig.ModConfigEvent configEvent) {
if (configEvent.getConfig().getSpec() == CLIENT_SPEC) {
AEConfig.instance().syncConfig(CLIENT);
}
}
MinecraftForge.EVENT_BUS.register( this );
private void syncConfig(ClientConfig config) {
PowerUnits.EU.conversionRatio = this.get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
PowerUnits.RF.conversionRatio = this.get( "PowerRatios", "ForgeEnergy", DEFAULT_RF_EXCHANGE ).getDouble( DEFAULT_RF_EXCHANGE );
PowerUnits.EU.conversionRatio = config.powerRatioIc2.get();
PowerUnits.RF.conversionRatio = config.powerRatioForgeEnergy.get();
PowerMultiplier.CONFIG.multiplier = config.powerUsageMultiplier.get();
final double usageEffective = this.get( "PowerRatios", "UsageMultiplier", 1.0 ).getDouble( 1.0 );
PowerMultiplier.CONFIG.multiplier = Math.max( 0.01, usageEffective );
CondenserOutput.MATTER_BALLS.requiredPower = config.condenserMatterBallsPower.get();
CondenserOutput.SINGULARITY.requiredPower = config.condenserSingularityPower.get();
CondenserOutput.MATTER_BALLS.requiredPower = this.get( "Condenser", "MatterBalls", 256 ).getInt( 256 );
CondenserOutput.SINGULARITY.requiredPower = this.get( "Condenser", "Singularity", 256000 ).getInt( 256000 );
this.grinderOres = new ArrayList<>(config.grinderOres.get());
this.grinderBlackList = new HashSet<>(config.grinderBlackList.get());
this.oreDoublePercentage = config.oreDoublePercentage.get();
this.removeCrashingItemsOnLoad = this.get( "general", "removeCrashingItemsOnLoad", false,
"Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!" ).getBoolean();
// FIXME: why is this here exactly???
this.settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
this.settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
this.settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
this.setCategoryComment( "GrindStone",
"Creates recipe of the following pattern automatically: '1 oreTYPE => 2 dustTYPE' and '(1 ingotTYPE or 1 crystalTYPE or 1 gemTYPE) => 1 dustTYPE'" );
this.grinderOres = this.get( "GrindStone", "grinderOres", this.grinderOres, "The list of types to handle. Specify without a prefix like ore or dust." )
.getStringList();
this.grinderBlackList = Sets.newHashSet(
this.get( "GrindStone", "blacklist", new String[] {}, "Blacklists the exact oredict name from being handled by any recipe." )
.getStringList() );
this.oreDoublePercentage = this
.get( "GrindStone", "oreDoublePercentage", this.oreDoublePercentage, "Chance to actually get an output with stacksize > 1." )
.getDouble( this.oreDoublePercentage );
this.spawnChargedChance = (float) (1.0 - config.spawnChargedChance.get());
this.minMeteoriteDistance = config.minMeteoriteDistance.get();
this.minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
this.meteoriteClusterChance = config.meteoriteClusterChance.get();
this.meteoriteMaximumSpawnHeight = config.meteoriteMaximumSpawnHeight.get();
this.meteoriteDimensionWhitelist = new HashSet<>(config.meteoriteDimensionWhitelist.get());
this.settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
this.settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
this.settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
this.quartzOresPerCluster = config.quartzOresPerCluster.get();
this.quartzOresClusterAmount = config.quartzOresPerCluster.get();
this.spawnChargedChance = (float) ( 1.0 - this.get( "worldGen", "spawnChargedChance", 1.0 - this.spawnChargedChance )
.getDouble(
1.0 - this.spawnChargedChance ) );
this.minMeteoriteDistance = this.get( "worldGen", "minMeteoriteDistance", this.minMeteoriteDistance ).getInt( this.minMeteoriteDistance );
this.meteoriteClusterChance = this.get( "worldGen", "meteoriteClusterChance", this.meteoriteClusterChance ).getDouble( this.meteoriteClusterChance );
this.meteoriteMaximumSpawnHeight = this.get( "worldGen", "meteoriteMaximumSpawnHeight", this.meteoriteMaximumSpawnHeight )
.getInt(
this.meteoriteMaximumSpawnHeight );
this.meteoriteDimensionWhitelist = this.get( "worldGen", "meteoriteDimensionWhitelist", this.meteoriteDimensionWhitelist ).getIntList();
this.wirelessBaseCost = config.wirelessBaseCost.get();
this.wirelessCostMultiplier = config.wirelessCostMultiplier.get();
this.wirelessBaseRange = config.wirelessBaseRange.get();
this.wirelessBoosterRangeMultiplier = config.wirelessBoosterRangeMultiplier.get();
this.wirelessBoosterExp = config.wirelessBoosterExp.get();
this.wirelessTerminalDrainMultiplier = config.wirelessTerminalDrainMultiplier.get();
this.quartzOresPerCluster = this.get( "worldGen", "quartzOresPerCluster", this.quartzOresPerCluster ).getInt( this.quartzOresPerCluster );
this.quartzOresClusterAmount = this.get( "worldGen", "quartzOresClusterAmount", this.quartzOresClusterAmount ).getInt( this.quartzOresClusterAmount );
this.formationPlaneEntityLimit = config.formationPlaneEntityLimit.get();
this.minMeteoriteDistanceSq = this.minMeteoriteDistance * this.minMeteoriteDistance;
this.wirelessTerminalBattery = config.wirelessTerminalBattery.get();
this.chargedStaffBattery = config.chargedStaffBattery.get();
this.entropyManipulatorBattery = config.entropyManipulatorBattery.get();
this.portableCellBattery = config.portableCellBattery.get();
this.colorApplicatorBattery = config.colorApplicatorBattery.get();
this.matterCannonBattery = config.matterCannonBattery.get();
this.addCustomCategoryComment( "wireless",
"Range= wirelessBaseRange + wirelessBoosterRangeMultiplier * Math.pow( boosters, wirelessBoosterExp )\nPowerDrain= wirelessBaseCost + wirelessCostMultiplier * Math.pow( boosters, 1 + boosters / wirelessHighWirelessCount )" );
this.clientSync(config);
this.wirelessBaseCost = this.get( "wireless", "wirelessBaseCost", this.wirelessBaseCost ).getDouble( this.wirelessBaseCost );
this.wirelessCostMultiplier = this.get( "wireless", "wirelessCostMultiplier", this.wirelessCostMultiplier ).getDouble( this.wirelessCostMultiplier );
this.wirelessBaseRange = this.get( "wireless", "wirelessBaseRange", this.wirelessBaseRange ).getDouble( this.wirelessBaseRange );
this.wirelessBoosterRangeMultiplier = this.get( "wireless", "wirelessBoosterRangeMultiplier", this.wirelessBoosterRangeMultiplier )
.getDouble(
this.wirelessBoosterRangeMultiplier );
this.wirelessBoosterExp = this.get( "wireless", "wirelessBoosterExp", this.wirelessBoosterExp ).getDouble( this.wirelessBoosterExp );
this.wirelessTerminalDrainMultiplier = this.get( "wireless", "wirelessTerminalDrainMultiplier", this.wirelessTerminalDrainMultiplier )
.getDouble(
this.wirelessTerminalDrainMultiplier );
this.formationPlaneEntityLimit = this.get( "automation", "formationPlaneEntityLimit", this.formationPlaneEntityLimit )
.getInt(
this.formationPlaneEntityLimit );
this.wirelessTerminalBattery = this.get( "battery", "wirelessTerminal", this.wirelessTerminalBattery ).getInt( this.wirelessTerminalBattery );
this.chargedStaffBattery = this.get( "battery", "chargedStaff", this.chargedStaffBattery ).getInt( this.chargedStaffBattery );
this.entropyManipulatorBattery = this.get( "battery", "entropyManipulator", this.entropyManipulatorBattery ).getInt( this.entropyManipulatorBattery );
this.portableCellBattery = this.get( "battery", "portableCell", this.portableCellBattery ).getInt( this.portableCellBattery );
this.colorApplicatorBattery = this.get( "battery", "colorApplicator", this.colorApplicatorBattery ).getInt( this.colorApplicatorBattery );
this.matterCannonBattery = this.get( "battery", "matterCannon", this.matterCannonBattery ).getInt( this.matterCannonBattery );
this.clientSync();
this.addCustomCategoryComment( "features", "Warning: Disabling a feature may disable other features depending on it." );
for( final AEFeature feature : AEFeature.values() )
{
if( feature.isVisible() )
this.featureFlags.clear();
for( final AEFeature feature : AEFeature.values() )
{
final Property option = this.get( "Features." + feature.category(), feature.key(), feature.isEnabled(), feature.comment() );
if( option.getBoolean( feature.isEnabled() ) )
if( feature.isVisible() )
{
if (config.enabledFeatures.get(feature).get()) {
this.featureFlags.add(feature);
}
}
else
{
this.featureFlags.add( feature );
}
}
else
// FIXME final ModContainer imb = net.minecraftforge.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
// FIXME if( imb != null )
// FIXME {
// FIXME final List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
// FIXME if( version.contains( imb.getVersion() ) )
// FIXME {
// FIXME this.featureFlags.remove( AEFeature.ALPHA_PASS );
// FIXME }
// FIXME }
for( final TickRates tr : TickRates.values() )
{
this.featureFlags.add( feature );
tr.Load( this );
}
}
final ModContainer imb = net.minecraftforge.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
if( imb != null )
{
final List<String> version = Arrays.asList( "59.0.0", "59.0.1", "59.0.2" );
if( version.contains( imb.getVersion() ) )
{
this.featureFlags.remove( AEFeature.ALPHA_PASS );
}
}
this.storageProviderID = config.storageProviderID.get();
this.storageDimensionID = config.storageDimensionID.get();
this.spatialPowerMultiplier = config.spatialPowerMultiplier.get();
this.spatialPowerExponent = config.spatialPowerExponent.get();
try
{
this.selectedPowerUnit = PowerUnits.valueOf(
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).getString() );
}
catch( final Throwable t )
{
this.selectedPowerUnit = PowerUnits.AE;
}
for( final TickRates tr : TickRates.values() )
{
tr.Load( this );
}
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
{
this.storageProviderID = this.get( "spatialio", "storageProviderID", this.storageProviderID ).getInt( this.storageProviderID );
this.storageDimensionID = this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).getInt( this.storageDimensionID );
this.spatialPowerMultiplier = this.get( "spatialio", "spatialPowerMultiplier", this.spatialPowerMultiplier )
.getDouble(
this.spatialPowerMultiplier );
this.spatialPowerExponent = this.get( "spatialio", "spatialPowerExponent", this.spatialPowerExponent ).getDouble( this.spatialPowerExponent );
}
if( this.isFeatureEnabled( AEFeature.CRAFTING_CPU ) )
{
this.craftingCalculationTimePerTick = this.get( "craftingCPU", "craftingCalculationTimePerTick", this.craftingCalculationTimePerTick )
.getInt(
this.craftingCalculationTimePerTick );
}
this.craftingCalculationTimePerTick = config.craftingCalculationTimePerTick.get();
this.updatable = true;
}
public static void init( final File configFile )
{
instance = new AEConfig( configFile );
}
public static AEConfig instance()
{
return instance;
}
private void clientSync()
private void clientSync(ClientConfig config)
{
this.disableColoredCableRecipesInJEI = this.get( "Client", "disableColoredCableRecipesInJEI", true ).getBoolean( true );
this.enableEffects = this.get( "Client", "enableEffects", true ).getBoolean( true );
this.useLargeFonts = this.get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
this.useColoredCraftingStatus = this.get( "Client", "useColoredCraftingStatus", true ).getBoolean( true );
this.disableColoredCableRecipesInJEI = config.disableColoredCableRecipesInJEI.get();
this.enableEffects = config.enableEffects.get();
this.useLargeFonts = config.useLargeFonts.get();
this.useColoredCraftingStatus = config.useColoredCraftingStatus.get();
this.selectedPowerUnit = config.selectedPowerUnit.get();
// load buttons..
for( int btnNum = 0; btnNum < 4; btnNum++ )
{
final Property cmb = this.get( "Client", "craftAmtButton" + ( btnNum + 1 ), this.craftByStacks[btnNum] );
final Property pmb = this.get( "Client", "priorityAmtButton" + ( btnNum + 1 ), this.priorityByStacks[btnNum] );
final Property lmb = this.get( "Client", "levelAmtButton" + ( btnNum + 1 ), this.levelByStacks[btnNum] );
final int buttonCap = (int) ( Math.pow( 10, btnNum + 1 ) - 1 );
this.craftByStacks[btnNum] = Math.abs( cmb.getInt( this.craftByStacks[btnNum] ) );
this.priorityByStacks[btnNum] = Math.abs( pmb.getInt( this.priorityByStacks[btnNum] ) );
this.levelByStacks[btnNum] = Math.abs( pmb.getInt( this.levelByStacks[btnNum] ) );
cmb.setComment( "Controls buttons on Crafting Screen : Capped at " + buttonCap );
pmb.setComment( "Controls buttons on Priority Screen : Capped at " + buttonCap );
lmb.setComment( "Controls buttons on Level Emitter Screen : Capped at " + buttonCap );
this.craftByStacks[btnNum] = Math.min( this.craftByStacks[btnNum], buttonCap );
this.priorityByStacks[btnNum] = Math.min( this.priorityByStacks[btnNum], buttonCap );
this.levelByStacks[btnNum] = Math.min( this.levelByStacks[btnNum], buttonCap );
this.craftByStacks[btnNum] = config.craftByStacks.get(btnNum).get();
this.priorityByStacks[btnNum] = config.priorityByStacks.get(btnNum).get();
this.levelByStacks[btnNum] = config.levelByStacks.get(btnNum).get();
}
for( final Settings e : this.settings.getSettings() )
{
final String Category = "Client"; // e.getClass().getSimpleName();
Enum<?> value = this.settings.getSetting( e );
final Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
try
{
value = Enum.valueOf( value.getClass(), p.getString() );
}
catch( final IllegalArgumentException er )
{
AELog.info( "Invalid value '" + p.getString() + "' for " + e.name() + " using '" + value.name() + "' instead" );
}
this.settings.putSetting( e, value );
}
// FIXME for( final Settings e : this.settings.getSettings() )
// FIXME {
// FIXME final String Category = "Client"; // e.getClass().getSimpleName();
// FIXME Enum<?> value = this.settings.getSetting( e );
// FIXME
// FIXME final Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
// FIXME
// FIXME try
// FIXME {
// FIXME value = Enum.valueOf( value.getClass(), p.getString() );
// FIXME }
// FIXME catch( final IllegalArgumentException er )
// FIXME {
// FIXME AELog.info( "Invalid value '" + p.getString() + "' for " + e.name() + " using '" + value.name() + "' instead" );
// FIXME }
// FIXME
// FIXME this.settings.putSetting( e, value );
// FIXME }
}
private String getListComment( final Enum value )
@@ -387,130 +321,52 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.wirelessBaseCost + this.wirelessCostMultiplier * Math.pow( boosters, 1 + boosters / this.wirelessHighWirelessCount );
}
@Override
public Property get( final String category, final String key, final String defaultValue, final String comment, final Property.Type type )
{
final Property prop = super.get( category, key, defaultValue, comment, type );
// FIXME @Override
// FIXME public Property get( final String category, final String key, final String defaultValue, final String comment, final Property.Type type )
// FIXME {
// FIXME final Property prop = super.get( category, key, defaultValue, comment, type );
// FIXME
// FIXME if( prop != null )
// FIXME {
// FIXME if( !category.equals( "Client" ) )
// FIXME {
// FIXME prop.setRequiresMcRestart( true );
// FIXME }
// FIXME }
// FIXME
// FIXME return prop;
// FIXME }
if( prop != null )
{
if( !category.equals( "Client" ) )
{
prop.setRequiresMcRestart( true );
}
}
return prop;
}
@Override
public void save()
{
if( this.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
{
this.get( "spatialio", "storageProviderID", this.storageProviderID ).set( this.storageProviderID );
this.get( "spatialio", "storageDimensionID", this.storageDimensionID ).set( this.storageDimensionID );
CLIENT.storageProviderID.set(this.storageProviderID);
CLIENT.storageDimensionID.set(this.storageDimensionID);
}
this.get( "Client", "PowerUnit", this.selectedPowerUnit.name(), this.getListComment( this.selectedPowerUnit ) ).set( this.selectedPowerUnit.name() );
CLIENT.selectedPowerUnit.set(this.selectedPowerUnit);
if( this.hasChanged() )
{
super.save();
}
}
@SubscribeEvent
public void onConfigChanged( final ConfigChangedEvent.OnConfigChangedEvent eventArgs )
{
if( eventArgs.getModID().equals( AppEng.MOD_ID ) )
{
this.clientSync();
}
}
public boolean disableColoredCableRecipesInJEI()
{
return this.disableColoredCableRecipesInJEI;
}
public String getFilePath()
{
return this.configFile.toString();
}
public boolean useAEVersion( final MaterialType mt )
{
if( this.isFeatureEnabled( AEFeature.WEBSITE_RECIPES ) )
{
return true;
}
this.setCategoryComment( "OreCamouflage",
"AE2 Automatically uses alternative ores present in your instance of MC to blend better with its surroundings, if you prefer you can disable this selectively using these flags; Its important to note, that some if these items even if enabled may not be craftable in game because other items are overriding their recipes." );
final Property p = this.get( "OreCamouflage", mt.name(), true );
p.setComment( "OreDictionary Names: " + mt.getOreName() );
return !p.getBoolean( true );
CLIENT_SPEC.save();
}
@Override
public void updateSetting( final IConfigManager manager, final Enum setting, final Enum newValue )
{
for( final Settings e : this.settings.getSettings() )
{
if( e == setting )
{
final String Category = "Client";
final Property p = this.get( Category, e.name(), this.settings.getSetting( e ).name(), this.getListComment( newValue ) );
p.set( newValue.name() );
}
}
if( this.updatable )
{
this.save();
}
}
public int getFreeMaterial( final int varID )
{
return this.getFreeIDSLot( varID, "materials" );
}
public int getFreeIDSLot( final int varID, final String category )
{
boolean alreadyUsed = false;
int min = 0;
for( final Property p : this.getCategory( category ).getValues().values() )
{
final int thisInt = p.getInt();
if( varID == thisInt )
{
alreadyUsed = true;
}
min = Math.max( min, thisInt + 1 );
}
if( alreadyUsed )
{
if( min < 16383 )
{
min = 16383;
}
return min;
}
return varID;
}
public int getFreePart( final int varID )
{
return this.getFreeIDSLot( varID, "parts" );
// FIXME for( final Settings e : this.settings.getSettings() )
// FIXME {
// FIXME if( e == setting )
// FIXME {
// FIXME final String Category = "Client";
// FIXME final Property p = this.get( Category, e.name(), this.settings.getSetting( e ).name(), this.getListComment( newValue ) );
// FIXME p.set( newValue.name() );
// FIXME }
// FIXME }
// FIXME
// FIXME if( this.updatable )
// FIXME {
// FIXME this.save();
// FIXME }
}
@Override
@@ -544,29 +400,29 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.levelByMillibuckets[i];
}
public Enum getSetting( final String category, final Class<? extends Enum> class1, final Enum myDefault )
{
final String name = class1.getSimpleName();
final Property p = this.get( category, name, myDefault.name() );
// FIXME public Enum getSetting( final String category, final Class<? extends Enum> class1, final Enum myDefault )
// FIXME {
// FIXME final String name = class1.getSimpleName();
// FIXME final Property p = this.get( category, name, myDefault.name() );
// FIXME
// FIXME try
// FIXME {
// FIXME return (Enum) class1.getField( p.toString() ).get( class1 );
// FIXME }
// FIXME catch( final Throwable t )
// FIXME {
// FIXME // :{
// FIXME }
// FIXME
// FIXME return myDefault;
// FIXME }
try
{
return (Enum) class1.getField( p.toString() ).get( class1 );
}
catch( final Throwable t )
{
// :{
}
return myDefault;
}
public void setSetting( final String category, final Enum s )
{
final String name = s.getClass().getSimpleName();
this.get( category, name, s.name() ).set( s.name() );
this.save();
}
// FIXME public void setSetting( final String category, final Enum s )
// FIXME {
// FIXME final String name = s.getClass().getSimpleName();
// FIXME this.get( category, name, s.name() ).set( s.name() );
// FIXME this.save();
// FIXME }
public PowerUnits selectedPowerUnit()
{
@@ -635,12 +491,12 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.levelByStacks;
}
public int getStorageProviderID()
public String getStorageProviderID()
{
return this.storageProviderID;
}
public int getStorageDimensionID()
public String getStorageDimensionID()
{
return this.storageDimensionID;
}
@@ -655,7 +511,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.spatialPowerMultiplier;
}
public String[] getGrinderOres()
public List<String> getGrinderOres()
{
return this.grinderOres;
}
@@ -715,11 +571,6 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.quartzOresClusterAmount;
}
public int getChargedChange()
{
return this.chargedChange;
}
public int getMinMeteoriteDistance()
{
return this.minMeteoriteDistance;
@@ -740,7 +591,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.meteoriteMaximumSpawnHeight;
}
public int[] getMeteoriteDimensionWhitelist()
public Set<String> getMeteoriteDimensionWhitelist()
{
return this.meteoriteDimensionWhitelist;
}
@@ -782,13 +633,224 @@ public final class AEConfig extends Configuration implements IConfigurableObject
// Setters keep visibility as low as possible.
void setStorageProviderID( int id )
void setStorageProviderID( String id )
{
this.storageProviderID = id;
}
void setStorageDimensionID( int id )
void setStorageDimensionID( String id )
{
this.storageDimensionID = id;
}
private static class ClientConfig {
// Feature toggles
public final Map<AEFeature, BooleanValue> enabledFeatures = new EnumMap<>(AEFeature.class);
// Misc
public final BooleanValue removeCrashingItemsOnLoad;
public final ConfigValue<Integer> formationPlaneEntityLimit;
public final BooleanValue enableEffects;
public final BooleanValue useLargeFonts;
public final BooleanValue useColoredCraftingStatus;
public final BooleanValue disableColoredCableRecipesInJEI;
public final ConfigValue<Integer> craftingCalculationTimePerTick;
public final EnumValue<PowerUnits> selectedPowerUnit;
// GUI Buttons
private static final int[] BTN_BY_STACK_DEFAULTS = { 1, 10, 100, 1000 };
public final List<ConfigValue<Integer>> craftByStacks;
public final List<ConfigValue<Integer>> priorityByStacks;
public final List<ConfigValue<Integer>> levelByStacks;
// Spatial IO/Dimension
public final ConfigValue<String> storageProviderID;
public final ConfigValue<String> storageDimensionID;
public final ConfigValue<Double> spatialPowerExponent;
public final ConfigValue<Double> spatialPowerMultiplier;
// Grindstone
public final ConfigValue<List<? extends String>> grinderOres;
public final ConfigValue<List<? extends String>> grinderBlackList;
public final DoubleValue oreDoublePercentage;
// Batteries
public final ConfigValue<Integer> wirelessTerminalBattery;
public final ConfigValue<Integer> entropyManipulatorBattery;
public final ConfigValue<Integer> matterCannonBattery;
public final ConfigValue<Integer> portableCellBattery;
public final ConfigValue<Integer> colorApplicatorBattery;
public final ConfigValue<Integer> chargedStaffBattery;
// Certus quartz
public final DoubleValue spawnChargedChance;
public final ConfigValue<Integer> quartzOresPerCluster;
public final ConfigValue<Integer> quartzOresClusterAmount;
// Meteors
public final ConfigValue<Integer> minMeteoriteDistance;
public final ConfigValue<Double> meteoriteClusterChance;
public final ConfigValue<Integer> meteoriteMaximumSpawnHeight;
public final ConfigValue<List<? extends String>> meteoriteDimensionWhitelist;
// Wireless
public final ConfigValue<Double> wirelessBaseCost;
public final ConfigValue<Double> wirelessCostMultiplier;
public final ConfigValue<Double> wirelessTerminalDrainMultiplier;
public final ConfigValue<Double> wirelessBaseRange;
public final ConfigValue<Double> wirelessBoosterRangeMultiplier;
public final ConfigValue<Double> wirelessBoosterExp;
// Power Ratios
public final ConfigValue<Double> powerRatioIc2;
public final ConfigValue<Double> powerRatioForgeEnergy;
public final DoubleValue powerUsageMultiplier;
// Condenser Power Requirement
public final ConfigValue<Integer> condenserMatterBallsPower;
public final ConfigValue<Integer> condenserSingularityPower;
public ClientConfig(ForgeConfigSpec.Builder builder) {
// Feature switches
builder
.comment("Warning: Disabling a feature may disable other features depending on it.")
.push("features");
// We need to group by feature category
Map<String, List<AEFeature>> groupedFeatures = Arrays.stream(AEFeature.values())
.filter(AEFeature::isVisible) // Only provide config settings for visible features
.collect(Collectors.groupingBy(AEFeature::category));
for( final String category : groupedFeatures.keySet() )
{
List<AEFeature> featuresInGroup = groupedFeatures.get(category);
builder.push(category);
for (AEFeature feature : featuresInGroup)
{
enabledFeatures.put(feature, builder
.comment(feature.comment())
.define(feature.key(), feature.isEnabled()));
}
builder.pop();
}
builder.pop();
builder.push("general");
removeCrashingItemsOnLoad = builder.comment("Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!")
.define("removeCrashingItemsOnLoad", false);
builder.pop();
builder.push("automation");
formationPlaneEntityLimit = builder.comment("TODO")
.define("formationPlaneEntityLimit", 128 );
builder.pop();
builder.push("client");
this.disableColoredCableRecipesInJEI = builder.comment("TODO").define("disableColoredCableRecipesInJEI", true );
this.enableEffects = builder.comment("TODO").define("enableEffects", true );
this.useLargeFonts = builder.comment("TODO").define("useTerminalUseLargeFont", false );
this.useColoredCraftingStatus = builder.comment("TODO").define("useColoredCraftingStatus", true );
this.selectedPowerUnit = builder.comment("Power unit shown in AE UIs")
.defineEnum("PowerUnit", PowerUnits.AE, PowerUnits.values());
this.craftByStacks = new ArrayList<>(4);
this.priorityByStacks = new ArrayList<>(4);
this.levelByStacks = new ArrayList<>(4);
// load buttons..
for( int btnNum = 0; btnNum < 4; btnNum++ )
{
int defaultValue = BTN_BY_STACK_DEFAULTS[btnNum];
final int buttonCap = (int) ( Math.pow( 10, btnNum + 1 ) - 1 );
this.craftByStacks.add(builder.comment("Controls buttons on Crafting Screen")
.defineInRange("craftByStacks" + btnNum, defaultValue, 1, buttonCap));
this.priorityByStacks.add(builder.comment("Controls buttons on Priority Screen")
.defineInRange("priorityByStacks" + btnNum, defaultValue, 1, buttonCap));
this.levelByStacks.add(builder.comment("Controls buttons on Level Emitter Screen")
.defineInRange("levelByStacks" + btnNum, defaultValue, 1, buttonCap));
}
builder.pop();
builder.push("craftingCPU");
this.craftingCalculationTimePerTick = builder.define("craftingCalculationTimePerTick", 5 );
builder.pop();
builder.push("spatialio");
this.storageProviderID = builder.define("storageProviderID", (String) null);
this.storageDimensionID = builder.define("storageDimensionID", (String) null);
this.spatialPowerMultiplier = builder.define("spatialPowerMultiplier", 1250.0);
this.spatialPowerExponent = builder.define("spatialPowerExponent", 1.35);
builder.pop();
builder
.comment("Creates recipe of the following pattern automatically: '1 oreTYPE => 2 dustTYPE' and '(1 ingotTYPE or 1 crystalTYPE or 1 gemTYPE) => 1 dustTYPE'")
.push("GrindStone");
List<String> defaultGrinderOres = Stream.of( ORES_VANILLA, ORES_AE, ORES_COMMON, ORES_MISC ).flatMap( Stream::of ).collect(Collectors.toList());
this.grinderOres = builder
.comment("The list of types to handle. Specify without a prefix like ore or dust.")
.defineList("grinderOres", defaultGrinderOres, obj -> true); // FIXME: tag validation, is that even possible???
this.grinderBlackList = builder
.comment("Blacklists the exact oredict name from being handled by any recipe.")
.defineList("blacklist", Collections.emptyList(), obj -> true); // FIXME: tag validation, is that even possible???
this.oreDoublePercentage = builder
.comment("Chance to actually get an output with stacksize > 1.")
.defineInRange("oreDoublePercentage", 90.0, 0.0, 100.0);
builder.pop();
builder.push("battery");
this.wirelessTerminalBattery = builder.define("wirelessTerminal", 1600000);
this.chargedStaffBattery = builder.define("chargedStaff", 200000);
this.entropyManipulatorBattery = builder.define("entropyManipulator", 200000);
this.portableCellBattery = builder.define("portableCell", 20000);
this.colorApplicatorBattery = builder.define("colorApplicator", 20000);
this.matterCannonBattery = builder.define("matterCannon", 8000);
builder.pop();
builder.push("worldGen");
this.spawnChargedChance = builder.defineInRange("spawnChargedChance", 0.08, 0.0, 1.0);
this.minMeteoriteDistance = builder.define("minMeteoriteDistance", 707 );
this.meteoriteClusterChance = builder.define("meteoriteClusterChance", 0.1 );
this.meteoriteMaximumSpawnHeight = builder.define("meteoriteMaximumSpawnHeight", 180 );
List<String> defaultDimensionWhitelist = new ArrayList<>();
defaultDimensionWhitelist.add(DimensionType.getKey(DimensionType.OVERWORLD).toString());
this.meteoriteDimensionWhitelist = builder.defineList("meteoriteDimensionWhitelist", defaultDimensionWhitelist, obj -> true );
this.quartzOresPerCluster = builder.define("quartzOresPerCluster", 4 );
this.quartzOresClusterAmount = builder.define("quartzOresClusterAmount", 15 );
builder.pop();
builder.push("wireless");
this.wirelessBaseCost = builder.define("wirelessBaseCost", 8.0);
this.wirelessCostMultiplier = builder.define("wirelessCostMultiplier", 1.0);
this.wirelessBaseRange = builder.define("wirelessBaseRange", 1.0);
this.wirelessBoosterRangeMultiplier = builder.define("wirelessBoosterRangeMultiplier", 16.0);
this.wirelessBoosterExp = builder.define("wirelessBoosterExp", 1.0);
this.wirelessTerminalDrainMultiplier = builder.define("wirelessTerminalDrainMultiplier", 1.5);
builder.pop();
builder.push("PowerRatios");
powerRatioIc2 = builder.define("IC2", DEFAULT_IC2_EXCHANGE);
powerRatioForgeEnergy = builder.define("ForgeEnergy", DEFAULT_RF_EXCHANGE);
powerUsageMultiplier = builder.defineInRange("UsageMultiplier", 1.0, 0.01, Double.MAX_VALUE);
builder.pop();
builder.push("Condenser");
condenserMatterBallsPower = builder.define("MatterBalls", 256);
condenserSingularityPower = builder.define("Singularity", 256000);
builder.pop();
}
}
}
+196 -197
View File
@@ -25,28 +25,22 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import appeng.client.ClientHelper;
import appeng.server.ServerHelper;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import net.minecraft.world.DimensionType;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.ForgeVersion;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.CrashReportExtender;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.versions.forge.ForgeVersion;
import team.chisel.ctm.CTM;
import appeng.api.AEApi;
@@ -69,11 +63,9 @@ import appeng.services.export.ForgeExportConfig;
import appeng.services.version.VersionCheckerConfig;
import appeng.util.Platform;
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.12.2]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory", certificateFingerprint = "dfa4d3ac143316c6f32aa1a1beda1e34d42132e5" )
@Mod(AppEng.MOD_ID)
public final class AppEng
{
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
public static CommonHelper proxy;
public static final String MOD_ID = "appliedenergistics2";
@@ -81,12 +73,12 @@ public final class AppEng
public static final String ASSETS = "appliedenergistics2:";
private static final String FORGE_CURRENT_VERSION = ForgeVersion.majorVersion + "." + ForgeVersion.minorVersion + "." + ForgeVersion.revisionVersion + "." + ForgeVersion.buildVersion;
private static final String FORGE_MAX_VERSION = ( ForgeVersion.majorVersion + 1 ) + ".0.0.0";
public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");after:ctm@[" + CTM.VERSION + ",);";
// FIXME replicate this in mods.toml!
// FIXME private static final String FORGE_CURRENT_VERSION = ForgeVersion.getVersion();
// FIXME private static final String FORGE_MAX_VERSION = ( ForgeVersion.majorVersion + 1 ) + ".0.0.0";
// FIXME public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");after:ctm@[" + CTM.VERSION + ",);";
@Nonnull
private static final AppEng INSTANCE = new AppEng();
private static AppEng INSTANCE;
private final Registration registration;
@@ -97,184 +89,191 @@ public final class AppEng
*/
private ExportConfig exportConfig;
private AppEng()
public AppEng()
{
FMLCommonHandler.instance().registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
if (INSTANCE != null) {
throw new IllegalStateException();
}
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, AEConfig.CLIENT_SPEC);
proxy = DistExecutor.runForDist(() -> ClientHelper::new, () -> ServerHelper::new);
CrashReportExtender.registerCrashCallable( new ModCrashEnhancement( CrashInfo.MOD_VERSION ) );
this.registration = new Registration();
MinecraftForge.EVENT_BUS.register( this.registration );
}
@Nonnull
@Mod.InstanceFactory
public static AppEng instance()
{
return INSTANCE;
}
public Biome getStorageBiome()
{
return this.registration.storageBiome;
}
public DimensionType getStorageDimensionType()
{
return this.registration.storageDimensionType;
}
public int getStorageDimensionID()
{
return this.registration.storageDimensionID;
}
public AdvancementTriggers getAdvancementTriggers()
{
return this.registration.advancementTriggers;
}
@EventHandler
private void preInit( final FMLPreInitializationEvent event )
{
final Stopwatch watch = Stopwatch.createStarted();
this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
final File configFile = new File( this.configDirectory, "AppliedEnergistics2.cfg" );
final File facadeFile = new File( this.configDirectory, "Facades.cfg" );
final File versionFile = new File( this.configDirectory, "VersionChecker.cfg" );
final File recipeFile = new File( this.configDirectory, "CustomRecipes.cfg" );
final Configuration recipeConfiguration = new Configuration( recipeFile );
AEConfig.init( configFile );
FacadeConfig.init( facadeFile );
final VersionCheckerConfig versionCheckerConfig = new VersionCheckerConfig( versionFile );
this.exportConfig = new ForgeExportConfig( recipeConfiguration );
AELog.info( "Pre Initialization ( started )" );
CreativeTab.init();
if( AEConfig.instance().isFeatureEnabled( AEFeature.FACADES ) )
{
CreativeTabFacade.init();
}
for( final IntegrationType type : IntegrationType.values() )
{
IntegrationRegistry.INSTANCE.add( type );
}
this.registration.preInitialize( event );
if( Platform.isClient() )
{
AppEng.proxy.preinit();
}
IntegrationRegistry.INSTANCE.preInit();
if( versionCheckerConfig.isVersionCheckingEnabled() )
{
final VersionChecker versionChecker = new VersionChecker( versionCheckerConfig );
final Thread versionCheckerThread = new Thread( versionChecker );
this.startService( "AE2 VersionChecker", versionCheckerThread );
}
AELog.info( "Pre Initialization ( ended after " + watch.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
// Instantiate all Plugins
List<Object> injectables = Lists.newArrayList(
AEApi.instance() );
new PluginLoader().loadPlugins( injectables, event.getAsmData() );
}
private void startService( final String serviceName, final Thread thread )
{
thread.setName( serviceName );
thread.setPriority( Thread.MIN_PRIORITY );
AELog.info( "Starting " + serviceName );
thread.start();
}
@EventHandler
private void init( final FMLInitializationEvent event )
{
final Stopwatch start = Stopwatch.createStarted();
AELog.info( "Initialization ( started )" );
AppEng.proxy.init();
if( this.exportConfig.isExportingItemNamesEnabled() )
{
if( FMLCommonHandler.instance().getSide().isClient() )
{
final ExportProcess process = new ExportProcess( this.configDirectory, this.exportConfig );
final Thread exportProcessThread = new Thread( process );
this.startService( "AE2 CSV Export", exportProcessThread );
}
else
{
AELog.info( "Disabling item.csv export for custom recipes, since creative tab information is only available on the client." );
}
}
this.registration.initialize( event, this.configDirectory );
IntegrationRegistry.INSTANCE.init();
AELog.info( "Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
}
@EventHandler
private void postInit( final FMLPostInitializationEvent event )
{
final Stopwatch start = Stopwatch.createStarted();
AELog.info( "Post Initialization ( started )" );
this.registration.postInit( event );
IntegrationRegistry.INSTANCE.postInit();
FMLCommonHandler.instance().registerCrashCallable( new IntegrationCrashEnhancement() );
AppEng.proxy.postInit();
AEConfig.instance().save();
NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler );
NetworkHandler.init( "AE2" );
AELog.info( "Post Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
}
@EventHandler
private void handleIMCEvent( final FMLInterModComms.IMCEvent event )
{
final IMCHandler imcHandler = new IMCHandler();
imcHandler.handleIMCEvent( event );
}
@EventHandler
private void serverAboutToStart( final FMLServerAboutToStartEvent evt )
{
WorldData.onServerAboutToStart( evt.getServer() );
}
@EventHandler
private void serverStopping( final FMLServerStoppingEvent event )
{
WorldData.instance().onServerStopping();
}
@EventHandler
private void serverStopped( final FMLServerStoppedEvent event )
{
WorldData.instance().onServerStoppped();
TickHandler.INSTANCE.shutdown();
}
@EventHandler
private void serverStarting( final FMLServerStartingEvent evt )
{
evt.registerServerCommand( new AECommand( evt.getServer() ) );
}
// @Nonnull
// public static AppEng instance()
// {
// return INSTANCE;
// }
//
// public Biome getStorageBiome()
// {
// return this.registration.storageBiome;
// }
//
// public DimensionType getStorageDimensionType()
// {
// return this.registration.storageDimensionType;
// }
//
// public int getStorageDimensionID()
// {
// return this.registration.storageDimensionID;
// }
//
// public AdvancementTriggers getAdvancementTriggers()
// {
// return this.registration.advancementTriggers;
// }
//
// @EventHandler
// private void preInit( final FMLPreInitializationEvent event )
// {
// final Stopwatch watch = Stopwatch.createStarted();
// this.configDirectory = new File( event.getModConfigurationDirectory().getPath(), "AppliedEnergistics2" );
//
// final File configFile = new File( this.configDirectory, "AppliedEnergistics2.cfg" );
// final File facadeFile = new File( this.configDirectory, "Facades.cfg" );
// final File versionFile = new File( this.configDirectory, "VersionChecker.cfg" );
// final File recipeFile = new File( this.configDirectory, "CustomRecipes.cfg" );
// final Configuration recipeConfiguration = new Configuration( recipeFile );
//
// AEConfig.init( configFile );
// FacadeConfig.init( facadeFile );
//
// final VersionCheckerConfig versionCheckerConfig = new VersionCheckerConfig( versionFile );
// this.exportConfig = new ForgeExportConfig( recipeConfiguration );
//
// AELog.info( "Pre Initialization ( started )" );
//
// CreativeTab.init();
// if( AEConfig.instance().isFeatureEnabled( AEFeature.FACADES ) )
// {
// CreativeTabFacade.init();
// }
//
// for( final IntegrationType type : IntegrationType.values() )
// {
// IntegrationRegistry.INSTANCE.add( type );
// }
//
// this.registration.preInitialize( event );
//
// if( Platform.isClient() )
// {
// AppEng.proxy.preinit();
// }
//
// IntegrationRegistry.INSTANCE.preInit();
//
// if( versionCheckerConfig.isVersionCheckingEnabled() )
// {
// final VersionChecker versionChecker = new VersionChecker( versionCheckerConfig );
// final Thread versionCheckerThread = new Thread( versionChecker );
//
// this.startService( "AE2 VersionChecker", versionCheckerThread );
// }
//
// AELog.info( "Pre Initialization ( ended after " + watch.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
//
// // Instantiate all Plugins
// List<Object> injectables = Lists.newArrayList(
// AEApi.instance() );
// new PluginLoader().loadPlugins( injectables, event.getAsmData() );
// }
//
// private void startService( final String serviceName, final Thread thread )
// {
// thread.setName( serviceName );
// thread.setPriority( Thread.MIN_PRIORITY );
//
// AELog.info( "Starting " + serviceName );
// thread.start();
// }
//
// @EventHandler
// private void init( final FMLCommonSetupEvent event )
// {
// final Stopwatch start = Stopwatch.createStarted();
// AELog.info( "Initialization ( started )" );
//
// AppEng.proxy.init();
//
// if( this.exportConfig.isExportingItemNamesEnabled() )
// {
// if( FMLCommonHandler.instance().getSide().isClient() )
// {
// final ExportProcess process = new ExportProcess( this.configDirectory, this.exportConfig );
// final Thread exportProcessThread = new Thread( process );
//
// this.startService( "AE2 CSV Export", exportProcessThread );
// }
// else
// {
// AELog.info( "Disabling item.csv export for custom recipes, since creative tab information is only available on the client." );
// }
// }
//
// this.registration.initialize( event, this.configDirectory );
// IntegrationRegistry.INSTANCE.init();
//
// AELog.info( "Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
// }
//
// @EventHandler
// private void postInit( final FMLPostInitializationEvent event )
// {
// final Stopwatch start = Stopwatch.createStarted();
// AELog.info( "Post Initialization ( started )" );
//
// this.registration.postInit( event );
// IntegrationRegistry.INSTANCE.postInit();
// CrashReportExtender.registerCrashCallable( new IntegrationCrashEnhancement() );
//
// AppEng.proxy.postInit();
// AEConfig.instance().save();
//
// NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler );
// NetworkHandler.init( "AE2" );
//
// AELog.info( "Post Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
// }
//
// @EventHandler
// private void handleIMCEvent( final FMLInterModComms.IMCEvent event )
// {
// final IMCHandler imcHandler = new IMCHandler();
//
// imcHandler.handleIMCEvent( event );
// }
//
// @EventHandler
// private void serverAboutToStart( final FMLServerAboutToStartEvent evt )
// {
// WorldData.onServerAboutToStart( evt.getServer() );
// }
//
// @EventHandler
// private void serverStopping( final FMLServerStoppingEvent event )
// {
// WorldData.instance().onServerStopping();
// }
//
// @EventHandler
// private void serverStopped( final FMLServerStoppedEvent event )
// {
// WorldData.instance().onServerStoppped();
// TickHandler.INSTANCE.shutdown();
// }
//
// @EventHandler
// private void serverStarting( final FMLServerStartingEvent evt )
// {
// evt.registerServerCommand( new AECommand( evt.getServer() ) );
// }
}
+3 -6
View File
@@ -24,6 +24,7 @@ import java.util.Random;
import javax.annotation.Nonnull;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult;
@@ -41,13 +42,11 @@ public abstract class CommonHelper
public abstract void preinit();
public abstract void init();
public abstract World getWorld();
public abstract void bindTileEntitySpecialRenderer( Class<? extends TileEntity> tile, AEBaseBlock blk );
public abstract List<PlayerEntity> getPlayers();
public abstract List<? extends PlayerEntity> getPlayers();
public abstract void sendToAllNearExcept( PlayerEntity p, double x, double y, double z, double dist, World w, AppEngPacket packet );
@@ -65,8 +64,6 @@ public abstract class CommonHelper
public abstract void updateRenderMode( PlayerEntity player );
public abstract boolean isKeyPressed( @Nonnull final ActionKey key );
public abstract boolean isActionKey( @Nonnull final ActionKey key, int pressedKeyCode );
public abstract boolean isActionKey( @Nonnull final ActionKey key, InputMappings.Input input );
}
@@ -51,7 +51,7 @@ public class CellRegistry implements ICellRegistry
@Override
public void addCellHandler( final ICellHandler handler )
{
Preconditions.checkNotNull( handler, "Called before FMLInitializationEvent." );
Preconditions.checkNotNull( handler, "Called before FMLCommonSetupEvent." );
Preconditions.checkArgument( !this.handlers.contains( handler ), "Tried to register the same handler instance twice." );
this.handlers.add( handler );
@@ -23,7 +23,7 @@ import com.google.gson.JsonObject;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.item.ItemStack;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.advancements.critereon.ItemPredicates;
@@ -55,7 +55,7 @@ public class PartItemPredicate extends ItemPredicate
{
if( jsonobject.has( "part" ) )
{
return new PartItemPredicate( JsonUtils.getString( jsonobject, "part" ) );
return new PartItemPredicate( JSONUtils.getString( jsonobject, "part" ) );
}
else
{
@@ -26,7 +26,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.IPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
@@ -37,7 +37,7 @@ import appeng.core.sync.network.INetworkInfo;
import appeng.core.sync.network.NetworkHandler;
public abstract class AppEngPacket implements Packet
public abstract class AppEngPacket implements IPacket
{
private PacketBuffer p;
private PacketCallState caller;
@@ -20,13 +20,13 @@ package appeng.core.sync.network;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.INetHandler;
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.PacketDispatcher;
public interface IPacketHandler
{
void onPacketData( INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, PlayerEntity player );
void onPacketData(INetworkInfo manager, PacketDispatcher dispatcher, PacketBuffer packet, PlayerEntity player );
}
@@ -153,7 +153,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe
@Override
public void deserializeNBT( CompoundNBT nbt )
{
if( nbt.hasKey( NBT_SPATIAL_DATA_KEY ) )
if( nbt.contains(NBT_SPATIAL_DATA_KEY) )
{
final NBTTagList list = (NBTTagList) nbt.getTag( NBT_SPATIAL_DATA_KEY );
@@ -64,7 +64,7 @@ final class SpawnData implements IWorldSpawnData
final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit.
data.setBoolean( chunkX + "," + chunkZ, true );
data.putBoolean(chunkX + "," + chunkZ, true);
this.writeSpawnData( dim, chunkX, chunkZ, data );
}
@@ -64,7 +64,7 @@ public class TileChunkLoader extends AEBaseTile implements ITickable
if( this.ct == null )
{
final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
final MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
if( server != null )
{
final List<PlayerEntityMP> pl = server.getPlayerList().getPlayers();
@@ -26,7 +26,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.StringTextComponent;
import appeng.core.AppEng;
import appeng.tile.AEBaseTile;
@@ -52,7 +52,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
{
for( final PlayerEntity e : AppEng.proxy.getPlayers() )
{
e.sendMessage( new TextComponentString( "Spawning in... " + ( this.countdown / 20 ) ) );
e.sendMessage( new StringTextComponent( "Spawning in... " + ( this.countdown / 20 ) ) );
}
}
@@ -114,7 +114,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
this.size = 64;
}
player.sendMessage( new TextComponentString( "Size: " + this.size ) );
player.sendMessage( new StringTextComponent( "Size: " + this.size ) );
}
else
{
@@ -104,9 +104,9 @@ public class ToolReplicatorCard extends AEBaseItem
final DimensionalCoord min = sc.getMin();
final DimensionalCoord max = sc.getMax();
x += currentSideOff.getFrontOffsetX();
y += currentSideOff.getFrontOffsetY();
z += currentSideOff.getFrontOffsetZ();
x += currentSideOff.getXOffset();
y += currentSideOff.getYOffset();
z += currentSideOff.getZOffset();
final int min_x = min.x;
final int min_y = min.y;
@@ -52,7 +52,7 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable
this.level.setMaxStringLength( 16 );
this.level.setTextColor( 0xFFFFFF );
this.level.setVisible( true );
this.level.setFocused( true );
this.level.changeFocus( true );
( (ContainerFluidLevelEmitter) this.inventorySlots ).setTextField( this.level );
final int y = 40;
@@ -10,7 +10,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@@ -25,7 +25,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.items.IItemHandler;
@@ -22,7 +22,7 @@ package appeng.fluids.helper;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
@@ -23,7 +23,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -53,7 +53,7 @@ public class FluidDummyItem extends AEBaseItem
public FluidStack getFluidStack( ItemStack is )
{
if( is.hasTagCompound() )
if( is.hasTag() )
{
CompoundNBT tag = is.getTagCompound();
return FluidStack.loadFluidStackFromNBT( tag );
@@ -17,7 +17,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidUtil;
@@ -368,9 +368,9 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setLong( "lastReportedValue", this.lastReportedValue );
data.setLong( "reportingValue", this.reportingValue );
data.setBoolean( "prevState", this.prevState );
data.putLong( "lastReportedValue", this.lastReportedValue );
data.putLong( "reportingValue", this.reportingValue );
data.putBoolean("prevState", this.prevState);
this.config.writeToNBT( data, "config" );
}
@@ -24,12 +24,14 @@ import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public interface ICustomCollision
{
Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, BlockPos pos, Entity thePlayer, boolean b );
Iterable<VoxelShape> getSelectedBoundingBoxesFromPool(IBlockReader w, BlockPos pos, Entity thePlayer, boolean b );
void addCollidingBlockToList( World w, BlockPos pos, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e );
}
@@ -320,9 +320,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
if( dc.getWorld() == this.myPlayer.world )
{
final double offX = dc.x - this.myPlayer.posX;
final double offY = dc.y - this.myPlayer.posY;
final double offZ = dc.z - this.myPlayer.posZ;
final double offX = dc.x - this.myPlayer.getPosX();
final double offY = dc.y - this.myPlayer.getPosY();
final double offZ = dc.z - this.myPlayer.getPosZ();
final double r = offX * offX + offY * offY + offZ * offZ;
if( r < rangeLimit && this.sqRange > r )
@@ -22,7 +22,6 @@ package appeng.items.contents;
import net.minecraft.item.ItemStack;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
public class CellConfig extends AppEngInternalInventory
@@ -34,12 +33,12 @@ public class CellConfig extends AppEngInternalInventory
{
super( null, 63 );
this.is = is;
this.readFromNBT( Platform.openNbtData( is ), "list" );
this.readFromNBT(is.getOrCreateTag(), "list" );
}
@Override
protected void onContentsChanged( int slot )
{
this.writeToNBT( Platform.openNbtData( this.is ), "list" );
this.writeToNBT(this.is.getOrCreateTag(), "list" );
}
}
@@ -22,7 +22,6 @@ package appeng.items.contents;
import net.minecraft.item.ItemStack;
import appeng.parts.automation.StackUpgradeInventory;
import appeng.util.Platform;
public final class CellUpgrades extends StackUpgradeInventory
@@ -33,12 +32,12 @@ public final class CellUpgrades extends StackUpgradeInventory
{
super( is, null, upgrades );
this.is = is;
this.readFromNBT( Platform.openNbtData( is ), "upgrades" );
this.readFromNBT(is.getOrCreateTag(), "upgrades" );
}
@Override
protected void onContentsChanged( int slot )
{
this.writeToNBT( Platform.openNbtData( this.is ), "upgrades" );
this.writeToNBT(this.is.getOrCreateTag(), "upgrades" );
}
}
@@ -26,7 +26,6 @@ import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.IGridHost;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import appeng.util.inv.filter.IAEItemFilter;
@@ -45,16 +44,16 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
this.gh = gHost;
this.inv = new AppEngInternalInventory( this, 9 );
this.inv.setFilter( new NetworkToolInventoryFilter() );
if( is.hasTagCompound() ) // prevent crash when opening network status screen.
if( is.hasTag() ) // prevent crash when opening network status screen.
{
this.inv.readFromNBT( Platform.openNbtData( is ), "inv" );
this.inv.readFromNBT(is.getOrCreateTag(), "inv" );
}
}
@Override
public void saveChanges()
{
this.inv.writeToNBT( Platform.openNbtData( this.is ), "inv" );
this.inv.writeToNBT(this.is.getOrCreateTag(), "inv" );
}
@Override
@@ -40,7 +40,6 @@ import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.me.helpers.MEMonitorHandler;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware
@@ -98,7 +97,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
{
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
final CompoundNBT data = Platform.openNbtData( PortableCellViewer.this.target );
final CompoundNBT data = this.target.getOrCreateTag();
manager.writeToNBT( data );
} );
@@ -106,7 +105,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( Platform.openNbtData( this.target ).copy() );
out.readFromNBT( this.target.getOrCreateTag().copy() );
return out;
}
}
@@ -97,7 +97,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
if( mt == MaterialType.NAME_PRESS )
{
final CompoundNBT c = Platform.openNbtData( stack );
final CompoundNBT c = stack.getOrCreateTag();
lines.add( c.getString( "InscribeName" ) );
}
@@ -141,7 +141,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
public MaterialType getTypeByStack( final ItemStack is )
{
MaterialType type = this.dmgToMaterial.get( is.getItemDamage() );
MaterialType type = this.dmgToMaterial.get( is.getDamage() );
return ( type != null ) ? type : MaterialType.INVALID_TYPE;
}
@@ -279,8 +279,8 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
try
{
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class )
.newInstance( w, location.posX,
location.posY, location.posZ, itemstack );
.newInstance( w, location.getPosX(),
location.getPosY(), location.getPosZ(), itemstack );
}
catch( final Throwable t )
{
@@ -43,7 +43,6 @@ import appeng.api.recipes.ResolverResult;
import appeng.core.localization.ButtonToolTips;
import appeng.entity.EntityGrowingCrystal;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
@@ -76,7 +75,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
crystalSeedStack.setItemDamage( certus2 );
crystalSeedStack = newStyle( crystalSeedStack );
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
return new ResolverResult( itemName, crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound() );
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTagCompound() );
} )
.orElse( null );
@@ -90,16 +89,16 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
static int getProgress( final ItemStack is )
{
if( is.hasTagCompound() )
if( is.hasTag() )
{
return is.getTagCompound().getInteger( "progress" );
}
else
{
final int progress;
final CompoundNBT comp = Platform.openNbtData( is );
comp.setInteger( "progress", progress = is.getItemDamage() );
is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
final CompoundNBT comp = is.getOrCreateTag();
comp.setInteger( "progress", progress = is.getDamage() );
is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
return progress;
}
}
@@ -147,9 +146,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
private void setProgress( final ItemStack is, final int newDamage )
{
final CompoundNBT comp = Platform.openNbtData( is );
final CompoundNBT comp = is.getOrCreateTag();
comp.setInteger( "progress", newDamage );
is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
}
@Override
@@ -225,7 +224,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
@Override
public Entity createEntity( final World world, final Entity location, final ItemStack itemstack )
{
final EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
final EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.getPosX(), location.getPosY(), location.getPosZ(), itemstack );
egc.motionX = location.motionX;
egc.motionY = location.motionY;
@@ -109,7 +109,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
if( details == null )
{
if( !stack.hasTagCompound() )
if( !stack.hasTag() )
{
return;
}
@@ -46,12 +46,12 @@ public class ItemPaintBall extends AEBaseItem
private String getExtraName( final ItemStack is )
{
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
return ( is.getDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
}
public AEColor getColor( final ItemStack is )
{
int dmg = is.getItemDamage();
int dmg = is.getDamage();
if( dmg >= DAMAGE_THRESHOLD )
{
dmg -= DAMAGE_THRESHOLD;
@@ -87,7 +87,7 @@ public class ItemPaintBall extends AEBaseItem
public static boolean isLumen( final ItemStack is )
{
final int dmg = is.getItemDamage();
final int dmg = is.getDamage();
return dmg >= DAMAGE_THRESHOLD;
}
@@ -45,12 +45,12 @@ public class ItemPaintBallRendering extends ItemRenderingCustomizer
{
final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int colorValue = stack.getDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
if( stack.getDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
@@ -151,12 +151,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
final Block block = Block.getBlockFromItem( itemStack.getItem() );
if( block == Blocks.AIR || itemStack.hasTagCompound() )
if( block == Blocks.AIR || itemStack.hasTag() )
{
return ItemStack.EMPTY;
}
final int metadata = itemStack.getItem().getMetadata( itemStack.getItemDamage() );
final int metadata = itemStack.getItem().getMetadata( itemStack.getDamage() );
// Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade
// This for example fails for Pistons because they hardcoded an invalid meta value in vanilla
@@ -191,8 +191,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
final ItemStack is = new ItemStack( this );
final CompoundNBT data = new CompoundNBT();
data.setString( TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString() );
data.setInteger( TAG_DAMAGE, itemStack.getItemDamage() );
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
data.setInteger( TAG_DAMAGE, itemStack.getDamage() );
is.setTagCompound( data );
return is;
}
@@ -225,7 +225,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
int itemDamage;
// Handle legacy facades
if( nbt.hasKey( "x" ) )
if( nbt.contains("x") )
{
int[] data = nbt.getIntArray( "x" );
if( data.length != 2 )
@@ -285,7 +285,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
catch( Exception e )
{
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getItemDamage() );
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getDamage() );
return Blocks.GLASS.getDefaultState();
}
}
@@ -323,7 +323,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
final CompoundNBT facadeTag = new CompoundNBT();
facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() );
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
facadeTag.setInteger( TAG_DAMAGE, ids[1] );
facadeStack.setTagCompound( facadeTag );
@@ -178,7 +178,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
{
final AEColor[] variants = AEColor.values();
final int itemDamage = is.getItemDamage();
final int itemDamage = is.getDamage();
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
if( registeredPartType != null )
{
@@ -211,7 +211,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
{
Preconditions.checkNotNull( is );
final PartTypeWithVariant pt = this.registered.get( is.getItemDamage() );
final PartTypeWithVariant pt = this.registered.get( is.getDamage() );
if( pt != null )
{
return pt.part;
@@ -141,7 +141,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
private ModelResourceLocation getItemMeshDefinition( ItemStack is )
{
PartType partType = this.item.getTypeByStack( is );
int variant = this.item.variantOf( is.getItemDamage() );
int variant = this.item.variantOf( is.getDamage() );
return partType.getItemModels().get( variant );
}
}
@@ -140,7 +140,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
@Override
public FuzzyMode getFuzzyMode( final ItemStack is )
{
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
@@ -154,7 +154,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
@Override
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
}
@Override
@@ -39,7 +39,6 @@ import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.spatial.StorageHelper;
import appeng.util.Platform;
public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorageCell
@@ -107,7 +106,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
@Override
public WorldCoord getStoredSize( final ItemStack is )
{
if( is.hasTagCompound() )
if( is.hasTag() )
{
final CompoundNBT c = is.getTagCompound();
return new WorldCoord( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) );
@@ -118,7 +117,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
@Override
public int getStoredDimensionID( final ItemStack is )
{
if( is.hasTagCompound() )
if( is.hasTag() )
{
final CompoundNBT c = is.getTagCompound();
return c.getInteger( NBT_CELL_ID_KEY );
@@ -180,7 +179,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
private void setStorageCell( final ItemStack is, int id, BlockPos size )
{
final CompoundNBT c = Platform.openNbtData( is );
final CompoundNBT c = is.getOrCreateTag();
c.setInteger( NBT_CELL_ID_KEY, id );
c.setInteger( NBT_SIZE_X_KEY, size.getX() );
@@ -33,7 +33,6 @@ import appeng.api.storage.data.IItemList;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.IPartitionList;
@@ -144,7 +143,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
@Override
public FuzzyMode getFuzzyMode( final ItemStack is )
{
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
@@ -158,6 +157,6 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
@Override
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
}
}
@@ -249,10 +249,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public ItemStack getColor( final ItemStack is )
{
final CompoundNBT c = is.getTagCompound();
if( c != null && c.hasKey( "color" ) )
if( c != null && c.contains("color") )
{
final CompoundNBT color = c.getCompoundTag( "color" );
final ItemStack oldColor = new ItemStack( color );
final ItemStack oldColor = ItemStack.read(color);
if( !oldColor.isEmpty() )
{
return oldColor;
@@ -333,7 +333,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
private void setColor( final ItemStack is, final ItemStack newColor )
{
final CompoundNBT data = Platform.openNbtData( is );
final CompoundNBT data = is.getOrCreateTag();
if( newColor.isEmpty() )
{
data.removeTag( "color" );
@@ -341,7 +341,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
else
{
final CompoundNBT color = new CompoundNBT();
newColor.writeToNBT( color );
newColor.write(color);
data.setTag( "color", color );
}
}
@@ -530,7 +530,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public FuzzyMode getFuzzyMode( final ItemStack is )
{
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
@@ -544,7 +544,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
}
@Override
@@ -166,7 +166,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public FuzzyMode getFuzzyMode( final ItemStack is )
{
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
@@ -180,7 +180,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
}
@Override
@@ -28,7 +28,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -45,7 +45,6 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
@@ -76,9 +75,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
{
super.addCheckedInformation( stack, world, lines, advancedTooltips );
if( stack.hasTagCompound() )
if( stack.hasTag() )
{
final CompoundNBT tag = Platform.openNbtData( stack );
final CompoundNBT tag = stack.getOrCreateTag();
if( tag != null )
{
final String encKey = tag.getString( "encryptionKey" );
@@ -95,7 +94,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
else
{
lines.add( I18n.translateToLocal( "AppEng.GuiITooltip.Unlinked" ) );
lines.add( I18n.format( "AppEng.GuiITooltip.Unlinked" ) );
}
}
@@ -122,7 +121,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
{
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
final CompoundNBT data = Platform.openNbtData( target );
final CompoundNBT data = target.getOrCreateTag();
manager.writeToNBT( data );
} );
@@ -130,23 +129,23 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( Platform.openNbtData( target ).copy() );
out.readFromNBT( target.getOrCreateTag().copy() );
return out;
}
@Override
public String getEncryptionKey( final ItemStack item )
{
final CompoundNBT tag = Platform.openNbtData( item );
final CompoundNBT tag = item.getOrCreateTag();
return tag.getString( "encryptionKey" );
}
@Override
public void setEncryptionKey( final ItemStack item, final String encKey, final String name )
{
final CompoundNBT tag = Platform.openNbtData( item );
tag.setString( "encryptionKey", encKey );
tag.setString( "name", name );
final CompoundNBT tag = item.getOrCreateTag();
tag.putString("encryptionKey", encKey);
tag.putString("name", name);
}
@Override
@@ -88,9 +88,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
super.getCheckedSubItems( creativeTab, itemStacks );
final ItemStack charged = new ItemStack( this, 1 );
final CompoundNBT tag = Platform.openNbtData( charged );
tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
final CompoundNBT tag = charged.getOrCreateTag();
tag.putDouble(CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ));
tag.putDouble(MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ));
itemStacks.add( charged );
}
@@ -129,10 +129,10 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
if( mode == Actionable.MODULATE )
{
final CompoundNBT data = Platform.openNbtData( is );
final CompoundNBT data = is.getOrCreateTag();
final double toAdd = Math.min( amount, required );
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd );
data.putDouble(CURRENT_POWER_NBT_KEY, currentStorage + toAdd);
}
return Math.max( 0, overflow );
@@ -146,9 +146,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
if( mode == Actionable.MODULATE )
{
final CompoundNBT data = Platform.openNbtData( is );
final CompoundNBT data = is.getOrCreateTag();
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable );
data.putDouble(CURRENT_POWER_NBT_KEY, currentStorage - fulfillable);
}
return fulfillable;
@@ -163,7 +163,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
@Override
public double getAECurrentPower( final ItemStack is )
{
final CompoundNBT data = Platform.openNbtData( is );
final CompoundNBT data = is.getOrCreateTag();
return data.getDouble( CURRENT_POWER_NBT_KEY );
}
@@ -86,7 +86,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
public ItemStack getContainerItem( final ItemStack itemStack )
{
ItemStack copy = itemStack.copy();
copy.setItemDamage( itemStack.getItemDamage() + 1 );
copy.setItemDamage( itemStack.getDamage() + 1 );
return copy;
}
+3 -3
View File
@@ -352,9 +352,9 @@ public class GridNode implements IGridNode, IPathItem
{
final CompoundNBT node = new CompoundNBT();
node.setInteger( "p", this.playerID );
node.setLong( "k", this.getLastSecurityKey() );
node.setLong( "g", this.myStorage.getID() );
node.putInt( "p", this.playerID );
node.putLong( "k", this.getLastSecurityKey() );
node.putLong( "g", this.myStorage.getID() );
nodeData.setTag( name, node );
}
+2 -2
View File
@@ -581,7 +581,7 @@ public class EnergyGridCache implements IEnergyGrid
{
final double newBuffer = this.localStorage.getAECurrentPower() / 2;
this.localStorage.removeCurrentAEPower( newBuffer );
storageB.dataObject().setDouble( "buffer", newBuffer );
storageB.dataObject().putDouble("buffer", newBuffer);
}
@Override
@@ -593,7 +593,7 @@ public class EnergyGridCache implements IEnergyGrid
@Override
public void populateGridStorage( final IGridStorage storage )
{
storage.dataObject().setDouble( "buffer", this.localStorage.getAECurrentPower() );
storage.dataObject().putDouble("buffer", this.localStorage.getAECurrentPower());
}
public boolean registerEnergyInterest( final EnergyThreshold threshold )
@@ -1011,11 +1011,11 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
{
final CompoundNBT tag = new CompoundNBT();
tag.setString( "CraftID", craftingID );
tag.setBoolean( "canceled", false );
tag.setBoolean( "done", false );
tag.setBoolean( "standalone", standalone );
tag.setBoolean( "req", req );
tag.putString("CraftID", craftingID);
tag.putBoolean("canceled", false);
tag.putBoolean("done", false);
tag.putBoolean("standalone", standalone);
tag.putBoolean("req", req);
return tag;
}
@@ -1146,8 +1146,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
{
data.setTag( "finalOutput", this.writeItem( this.finalOutput ) );
data.setTag( "inventory", this.writeList( this.inventory.getItemList() ) );
data.setBoolean( "waiting", this.waiting );
data.setBoolean( "isComplete", this.isComplete );
data.putBoolean("waiting", this.waiting);
data.putBoolean("isComplete", this.isComplete);
if( this.myLastLink != null )
{
@@ -1160,16 +1160,16 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
{
final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
item.setLong( "craftingProgress", e.getValue().value );
item.putLong( "craftingProgress", e.getValue().value );
list.appendTag( item );
}
data.setTag( "tasks", list );
data.setTag( "waitingFor", this.writeList( this.waitingFor ) );
data.setLong( "elapsedTime", this.getElapsedTime() );
data.setLong( "startItemCount", this.getStartItemCount() );
data.setLong( "remainingItemCount", this.getRemainingItemCount() );
data.putLong( "elapsedTime", this.getElapsedTime() );
data.putLong( "startItemCount", this.getStartItemCount() );
data.putLong( "remainingItemCount", this.getRemainingItemCount() );
}
private CompoundNBT writeItem( final IAEItemStack finalOutput2 )
@@ -1178,7 +1178,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( finalOutput2 != null )
{
finalOutput2.writeToNBT( out );
finalOutput2.write(out);
}
return out;
@@ -1223,7 +1223,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.waiting = data.getBoolean( "waiting" );
this.isComplete = data.getBoolean( "isComplete" );
if( data.hasKey( "link" ) )
if( data.contains("link") )
{
final CompoundNBT link = data.getCompoundTag( "link" );
this.myLastLink = new CraftingLink( link, this );
@@ -29,7 +29,6 @@ import appeng.api.storage.ICellInventory;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.util.Platform;
/**
@@ -87,7 +86,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
}
this.container = container;
this.tagCompound = Platform.openNbtData( o );
this.tagCompound = o.getOrCreateTag();
this.storedItems = this.tagCompound.getShort( ITEM_TYPE_TAG );
this.storedItemCount = this.tagCompound.getInteger( ITEM_COUNT_TAG );
this.cellItems = null;
@@ -33,7 +33,6 @@ import appeng.api.storage.IMEInventory;
import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.util.Platform;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
@@ -145,6 +144,6 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
CompoundNBT openNbtData()
{
return Platform.openNbtData( this.getCellInv().getItemStack() );
}
return this.getCellInv().getItemStack().getOrCreateTag();
}
}
@@ -116,27 +116,27 @@ public class BusCollisionHelper implements IPartCollisionHelper
maxY /= 16.0;
maxZ /= 16.0;
double aX = minX * this.x.getFrontOffsetX() + minY * this.y.getFrontOffsetX() + minZ * this.z.getFrontOffsetX();
double aY = minX * this.x.getFrontOffsetY() + minY * this.y.getFrontOffsetY() + minZ * this.z.getFrontOffsetY();
double aZ = minX * this.x.getFrontOffsetZ() + minY * this.y.getFrontOffsetZ() + minZ * this.z.getFrontOffsetZ();
double aX = minX * this.x.getXOffset() + minY * this.y.getXOffset() + minZ * this.z.getXOffset();
double aY = minX * this.x.getYOffset() + minY * this.y.getYOffset() + minZ * this.z.getYOffset();
double aZ = minX * this.x.getZOffset() + minY * this.y.getZOffset() + minZ * this.z.getZOffset();
double bX = maxX * this.x.getFrontOffsetX() + maxY * this.y.getFrontOffsetX() + maxZ * this.z.getFrontOffsetX();
double bY = maxX * this.x.getFrontOffsetY() + maxY * this.y.getFrontOffsetY() + maxZ * this.z.getFrontOffsetY();
double bZ = maxX * this.x.getFrontOffsetZ() + maxY * this.y.getFrontOffsetZ() + maxZ * this.z.getFrontOffsetZ();
double bX = maxX * this.x.getXOffset() + maxY * this.y.getXOffset() + maxZ * this.z.getXOffset();
double bY = maxX * this.x.getYOffset() + maxY * this.y.getYOffset() + maxZ * this.z.getYOffset();
double bZ = maxX * this.x.getZOffset() + maxY * this.y.getZOffset() + maxZ * this.z.getZOffset();
if( this.x.getFrontOffsetX() + this.y.getFrontOffsetX() + this.z.getFrontOffsetX() < 0 )
if( this.x.getXOffset() + this.y.getXOffset() + this.z.getXOffset() < 0 )
{
aX += 1;
bX += 1;
}
if( this.x.getFrontOffsetY() + this.y.getFrontOffsetY() + this.z.getFrontOffsetY() < 0 )
if( this.x.getYOffset() + this.y.getYOffset() + this.z.getYOffset() < 0 )
{
aY += 1;
bY += 1;
}
if( this.x.getFrontOffsetZ() + this.y.getFrontOffsetZ() + this.z.getFrontOffsetZ() < 0 )
if( this.x.getZOffset() + this.y.getZOffset() + this.z.getZOffset() < 0 )
{
aZ += 1;
bZ += 1;
@@ -322,7 +322,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
result = is.getItem().createEntity( w, ei, is );
if( result != null )
{
ei.setDead();
ei.remove();
}
else
{
@@ -330,9 +330,9 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
}
}
if( !w.spawnEntity( result ) )
if( !w.addEntity( result ) )
{
result.setDead();
result.remove();
worked = false;
}
}
@@ -28,7 +28,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraft.world.ServerWorld;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
@@ -69,7 +69,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
protected float calculateEnergyUsage( final WorldServer w, final BlockPos pos, final List<ItemStack> items )
protected float calculateEnergyUsage(final ServerWorld w, final BlockPos pos, final List<ItemStack> items )
{
final float requiredEnergy = super.calculateEnergyUsage( w, pos, items );
@@ -77,7 +77,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
protected List<ItemStack> obtainBlockDrops( final WorldServer w, final BlockPos pos )
protected List<ItemStack> obtainBlockDrops(final ServerWorld w, final BlockPos pos )
{
final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
final BlockState state = w.getBlockState( pos );
@@ -515,9 +515,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setLong( "lastReportedValue", this.lastReportedValue );
data.setLong( "reportingValue", this.reportingValue );
data.setBoolean( "prevState", this.prevState );
data.putLong( "lastReportedValue", this.lastReportedValue );
data.putLong( "reportingValue", this.reportingValue );
data.putBoolean("prevState", this.prevState);
this.config.writeToNBT( data, "config" );
}
@@ -69,7 +69,7 @@ public class PartCable extends AEBasePart implements IPartCable
super( is );
this.getProxy().setFlags( GridFlags.PREFERRED );
this.getProxy().setIdlePowerUsage( 0.0 );
this.getProxy().setColor( AEColor.values()[( (ItemPart) is.getItem() ).variantOf( is.getItemDamage() )] );
this.getProxy().setColor( AEColor.values()[( (ItemPart) is.getItem() ).variantOf( is.getDamage() )] );
}
@Override
@@ -97,12 +97,12 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
{
super.writeToNBT( data );
data.setBoolean( "isLocked", this.isLocked );
data.putBoolean("isLocked", this.isLocked);
final CompoundNBT myItem = new CompoundNBT();
if( this.configuredItem != null )
{
this.configuredItem.writeToNBT( myItem );
this.configuredItem.write(myItem);
}
data.setTag( "configuredItem", myItem );
@@ -87,9 +87,9 @@ public class PartCraftingTerminal extends AbstractPartTerminal
@Override
public GuiBridge getGui( final PlayerEntity p )
{
int x = (int) p.posX;
int y = (int) p.posY;
int z = (int) p.posZ;
int x = (int) p.getPosX();
int y = (int) p.getPosY();
int z = (int) p.getPosZ();
if( this.getHost().getTile() != null )
{
x = this.getTile().getPos().getX();
@@ -92,8 +92,8 @@ public class PartPatternTerminal extends AbstractPartTerminal
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setBoolean( "craftingMode", this.craftingMode );
data.setBoolean( "substitute", this.substitute );
data.putBoolean("craftingMode", this.craftingMode);
data.putBoolean("substitute", this.substitute);
this.pattern.writeToNBT( data, "pattern" );
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
@@ -102,9 +102,9 @@ public class PartPatternTerminal extends AbstractPartTerminal
@Override
public GuiBridge getGui( final PlayerEntity p )
{
int x = (int) p.posX;
int y = (int) p.posY;
int z = (int) p.posZ;
int x = (int) p.getPosX();
int y = (int) p.getPosY();
int z = (int) p.getPosZ();
if( this.getHost().getTile() != null )
{
x = this.getTile().getPos().getX();
@@ -175,7 +175,7 @@ public class AEItemResolver implements ISubItemResolver
}
final ItemStack is = partType.stack( col, 1 );
return new ResolverResult( "paint_ball", ( lumen ? 20 : 0 ) + is.getItemDamage() );
return new ResolverResult( "paint_ball", ( lumen ? 20 : 0 ) + is.getDamage() );
}
private Object cableItem( final AEColoredItemDefinition partType, final String substring )
@@ -192,6 +192,6 @@ public class AEItemResolver implements ISubItemResolver
}
final ItemStack is = partType.stack( col, 1 );
return new ResolverResult( "part", is.getItemDamage() );
return new ResolverResult( "part", is.getDamage() );
}
}

Some files were not shown because too many files have changed in this diff Show More