diff --git a/build.gradle b/build.gradle index 236e63d05..66e79ed22 100644 --- a/build.gradle +++ b/build.gradle @@ -92,6 +92,14 @@ sourceSets { include 'appeng/block/AEBaseBlock.java' include 'appeng/block/AEBaseBlockItem.java' include 'appeng/block/AEBaseTileBlock.java' + include 'appeng/tile/**' + include 'appeng/parts/**' + include 'appeng/helpers/**' + include 'appeng/items/**' + include 'appeng/util/**' + include 'appeng/core/localization/**' + exclude 'appeng/parts/p2p/PartP2PFluids.java' + exclude 'appeng/parts/p2p/PartP2PItems.java' include 'appeng/tile/AEBaseTile.java' include 'appeng/tile/AEBaseInvTile.java' include 'appeng/util/Platform.java' @@ -194,6 +202,20 @@ sourceSets { include 'appeng/container/AEBaseContainer*' include 'appeng/helpers/InventoryAction.java' include 'appeng/container/guisync/**' + include 'appeng/fluids/**' + exclude 'appeng/fluids/client/gui/**' + include 'appeng/core/features/**' + include 'appeng/entity/**' + include 'appeng/facade/**' + include 'appeng/hooks/**' + include 'appeng/client/render/cablebus/**' + include 'appeng/client/render/effects/EnergyFx.java' + include 'appeng/client/render/TesrRenderHelper.java' + include 'appeng/core/stats/IAdvancementTrigger.java' + include 'appeng/client/render/StaticItemColor.java' + include 'appeng/core/FacadeConfig.java' + include 'appeng/spatial/DefaultSpatialHandler.java' + exclude 'appeng/core/sync/packets/PacketSwitchGuis.java' include 'appeng/core/sync/network/NetworkHandler.java' include 'appeng/core/sync/packets/PacketProgressBar.java' include 'appeng/container/slot/SlotDisabled.java' @@ -205,6 +227,8 @@ sourceSets { include 'appeng/core/sync/packets/PacketSwapSlots.java' include 'appeng/core/sync/packets/PacketInventoryAction.java' include 'appeng/container/implementations/ContainerCraftAmount.java' + include 'appeng/container/implementations/ContainerCraftConfirm.java' + include 'appeng/helpers/WirelessTerminalGuiObject.java' include 'appeng/core/sync/packets/PacketValueConfig.java' include 'appeng/client/render/StackSizeRenderer.java' include 'appeng/fluids/client/render/FluidStackSizeRenderer.java' @@ -242,6 +266,37 @@ sourceSets { include 'appeng/client/render/cablebus/QuadRotator.java' include 'appeng/thirdparty/codechicken/lib/**' include 'appeng/client/render/model/AutoRotatingCacheKey.java' + include 'appeng/tile/misc/TileInscriber.java' + include 'appeng/parts/automation/DefinitionUpgradeInventory.java' + include 'appeng/core/sync/packets/PacketAssemblerAnimation.java' + include 'appeng/tile/grid/**' + include 'appeng/tile/powersink/AEBasePoweredTile.java' + include 'appeng/tile/powersink/IExternalPowerSink.java' + include 'appeng/block/misc/BlockInscriber.java' + include 'appeng/tile/powersink/ForgeEnergyAdapter.java' + include 'appeng/block/misc/InscriberRendering.java' + include 'appeng/client/render/tesr/InscriberTESR.java' + include 'appeng/hooks/TickHandler.java' + include 'appeng/me/**' + include 'appeng/util/IWorldCallable.java' + include 'appeng/crafting/**' + include 'appeng/util/ReadOnlyCollection.java' + include 'appeng/me/NetworkEventBus.java' + include 'appeng/container/ContainerNull.java' + include 'appeng/tile/crafting/**' + include 'appeng/block/crafting/**' + include 'appeng/client/render/crafting/CraftingCubeState.java' + include 'appeng/items/misc/ItemEncodedPattern.java' + include 'appeng/client/render/crafting/CraftingCubeRendering.java' + include 'appeng/core/sync/packets/**' + include 'appeng/hooks/CompassResult.java' + include 'appeng/container/implementations/CraftingCPURecord.java' + include 'appeng/fluids/container/IFluidSyncContainer.java' + include 'appeng/helpers/IContainerCraftingPacket.java' + include 'appeng/parts/PartPlacement.java' + include 'appeng/container/implementations/ContainerPatternTerm.java' + include 'appeng/parts/reporting/**' + include 'appeng/container/**' } compileClasspath += sourceSets.api.output runtimeClasspath += sourceSets.api.output diff --git a/src/api/java/appeng/api/movable/IMovableHandler.java b/src/api/java/appeng/api/movable/IMovableHandler.java index 9c08aed52..f15f25fa9 100644 --- a/src/api/java/appeng/api/movable/IMovableHandler.java +++ b/src/api/java/appeng/api/movable/IMovableHandler.java @@ -53,7 +53,7 @@ public interface IMovableHandler *
* {
* @code
- * Chunk c = world.getChunkFromBlockCoords( x, z );
+ * Chunk c = world.getChunkAt( x, z );
* c.setChunkBlockTileEntity( x & 0xF, y + y, z & 0xF, tile );
*
* if( c.isChunkLoaded )
diff --git a/src/api/java/appeng/api/networking/crafting/ICraftingCPU.java b/src/api/java/appeng/api/networking/crafting/ICraftingCPU.java
index 5888bf7aa..b43366959 100644
--- a/src/api/java/appeng/api/networking/crafting/ICraftingCPU.java
+++ b/src/api/java/appeng/api/networking/crafting/ICraftingCPU.java
@@ -27,6 +27,7 @@ package appeng.api.networking.crafting;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.data.IAEItemStack;
+import net.minecraft.util.text.ITextComponent;
public interface ICraftingCPU extends IBaseMonitor
@@ -53,7 +54,7 @@ public interface ICraftingCPU extends IBaseMonitor
int getCoProcessors();
/**
- * @return an empty string or the name of the cpu.
+ * @return a null or the name of the cpu.
*/
- String getName();
+ ITextComponent getName();
}
diff --git a/src/api/java/appeng/api/networking/security/IActionHost.java b/src/api/java/appeng/api/networking/security/IActionHost.java
index 908e17445..a3b695c0c 100644
--- a/src/api/java/appeng/api/networking/security/IActionHost.java
+++ b/src/api/java/appeng/api/networking/security/IActionHost.java
@@ -40,6 +40,6 @@ public interface IActionHost
* @return the the gridnode that actions from this IGridHost are preformed
* by.
*/
- @Nonnull
+ @Nonnull // FIXME fishy annotation, every caller seems to check for null
IGridNode getActionableNode();
}
diff --git a/src/api/java/appeng/api/parts/IPart.java b/src/api/java/appeng/api/parts/IPart.java
index 32ccf77fc..9a5a9b42c 100644
--- a/src/api/java/appeng/api/parts/IPart.java
+++ b/src/api/java/appeng/api/parts/IPart.java
@@ -30,6 +30,8 @@ import java.util.Random;
import javax.annotation.Nonnull;
+import com.mojang.blaze3d.matrix.MatrixStack;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -50,6 +52,7 @@ import appeng.api.networking.IGridNode;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
+import net.minecraftforge.common.util.LazyOptional;
public interface IPart extends IBoxProvider, ICustomCableConnection
@@ -75,7 +78,7 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* this method to be called.
*/
@OnlyIn( Dist.CLIENT )
- default void renderDynamic( double x, double y, double z, float partialTicks, int destroyStage )
+ default void renderDynamic(float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn)
{
}
@@ -333,27 +336,13 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* forwarded to parts on the appropriate
* side.
*
- * @see TileEntity#hasCapability(Capability, EnumFacing)
- *
- * @return True if your part has the requested capability.
- */
- default boolean hasCapability( Capability> capabilityClass )
- {
- return false;
- }
-
- /**
- * Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
- * forwarded to parts on the appropriate
- * side.
- *
- * @see TileEntity#getCapability(Capability, EnumFacing)
+ * @see TileEntity#getCapability(Capability, net.minecraft.util.Direction)
*
* @return The capability or null.
*/
- default T getCapability( Capability capabilityClass )
+ default LazyOptional getCapability(Capability capabilityClass )
{
- return null;
+ return LazyOptional.empty();
}
/**
diff --git a/src/api/java/appeng/api/parts/IPartItem.java b/src/api/java/appeng/api/parts/IPartItem.java
index ffe5d58d1..d0373700a 100644
--- a/src/api/java/appeng/api/parts/IPartItem.java
+++ b/src/api/java/appeng/api/parts/IPartItem.java
@@ -42,7 +42,7 @@ import net.minecraft.item.ItemStack;
*
*
* {@literal @}Override
- * public default EnumActionResult onItemUse(ItemStack is, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
+ * public default ActionResultType onItemUse(ItemStack is, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
* {
* return Api.INSTANCE.partHelper().placeBus( is, pos, side, player, hand, world );
* }
diff --git a/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java b/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java
new file mode 100644
index 000000000..e0d721341
--- /dev/null
+++ b/src/main/java/appeng/block/crafting/AbstractCraftingUnitBlock.java
@@ -0,0 +1,99 @@
+/*
+ * This file is part of Applied Energistics 2.
+ * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
+ *
+ * Applied Energistics 2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Applied Energistics 2 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Applied Energistics 2. If not, see .
+ */
+
+package appeng.block.crafting;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.state.BooleanProperty;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.state.StateContainer;
+import net.minecraft.util.ActionResultType;
+import net.minecraft.util.Hand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.BlockRayTraceResult;
+import net.minecraft.world.World;
+
+import appeng.block.AEBaseTileBlock;
+import appeng.tile.crafting.TileCraftingTile;
+
+
+public abstract class AbstractCraftingUnitBlock extends AEBaseTileBlock
+{
+ public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
+ public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
+
+ public final CraftingUnitType type;
+
+ public AbstractCraftingUnitBlock(Block.Properties props, final CraftingUnitType type )
+ {
+ super( props );
+ this.type = type;
+ }
+
+ @Override
+ protected void fillStateContainer(StateContainer.Builder builder) {
+ super.fillStateContainer(builder);
+ builder.add(POWERED);
+ builder.add(FORMED);
+ }
+
+ @Override
+ public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos, boolean isMoving )
+ {
+ final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
+ if( cp != null )
+ {
+ cp.updateMultiBlock();
+ }
+ }
+
+ @Override
+ public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving)
+ {
+ final TileCraftingTile cp = this.getTileEntity( w, pos );
+ if( cp != null )
+ {
+ cp.breakCluster();
+ }
+
+ super.onReplaced( state, w, pos, newState, isMoving );
+ }
+
+ @Override
+ public ActionResultType onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockRayTraceResult hit) {
+ final TileCraftingTile tg = this.getTileEntity( w, pos );
+
+ if( tg != null && !p.isCrouching() && tg.isFormed() && tg.isActive() )
+ {
+ if ( !w.isRemote() )
+ {
+ // FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
+ }
+
+ return ActionResultType.SUCCESS;
+ }
+
+ return super.onBlockActivated(state, w, pos, p, hand, hit);
+ }
+
+ public enum CraftingUnitType
+ {
+ UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
+ }
+}
diff --git a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java
index c969fddc0..08db21c82 100644
--- a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java
+++ b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java
@@ -19,72 +19,12 @@
package appeng.block.crafting;
-import net.minecraft.block.BlockStateContainer;
-import net.minecraft.block.BlockState;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.ItemGroup;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.Direction;
-import net.minecraft.util.NonNullList;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockReader;
-import net.minecraftforge.common.property.ExtendedBlockState;
-import net.minecraftforge.common.property.IExtendedBlockState;
-import net.minecraftforge.common.property.IUnlistedProperty;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
-
-import appeng.api.util.AEColor;
-import appeng.client.UnlistedProperty;
import appeng.tile.crafting.TileCraftingMonitorTile;
-
-public class BlockCraftingMonitor extends BlockCraftingUnit
+public class BlockCraftingMonitor extends AbstractCraftingUnitBlock
{
-
- public static final UnlistedProperty COLOR = new UnlistedProperty<>( "color", AEColor.class );
-
- public BlockCraftingMonitor()
+ public BlockCraftingMonitor(Properties props)
{
- super( CraftingUnitType.MONITOR );
- }
-
- @Override
- protected BlockStateContainer createBlockState()
- {
- return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
- STATE,
- COLOR,
- FORWARD,
- UP
- } );
- }
-
- @Override
- public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
- {
- AEColor color = AEColor.TRANSPARENT;
- Direction forward = Direction.NORTH;
- Direction up = Direction.UP;
-
- TileCraftingMonitorTile te = this.getTileEntity( world, pos );
- if( te != null )
- {
- color = te.getColor();
- forward = te.getForward();
- up = te.getUp();
- }
-
- return super.getExtendedState( state, world, pos )
- .with( COLOR, color )
- .with( FORWARD, forward )
- .with( UP, up );
- }
-
- @Override
- @OnlyIn( Dist.CLIENT )
- public void fillItemGroup(ItemGroup group, NonNullList itemStacks)
- {
- itemStacks.add( new ItemStack( this, 1, 0 ) );
+ super( props, CraftingUnitType.MONITOR );
}
}
diff --git a/src/main/java/appeng/block/crafting/BlockCraftingStorage.java b/src/main/java/appeng/block/crafting/BlockCraftingStorage.java
index 103387560..b6ca1d729 100644
--- a/src/main/java/appeng/block/crafting/BlockCraftingStorage.java
+++ b/src/main/java/appeng/block/crafting/BlockCraftingStorage.java
@@ -19,12 +19,13 @@
package appeng.block.crafting;
-public class BlockCraftingStorage extends BlockCraftingUnit
+import appeng.tile.crafting.TileCraftingStorageTile;
+
+public class BlockCraftingStorage extends AbstractCraftingUnitBlock
{
- public BlockCraftingStorage( final CraftingUnitType type )
- {
- super( type );
+ public BlockCraftingStorage(Properties props, CraftingUnitType type) {
+ super(props, type);
}
}
diff --git a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java
deleted file mode 100644
index 63fdc3019..000000000
--- a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * This file is part of Applied Energistics 2.
- * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
- *
- * Applied Energistics 2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Applied Energistics 2 is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Applied Energistics 2. If not, see .
- */
-
-package appeng.block.crafting;
-
-
-import java.util.EnumSet;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockState;
-import net.minecraft.block.BlockStateContainer;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.BooleanProperty;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.state.IProperty;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockReader;
-import net.minecraft.world.World;
-import net.minecraftforge.common.property.ExtendedBlockState;
-import net.minecraftforge.common.property.IExtendedBlockState;
-import net.minecraftforge.common.property.IUnlistedProperty;
-
-import appeng.api.util.AEPartLocation;
-import appeng.block.AEBaseTileBlock;
-import appeng.client.UnlistedProperty;
-import appeng.client.render.crafting.CraftingCubeState;
-import appeng.core.sync.GuiBridge;
-import appeng.tile.crafting.TileCraftingTile;
-import appeng.util.Platform;
-
-
-public class BlockCraftingUnit extends AEBaseTileBlock
-{
- public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
- public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
- public static final UnlistedProperty STATE = new UnlistedProperty<>( "state", CraftingCubeState.class );
-
- public final CraftingUnitType type;
-
- public BlockCraftingUnit( final CraftingUnitType type )
- {
- super( Material.IRON );
-
- this.type = type;
- }
-
- @Override
- protected IProperty[] getAEStates()
- {
- return new IProperty[] { POWERED, FORMED };
- }
-
- @Override
- public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
- {
-
- EnumSet connections = EnumSet.noneOf( Direction.class );
-
- for( Direction facing : Direction.values() )
- {
- if( this.isConnected( world, pos, facing ) )
- {
- connections.add( facing );
- }
- }
-
- IExtendedBlockState extState = (IExtendedBlockState) state;
-
- return extState.with( STATE, new CraftingCubeState( connections ) );
- }
-
- private boolean isConnected( IBlockReader world, BlockPos pos, Direction side )
- {
- BlockPos adjacentPos = pos.offset( side );
- return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit;
- }
-
- @Override
- protected BlockStateContainer createBlockState()
- {
- return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { STATE } );
- }
-
- @Override
- public BlockState getStateFromMeta( final int meta )
- {
- return this.getDefaultState().with( POWERED, ( meta & 1 ) == 1 ).with( FORMED, ( meta & 2 ) == 2 );
- }
-
- @Override
- public int getMetaFromState( final BlockState state )
- {
- boolean p = state.getValue( POWERED );
- boolean f = state.getValue( FORMED );
- return ( p ? 1 : 0 ) | ( f ? 2 : 0 );
- }
-
- @Override
- public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos, boolean isMoving )
- {
- final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
- if( cp != null )
- {
- cp.updateMultiBlock();
- }
- }
-
- @Override
- public BlockRenderLayer getBlockLayer()
- {
- return BlockRenderLayer.CUTOUT;
- }
-
- @Override
- public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving)
- {
- final TileCraftingTile cp = this.getTileEntity( w, pos );
- if( cp != null )
- {
- cp.breakCluster();
- }
-
- super.onReplaced( state, w, pos, newState, isMoving );
- }
-
- @Override
- public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
- {
- final TileCraftingTile tg = this.getTileEntity( w, pos );
-
- if( tg != null && !p.isCrouching() && tg.isFormed() && tg.isActive() )
- {
- if( Platform.isClient() )
- {
- return true;
- }
-
- Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
- return true;
- }
-
- return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
- }
-
- public enum CraftingUnitType
- {
- UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
- }
-}
diff --git a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java
index d0fdb93f4..ef6fe45d2 100644
--- a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java
+++ b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java
@@ -19,93 +19,62 @@
package appeng.block.crafting;
-import net.minecraft.block.material.Material;
-import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import appeng.block.AEBaseTileBlock;
+import appeng.tile.crafting.TileMolecularAssembler;
+import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.Direction;
+import net.minecraft.state.BooleanProperty;
+import net.minecraft.state.StateContainer;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockReader;
+import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
-
-import appeng.api.util.AEPartLocation;
-import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
-import appeng.tile.crafting.TileMolecularAssembler;
-import appeng.util.Platform;
-public class BlockMolecularAssembler extends AEBaseTileBlock
+public class BlockMolecularAssembler extends AEBaseTileBlock
{
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
- public BlockMolecularAssembler()
+ public BlockMolecularAssembler(Block.Properties props)
{
- super( Material.IRON );
-
- this.setOpaque( false );
- this.lightOpacity = 1;
+ super( props );
}
@Override
- protected IProperty[] getAEStates()
- {
- return new IProperty[] { POWERED };
+ protected void fillStateContainer(StateContainer.Builder builder) {
+ super.fillStateContainer(builder);
+ builder.add(POWERED);
}
- @Override
- public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
- {
- boolean powered = false;
- TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
- if( te != null )
- {
- powered = te.isPowered();
- }
-
- return super.getActualState( state, worldIn, pos ).with( POWERED, powered );
- }
-
- /**
- * NOTE: This is only used to determine how to render an item being held in hand.
- * For determining block rendering, the method below is used (canRenderInLayer).
- */
- @OnlyIn( Dist.CLIENT )
- @Override
- public BlockRenderLayer getBlockLayer()
- {
- return BlockRenderLayer.CUTOUT;
- }
-
- @OnlyIn( Dist.CLIENT )
- @Override
- public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer )
- {
- return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
- }
+// FIXME: This apparently was used to update block states purely client-side... this wont work anymore :|
+// FIXME @Override
+// FIXME public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
+// FIXME {
+// FIXME boolean powered = false;
+// FIXME TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
+// FIXME if( te != null )
+// FIXME {
+// FIXME powered = te.isPowered();
+// FIXME }
+// FIXME
+// FIXME return super.getActualState( state, worldIn, pos ).with( POWERED, powered );
+// FIXME }
@Override
- public boolean isFullCube( BlockState state )
- {
- return false;
- }
-
- @Override
- public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
- {
+ public ActionResultType onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockRayTraceResult hit) {
final TileMolecularAssembler tg = this.getTileEntity( w, pos );
if( tg != null && !p.isCrouching() )
{
- Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
- return true;
+ if (!tg.isRemote()) {
+ // FIXME Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_MAC);
+ }
+ return ActionResultType.SUCCESS;
}
- return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
+ return super.onBlockActivated(state, w, pos, p, hand, hit);
}
+
}
diff --git a/src/main/java/appeng/client/UnlistedProperty.java b/src/main/java/appeng/block/crafting/CraftingUnitBlock.java
similarity index 54%
rename from src/main/java/appeng/client/UnlistedProperty.java
rename to src/main/java/appeng/block/crafting/CraftingUnitBlock.java
index 7c45fcca8..258f1b3de 100644
--- a/src/main/java/appeng/client/UnlistedProperty.java
+++ b/src/main/java/appeng/block/crafting/CraftingUnitBlock.java
@@ -16,52 +16,17 @@
* along with Applied Energistics 2. If not, see .
*/
-package appeng.client;
+package appeng.block.crafting;
-import net.minecraftforge.common.property.IUnlistedProperty;
+import appeng.tile.crafting.TileCraftingTile;
-/**
- * A generic implementation for {@link IUnlistedProperty}.
- *
- * @param
- */
-public class UnlistedProperty implements IUnlistedProperty
+public class CraftingUnitBlock extends AbstractCraftingUnitBlock
{
- private final String name;
-
- private final Class clazz;
-
- public UnlistedProperty( String name, Class clazz )
- {
- this.name = name;
- this.clazz = clazz;
- }
-
- @Override
- public String getName()
- {
- return this.name;
- }
-
- @Override
- public boolean isValid( T value )
- {
- return value != null;
- }
-
- @Override
- public Class getType()
- {
- return this.clazz;
- }
-
- @Override
- public String valueToString( T value )
- {
- return value.toString();
+ public CraftingUnitBlock(Properties props, CraftingUnitType type) {
+ super(props, type);
}
}
diff --git a/src/main/java/appeng/block/crafting/ItemCraftingStorage.java b/src/main/java/appeng/block/crafting/ItemCraftingStorage.java
index 98db10c2d..747b24ac5 100644
--- a/src/main/java/appeng/block/crafting/ItemCraftingStorage.java
+++ b/src/main/java/appeng/block/crafting/ItemCraftingStorage.java
@@ -19,6 +19,7 @@
package appeng.block.crafting;
+import appeng.core.Api;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -30,9 +31,8 @@ import appeng.api.features.AEFeature;
public class ItemCraftingStorage extends AEBaseBlockItem
{
- public ItemCraftingStorage( final Block id )
- {
- super( id );
+ public ItemCraftingStorage(Block id, Properties props) {
+ super(id, props);
}
@Override
diff --git a/src/main/java/appeng/block/misc/BlockCellWorkbench.java b/src/main/java/appeng/block/misc/BlockCellWorkbench.java
index 9fa4d3a9f..ada485d42 100644
--- a/src/main/java/appeng/block/misc/BlockCellWorkbench.java
+++ b/src/main/java/appeng/block/misc/BlockCellWorkbench.java
@@ -32,7 +32,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/misc/BlockCondenser.java b/src/main/java/appeng/block/misc/BlockCondenser.java
index 67f5a8d9a..eef313485 100644
--- a/src/main/java/appeng/block/misc/BlockCondenser.java
+++ b/src/main/java/appeng/block/misc/BlockCondenser.java
@@ -32,7 +32,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/misc/BlockInscriber.java b/src/main/java/appeng/block/misc/BlockInscriber.java
index ee5fbeae4..369366c48 100644
--- a/src/main/java/appeng/block/misc/BlockInscriber.java
+++ b/src/main/java/appeng/block/misc/BlockInscriber.java
@@ -19,66 +19,44 @@
package appeng.block.misc;
-import javax.annotation.Nullable;
-
-import net.minecraft.block.material.Material;
+import appeng.block.AEBaseTileBlock;
+import appeng.tile.misc.TileInscriber;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
-import net.minecraft.util.BlockRenderType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
+import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
-import appeng.api.util.AEPartLocation;
-import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
-import appeng.tile.misc.TileInscriber;
-import appeng.util.Platform;
+import javax.annotation.Nullable;
+public class BlockInscriber extends AEBaseTileBlock {
-public class BlockInscriber extends AEBaseTileBlock
-{
+ public BlockInscriber(Properties props) {
+ super(props);
+ }
- public BlockInscriber()
- {
- super( Material.IRON );
+ @Override
+ public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
+ return 2; // FIXME validate this. a) possibly not required because of getShape b) value range. was 2 in 1.10
+ }
- this.setLightOpacity( 2 );
- this.setFullSize( this.setOpaque( false ) );
- }
+ @Override
+ public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
+ if (!p.isCrouching()) {
+ final TileInscriber tg = this.getTileEntity(w, pos);
+ if (tg != null) {
+ if (!tg.isRemote()) {
+ // FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_INSCRIBER );
+ }
+ return ActionResultType.SUCCESS;
+ }
+ }
+ return ActionResultType.PASS;
- @Override
- public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
- {
- if( p.isCrouching() )
- {
- return ActionResultType.PASS;
- }
+ }
- final TileInscriber tg = this.getTileEntity( w, pos );
- if( tg != null )
- {
- if( Platform.isServer() )
- {
- Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INSCRIBER );
- }
- return ActionResultType.SUCCESS;
- }
- return ActionResultType.PASS;
- }
-
- @Override
- public BlockRenderType getRenderType( BlockState state )
- {
- return BlockRenderType.MODEL;
- }
-
- @Override
- public String getTranslationKey( final ItemStack is )
- {
- return super.getTranslationKey( is );
- }
}
diff --git a/src/main/java/appeng/block/misc/BlockInterface.java b/src/main/java/appeng/block/misc/BlockInterface.java
index 9d892a799..36f587524 100644
--- a/src/main/java/appeng/block/misc/BlockInterface.java
+++ b/src/main/java/appeng/block/misc/BlockInterface.java
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java
index d0c81805b..f6baa9be1 100644
--- a/src/main/java/appeng/block/misc/BlockLightDetector.java
+++ b/src/main/java/appeng/block/misc/BlockLightDetector.java
@@ -26,7 +26,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.properties.DirectionProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
@@ -71,7 +71,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
public int getMetaFromState( final BlockState state )
{
- return state.getValue( FACING ).ordinal();
+ return state.get( FACING ).ordinal();
}
@Override
diff --git a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java
index 9f420a130..995484f4f 100644
--- a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java
+++ b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java
@@ -24,7 +24,7 @@ import java.util.Random;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Direction;
diff --git a/src/main/java/appeng/block/misc/BlockSecurityStation.java b/src/main/java/appeng/block/misc/BlockSecurityStation.java
index cf422da30..f26b3bf99 100644
--- a/src/main/java/appeng/block/misc/BlockSecurityStation.java
+++ b/src/main/java/appeng/block/misc/BlockSecurityStation.java
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -37,7 +37,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.misc.TileSecurityStation;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/misc/BlockTinyTNT.java b/src/main/java/appeng/block/misc/BlockTinyTNT.java
index 159b206ec..0b5b8b497 100644
--- a/src/main/java/appeng/block/misc/BlockTinyTNT.java
+++ b/src/main/java/appeng/block/misc/BlockTinyTNT.java
@@ -19,9 +19,6 @@
package appeng.block.misc;
-import java.util.Collections;
-import java.util.List;
-
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -33,15 +30,19 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.item.Items;
-import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
+import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
+import net.minecraft.util.math.shapes.ISelectionContext;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.Explosion;
+import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
@@ -50,27 +51,24 @@ import appeng.helpers.ICustomCollision;
import net.minecraft.world.server.ServerWorld;
-public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
+public class BlockTinyTNT extends AEBaseBlock
{
+ private static final VoxelShape SHAPE = VoxelShapes.create(new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f ));
+
public BlockTinyTNT()
{
- super( Material.TNT );
-
- this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
-
- this.setLightOpacity( 2 );
- this.setFullSize( false );
- this.setOpaque( false );
-
- this.setSoundType( SoundType.GROUND );
- this.setHardness( 0F );
+ super( Properties.create(Material.TNT).hardnessAndResistance(0).sound(SoundType.GROUND).notSolid() );
}
@Override
- public boolean isFullCube( BlockState state )
- {
- return false;
+ public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
+ return 2; // FIXME: Validate that this is the correct value range
+ }
+
+ @Override
+ public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
+ return SHAPE;
}
@Override
@@ -80,7 +78,9 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
this.startFuse( w, pos, player );
w.removeBlock(pos, false);
- heldItem.damageItem( 1, player );
+ heldItem.damageItem( 1, player, p -> {
+ p.sendBreakAnimation(hand);
+ } ); // FIXME Check if onBroken is equivalent
return ActionResultType.SUCCESS;
}
else
@@ -103,7 +103,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
@Override
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving )
{
- if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
+ if( world.getRedstonePowerFromNeighbors( pos ) > 0 )
{
this.startFuse( world, pos, null );
world.removeBlock(pos, false);
@@ -111,11 +111,10 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
@Override
- public void onBlockAdded( final World w, final BlockPos pos, final BlockState state )
- {
- super.onBlockAdded( w, pos, state );
+ public void onBlockAdded(BlockState state, World w, BlockPos pos, BlockState oldState, boolean isMoving) {
+ super.onBlockAdded( state, w, pos, oldState, isMoving );
- if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
+ if( w.getRedstonePowerFromNeighbors( pos ) > 0 )
{
this.startFuse( w, pos, null );
w.removeBlock(pos, false);
@@ -166,15 +165,4 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
}
- @Override
- public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
- {
- return Collections.singletonList( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
- }
-
- @Override
- public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e )
- {
- out.add( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
- }
}
diff --git a/src/main/java/appeng/block/misc/BlockVibrationChamber.java b/src/main/java/appeng/block/misc/BlockVibrationChamber.java
index 3c59c2a4c..891c78ebc 100644
--- a/src/main/java/appeng/block/misc/BlockVibrationChamber.java
+++ b/src/main/java/appeng/block/misc/BlockVibrationChamber.java
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -41,7 +41,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/misc/InscriberRendering.java b/src/main/java/appeng/block/misc/InscriberRendering.java
index 1c839beef..f91715a3f 100644
--- a/src/main/java/appeng/block/misc/InscriberRendering.java
+++ b/src/main/java/appeng/block/misc/InscriberRendering.java
@@ -2,23 +2,21 @@
package appeng.block.misc;
+import appeng.bootstrap.*;
+import appeng.tile.misc.TileInscriber;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-import appeng.bootstrap.BlockRenderingCustomizer;
-import appeng.bootstrap.IBlockRendering;
-import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.InscriberTESR;
-public class InscriberRendering extends BlockRenderingCustomizer
+public class InscriberRendering extends TileEntityRenderingCustomizer
{
@OnlyIn( Dist.CLIENT )
@Override
- public void customize( IBlockRendering rendering, IItemRendering itemRendering )
- {
- rendering.tileEntityRenderer( new InscriberTESR() );
+ public void customize(TileEntityRendering rendering) {
+ rendering.tileEntityRenderer( InscriberTESR::new );
}
}
diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java
index b79236cb1..7f72a1e8e 100644
--- a/src/main/java/appeng/block/networking/BlockCableBus.java
+++ b/src/main/java/appeng/block/networking/BlockCableBus.java
@@ -38,9 +38,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.EnumDyeColor;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
+import net.minecraft.item.*;
+import net.minecraft.item.DyeColor;
import net.minecraft.state.IProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
@@ -48,12 +47,13 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.BlockRayTraceResult;
-import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.math.*;
import net.minecraft.util.math.RayTraceResult.Type;
-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.VoxelShapes;
import net.minecraft.world.IBlockReader;
+import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -87,7 +87,7 @@ import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
-public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
+public class BlockCableBus extends AEBaseTileBlock /* FIXME implements IAEFacade */
{
public static final UnlistedProperty RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
@@ -409,12 +409,11 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
}
@Override
- public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color )
- {
- return this.recolorBlock( world, pos, side, color, null );
+ public boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction side, DyeColor color) {
+ return recolorBlock(world, pos, side, color, null);
}
- public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color, final PlayerEntity who )
+ public boolean recolorBlock(final IBlockReader world, final BlockPos pos, final Direction side, final DyeColor color, final PlayerEntity who )
{
try
{
@@ -497,4 +496,40 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state );
}
}
+
+ @Override
+ public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
+
+ // FIXME: this has to be cached, optimized, fixed in all kinds of ways
+ TileCableBus te = getTileEntity(w, pos);
+ VoxelShape result = VoxelShapes.empty();
+ if (te != null) {
+ for (final AxisAlignedBB bx : te.getCableBus().getSelectedBoundingBoxesFromPool(false, true, context.getEntity(), true)) {
+ result = VoxelShapes.or(
+ result,
+ VoxelShapes.create(new AxisAlignedBB(bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ))
+ );
+ }
+ }
+ return result;
+
+ }
+
+ @Override
+ public VoxelShape getCollisionShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
+
+ // FIXME: this has to be cached, optimized, fixed in all kinds of ways
+ TileCableBus te = getTileEntity(w, pos);
+ VoxelShape result = VoxelShapes.empty();
+ if (te != null) {
+ for (final AxisAlignedBB bx : te.getCableBus().getSelectedBoundingBoxesFromPool(false, true, context.getEntity(), false)) {
+ result = VoxelShapes.or(
+ result,
+ VoxelShapes.create(new AxisAlignedBB(bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ))
+ );
+ }
+ }
+ return result;
+
+ }
}
diff --git a/src/main/java/appeng/block/networking/BlockController.java b/src/main/java/appeng/block/networking/BlockController.java
index 280bb811d..c0ac9ea8f 100644
--- a/src/main/java/appeng/block/networking/BlockController.java
+++ b/src/main/java/appeng/block/networking/BlockController.java
@@ -156,7 +156,7 @@ public class BlockController extends AEBaseTileBlock
@Override
public int getMetaFromState( final BlockState state )
{
- return state.getValue( CONTROLLER_STATE ).ordinal();
+ return state.get( CONTROLLER_STATE ).ordinal();
}
@Override
diff --git a/src/main/java/appeng/block/networking/BlockEnergyCell.java b/src/main/java/appeng/block/networking/BlockEnergyCell.java
index 4f4526415..c25b742fb 100644
--- a/src/main/java/appeng/block/networking/BlockEnergyCell.java
+++ b/src/main/java/appeng/block/networking/BlockEnergyCell.java
@@ -41,7 +41,7 @@ public class BlockEnergyCell extends AEBaseTileBlock
@Override
public int getMetaFromState( final BlockState state )
{
- return state.getValue( ENERGY_STORAGE );
+ return state.get( ENERGY_STORAGE );
}
@Override
diff --git a/src/main/java/appeng/block/networking/BlockWireless.java b/src/main/java/appeng/block/networking/BlockWireless.java
index fc45186ed..57323a83f 100644
--- a/src/main/java/appeng/block/networking/BlockWireless.java
+++ b/src/main/java/appeng/block/networking/BlockWireless.java
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
diff --git a/src/main/java/appeng/block/qnb/BlockQuantumBase.java b/src/main/java/appeng/block/qnb/BlockQuantumBase.java
index 1babf2dd4..5ff4288da 100644
--- a/src/main/java/appeng/block/qnb/BlockQuantumBase.java
+++ b/src/main/java/appeng/block/qnb/BlockQuantumBase.java
@@ -22,7 +22,7 @@ package appeng.block.qnb;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
-import net.minecraft.block.properties.BooleanProperty;
+import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.util.BlockRenderLayer;
diff --git a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java
index 4113e91b5..e776dc302 100644
--- a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java
+++ b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java
@@ -39,7 +39,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.client.EffectType;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.AEGlassMaterial;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java
index afb338828..57cc55430 100644
--- a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java
+++ b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java
@@ -34,7 +34,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/storage/BlockChest.java b/src/main/java/appeng/block/storage/BlockChest.java
index 204154c1e..6127e8f5a 100644
--- a/src/main/java/appeng/block/storage/BlockChest.java
+++ b/src/main/java/appeng/block/storage/BlockChest.java
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.localization.PlayerMessages;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/storage/BlockDrive.java b/src/main/java/appeng/block/storage/BlockDrive.java
index fbb82007b..d5f5c3e5f 100644
--- a/src/main/java/appeng/block/storage/BlockDrive.java
+++ b/src/main/java/appeng/block/storage/BlockDrive.java
@@ -40,7 +40,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/block/storage/BlockIOPort.java b/src/main/java/appeng/block/storage/BlockIOPort.java
index 2d008e80f..a13d80778 100644
--- a/src/main/java/appeng/block/storage/BlockIOPort.java
+++ b/src/main/java/appeng/block/storage/BlockIOPort.java
@@ -34,7 +34,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/bootstrap/IBlockRendering.java b/src/main/java/appeng/bootstrap/IBlockRendering.java
index cb3433b2e..0bb4a8cd9 100644
--- a/src/main/java/appeng/bootstrap/IBlockRendering.java
+++ b/src/main/java/appeng/bootstrap/IBlockRendering.java
@@ -21,6 +21,7 @@ package appeng.bootstrap;
import java.util.function.BiFunction;
import java.util.function.Function;
+import java.util.function.Predicate;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.color.IBlockColor;
@@ -55,4 +56,7 @@ public interface IBlockRendering
@OnlyIn( Dist.CLIENT )
IBlockRendering renderType(RenderType type);
+ @OnlyIn( Dist.CLIENT )
+ IBlockRendering renderType(Predicate type);
+
}
diff --git a/src/main/java/appeng/client/gui/implementations/GuiChest.java b/src/main/java/appeng/client/gui/implementations/GuiChest.java
index cd2b44754..e2d2a9f92 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiChest.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiChest.java
@@ -28,7 +28,7 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerChest;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileChest;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java
index d21bb5ee1..c3220f057 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java
@@ -36,7 +36,7 @@ import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketSwitchGuis;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java
index 44585e557..3fdf4092d 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java
@@ -47,7 +47,7 @@ import appeng.client.gui.widgets.GuiScrollbar;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java
index 165912d07..c9bca14b2 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java
@@ -41,7 +41,7 @@ import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiDrive.java b/src/main/java/appeng/client/gui/implementations/GuiDrive.java
index b08e0c05a..618ae59bc 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiDrive.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiDrive.java
@@ -28,7 +28,7 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerDrive;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileDrive;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java
index ee7c02236..8c797365a 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java
@@ -34,7 +34,7 @@ import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerFormationPlane;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterface.java b/src/main/java/appeng/client/gui/implementations/GuiInterface.java
index bf4b81483..342efae3b 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiInterface.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiInterface.java
@@ -34,7 +34,7 @@ import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerInterface;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java
index f70306308..d5105d8ef 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java
@@ -218,7 +218,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.refreshList = true;
}
- for( final Object oKey : in.getKeySet() )
+ for( final Object oKey : in.keySet() )
{
final String key = (String) oKey;
if( key.startsWith( "=" ) )
@@ -226,7 +226,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
try
{
final long id = Long.parseLong( key.substring( 1 ), Character.MAX_RADIX );
- final CompoundNBT invData = in.getCompoundTag( key );
+ final CompoundNBT invData = in.getCompound( key );
final ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
for( int x = 0; x < current.getInventory().getSlots(); x++ )
@@ -234,7 +234,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
final String which = Integer.toString( x );
if( invData.contains(which) )
{
- current.getInventory().setStackInSlot( x, new ItemStack( invData.getCompoundTag( which ) ) );
+ current.getInventory().setStackInSlot( x, ItemStack.read( invData.getCompound( which ) ) );
}
}
}
diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java
index d381d9e87..5e5dc045a 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java
@@ -59,7 +59,7 @@ import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiPriority.java b/src/main/java/appeng/client/gui/implementations/GuiPriority.java
index e264b34a1..ed3d08b7d 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiPriority.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiPriority.java
@@ -32,7 +32,7 @@ import appeng.container.implementations.ContainerPriority;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
diff --git a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java
index 230215123..83714a81d 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java
@@ -21,7 +21,7 @@ package appeng.client.gui.implementations;
import java.io.IOException;
-import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.AEBaseGui;
@@ -38,7 +38,7 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
public class GuiQuartzKnife extends AEBaseGui
{
- private GuiTextField name;
+ private TextFieldWidget name;
public GuiQuartzKnife(ContainerQuartzKnife container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
@@ -50,7 +50,7 @@ public class GuiQuartzKnife extends AEBaseGui
{
super.init();
- this.name = new GuiTextField( 0, this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT );
+ this.name = new TextFieldWidget( 0, this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT );
this.name.setEnableBackgroundDrawing( false );
this.name.setMaxStringLength( 32 );
this.name.setTextColor( 0xFFFFFF );
diff --git a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java
index 1d57d92a7..8d6afa7b3 100644
--- a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java
+++ b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java
@@ -37,7 +37,7 @@ import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerStorageBus;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
diff --git a/src/main/java/appeng/client/render/StaticItemColor.java b/src/main/java/appeng/client/render/StaticItemColor.java
index 29734f63e..9b7ec9b3d 100644
--- a/src/main/java/appeng/client/render/StaticItemColor.java
+++ b/src/main/java/appeng/client/render/StaticItemColor.java
@@ -39,7 +39,7 @@ public class StaticItemColor implements IItemColor
}
@Override
- public int colorMultiplier( ItemStack stack, int tintIndex )
+ public int getColor( ItemStack stack, int tintIndex )
{
return this.color.getVariantByTintIndex( tintIndex );
}
diff --git a/src/main/java/appeng/client/render/TesrRenderHelper.java b/src/main/java/appeng/client/render/TesrRenderHelper.java
index a659547c4..375018a38 100644
--- a/src/main/java/appeng/client/render/TesrRenderHelper.java
+++ b/src/main/java/appeng/client/render/TesrRenderHelper.java
@@ -19,9 +19,14 @@
package appeng.client.render;
+import appeng.api.storage.data.IAEItemStack;
import com.mojang.blaze3d.matrix.MatrixStack;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
+import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import appeng.util.IWideReadableNumberConverter;
@@ -91,52 +96,50 @@ public class TesrRenderHelper
}
//TODO, A different approach will have to be used for this from TESRs, -covers, i have ideas.
- // /**
- // * Render an item in 2D.
- // */
- // public static void renderItem2d( ItemStack itemStack, float scale )
- // {
- // if( !itemStack.isEmpty() )
- // {
- // RenderSystem.glMultiTexCoord2f( GL13.GL_TEXTURE22, 240.f, 240.0f );
- //
- // RenderSystem.pushMatrix();
- //
- // // The Z-scaling by 0.0001 causes the model to be visually "flattened"
- // // This cannot replace a proper projection, but it's cheap and gives the desired
- // // effect at least from head-on
- // RenderSystem.scaled( scale / 32.0f, scale / 32.0f, 0.0001f );
- // // Position the item icon at the top middle of the panel
- // RenderSystem.translated( -8, -11, 0 );
- //
- // ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer();
- // renderItem.renderItemAndEffectIntoGUI( itemStack, 0, 0 );
- //
- // RenderSystem.popMatrix();
- // }
- // }
- //
- // /**
- // * Render an item in 2D and the given text below it.
- // *
- // * @param spacing Specifies how far apart the item and the item stack amount are rendered.
- // */
- // public static void renderItem2dWithAmount( IAEItemStack itemStack, float itemScale, float spacing )
- // {
- // final ItemStack renderStack = itemStack.asItemStackRepresentation();
- //
- // TesrRenderHelper.renderItem2d( renderStack, itemScale );
- //
- // final long stackSize = itemStack.getStackSize();
- // final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
- //
- // // Render the item count
- // final FontRenderer fr = Minecraft.getInstance().fontRenderer;
- // final int width = fr.getStringWidth( renderedStackSize );
- // RenderSystem.translated( 0.0f, spacing, 0 );
- // RenderSystem.scaled( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
- // RenderSystem.translated( -0.5f * width, 0.0f, 0.5f );
- // fr.drawString( renderedStackSize, 0, 0, 0 );
- //
- // }
+ /**
+ * Render an item in 2D.
+ */
+ public static void renderItem2d(MatrixStack matrixStack, IRenderTypeBuffer buffers, ItemStack itemStack, float scale)
+ {
+ if( !itemStack.isEmpty() )
+ {
+// FIXME RenderSystem.glMultiTexCoord2f( GL13.GL_TEXTURE22, 240.f, 240.0f );
+// FIXME RenderSystem.pushMatrix();
+// FIXME // The Z-scaling by 0.0001 causes the model to be visually "flattened"
+// FIXME // This cannot replace a proper projection, but it's cheap and gives the desired
+// FIXME // effect at least from head-on
+// FIXME RenderSystem.scaled( scale / 32.0f, scale / 32.0f, 0.0001f );
+// FIXME // Position the item icon at the top middle of the panel
+// FIXME RenderSystem.translated( -8, -11, 0 );
+// FIXME ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer();
+// FIXME renderItem.renderItemAndEffectIntoGUI( itemStack, 0, 0 );
+// FIXME RenderSystem.popMatrix();
+ }
+ }
+
+ /**
+ * Render an item in 2D and the given text below it.
+ *
+ * @param matrixStack
+ * @param buffers
+ * @param spacing Specifies how far apart the item and the item stack amount are rendered.
+ */
+ public static void renderItem2dWithAmount(MatrixStack matrixStack, IRenderTypeBuffer buffers, IAEItemStack itemStack, float itemScale, float spacing)
+ {
+ final ItemStack renderStack = itemStack.asItemStackRepresentation();
+
+ TesrRenderHelper.renderItem2d( matrixStack, buffers, renderStack, itemScale );
+
+ final long stackSize = itemStack.getStackSize();
+ final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
+
+ // Render the item count
+ final FontRenderer fr = Minecraft.getInstance().fontRenderer;
+ final int width = fr.getStringWidth( renderedStackSize );
+ matrixStack.translate( 0.0f, spacing, 0 );
+ matrixStack.scale( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
+ matrixStack.translate( -0.5f * width, 0.0f, 0.5f );
+ fr.drawString( renderedStackSize, 0, 0, 0 );
+
+ }
}
diff --git a/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java b/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java
index 99aac7f9f..02e085cbe 100644
--- a/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java
+++ b/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java
@@ -29,7 +29,6 @@ import java.util.Objects;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraftforge.client.model.data.ModelProperty;
diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java b/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java
index 0e8c577f7..96285efea 100644
--- a/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java
+++ b/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java
@@ -36,7 +36,7 @@ import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction;
import net.minecraftforge.common.property.IExtendedBlockState;
-import appeng.block.crafting.BlockCraftingUnit;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.client.render.cablebus.CubeBuilder;
@@ -264,7 +264,7 @@ abstract class CraftingCubeBakedModel implements IBakedModel
}
IExtendedBlockState extState = (IExtendedBlockState) state;
- CraftingCubeState cubeState = extState.getValue( BlockCraftingUnit.STATE );
+ CraftingCubeState cubeState = extState.getValue( AbstractCraftingUnitBlock.STATE );
if( cubeState == null )
{
return EnumSet.noneOf( Direction.class );
diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java b/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java
index b55624611..6e0a8fb08 100644
--- a/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java
+++ b/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java
@@ -33,7 +33,7 @@ import net.minecraftforge.client.model.IModel;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
-import appeng.block.crafting.BlockCraftingUnit;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.core.AppEng;
@@ -58,9 +58,9 @@ class CraftingCubeModel implements IModel
private final static ResourceLocation MONITOR_LIGHT_MEDIUM = texture( "monitor_light_medium" );
private final static ResourceLocation MONITOR_LIGHT_BRIGHT = texture( "monitor_light_bright" );
- private final BlockCraftingUnit.CraftingUnitType type;
+ private final AbstractCraftingUnitBlock.CraftingUnitType type;
- CraftingCubeModel( BlockCraftingUnit.CraftingUnitType type )
+ CraftingCubeModel( AbstractCraftingUnitBlock.CraftingUnitType type )
{
this.type = type;
}
@@ -106,7 +106,7 @@ class CraftingCubeModel implements IModel
}
}
- private static TextureAtlasSprite getLightTexture( Function textureGetter, BlockCraftingUnit.CraftingUnitType type )
+ private static TextureAtlasSprite getLightTexture( Function textureGetter, AbstractCraftingUnitBlock.CraftingUnitType type )
{
switch( type )
{
diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java b/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java
index 1499462c1..7a23c2b1f 100644
--- a/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java
+++ b/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java
@@ -19,21 +19,15 @@
package appeng.client.render.crafting;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockState;
-import net.minecraft.client.renderer.block.model.ModelResourceLocation;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
-
-import appeng.block.crafting.BlockCraftingUnit;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.core.AppEng;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.api.distmarker.OnlyIn;
/**
@@ -44,9 +38,9 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer
private final String registryName;
- private final BlockCraftingUnit.CraftingUnitType type;
+ private final AbstractCraftingUnitBlock.CraftingUnitType type;
- public CraftingCubeRendering( String registryName, BlockCraftingUnit.CraftingUnitType type )
+ public CraftingCubeRendering( String registryName, AbstractCraftingUnitBlock.CraftingUnitType type )
{
this.registryName = registryName;
this.type = type;
@@ -56,48 +50,47 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
+ if (type != AbstractCraftingUnitBlock.CraftingUnitType.MONITOR) {
+ rendering.renderType(RenderType.getCutout());
+ }
+
ResourceLocation baseName = new ResourceLocation( AppEng.MOD_ID, this.registryName );
// Disable auto-rotation
- if( this.type != BlockCraftingUnit.CraftingUnitType.MONITOR )
+ if( this.type != AbstractCraftingUnitBlock.CraftingUnitType.MONITOR )
{
rendering.modelCustomizer( ( loc, model ) -> model );
}
- // This is the standard blockstate model
- ModelResourceLocation defaultModel = new ModelResourceLocation( baseName, "normal" );
-
- // This is the built-in model
- String builtInName = "models/block/crafting/" + this.registryName + "/builtin";
- ModelResourceLocation builtInModelName = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, builtInName ), "normal" );
-
- rendering.builtInModel( builtInName, new CraftingCubeModel( this.type ) );
-
- rendering.stateMapper( block -> this.mapState( block, defaultModel, builtInModelName ) );
-
- if( this.type == BlockCraftingUnit.CraftingUnitType.MONITOR )
- {
- rendering.tileEntityRenderer( new CraftingMonitorTESR() );
- }
+// FIXME // This is the standard blockstate model
+// FIXME ModelResourceLocation defaultModel = new ModelResourceLocation( baseName, "normal" );
+// FIXME
+// FIXME // This is the built-in model
+// FIXME String builtInName = "models/block/crafting/" + this.registryName + "/builtin";
+// FIXME ModelResourceLocation builtInModelName = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, builtInName ), "normal" );
+// FIXME
+// FIXME rendering.builtInModel( builtInName, new CraftingCubeModel( this.type ) );
+// FIXME
+// FIXME rendering.stateMapper( block -> this.mapState( block, defaultModel, builtInModelName ) );
}
- private Map mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel )
- {
- Map result = new HashMap<>();
- for( BlockState state : block.getBlockState().getValidStates() )
- {
- if( state.getValue( BlockCraftingUnit.FORMED ) )
- {
- // Always use the builtin model if the multiblock is formed
- result.put( state, formedModel );
- }
- else
- {
- // Use the default model
- result.put( state, defaultModel );
- }
- }
- return result;
- }
+// FIXME private Map mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel )
+// FIXME {
+// FIXME Map result = new HashMap<>();
+// FIXME for( BlockState state : block.getBlockState().getValidStates() )
+// FIXME {
+// FIXME if( state.get( AbstractCraftingUnitBlock.FORMED ) )
+// FIXME {
+// FIXME // Always use the builtin model if the multiblock is formed
+// FIXME result.put( state, formedModel );
+// FIXME }
+// FIXME else
+// FIXME {
+// FIXME // Use the default model
+// FIXME result.put( state, defaultModel );
+// FIXME }
+// FIXME }
+// FIXME return result;
+// FIXME }
}
diff --git a/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java b/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java
index 7215e314e..50910036b 100644
--- a/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java
+++ b/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java
@@ -19,8 +19,10 @@
package appeng.client.render.crafting;
-import net.minecraft.client.renderer.GlStateManager;
+import com.mojang.blaze3d.matrix.MatrixStack;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -37,27 +39,26 @@ import appeng.tile.crafting.TileCraftingMonitorTile;
public class CraftingMonitorTESR extends TileEntityRenderer
{
+ public CraftingMonitorTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
+ super(rendererDispatcherIn);
+ }
+
@Override
- public void render( TileCraftingMonitorTile te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ )
- {
- if( te == null )
- {
- return;
- }
+ public void render(TileCraftingMonitorTile te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay) {
Direction facing = te.getForward();
IAEItemStack jobProgress = te.getJobProgress();
if( jobProgress != null )
{
- GlStateManager.pushMatrix();
- GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
+ matrixStack.push();
+ matrixStack.translate(0.5, 0.5, 0.5);
- TesrRenderHelper.moveToFace( facing );
- TesrRenderHelper.rotateToFace( facing, (byte) 0 );
- TesrRenderHelper.renderItem2dWithAmount( jobProgress, 0.7f, 0.1f );
+ TesrRenderHelper.moveToFace( matrixStack, facing );
+ TesrRenderHelper.rotateToFace( matrixStack, facing, (byte) 0 );
+ TesrRenderHelper.renderItem2dWithAmount(matrixStack, buffers, jobProgress, 0.7f, 0.1f );
- GlStateManager.popMatrix();
+ matrixStack.pop();
}
}
}
diff --git a/src/main/java/appeng/client/render/crafting/LightBakedModel.java b/src/main/java/appeng/client/render/crafting/LightBakedModel.java
index 7b9c861ed..326e0a61f 100644
--- a/src/main/java/appeng/client/render/crafting/LightBakedModel.java
+++ b/src/main/java/appeng/client/render/crafting/LightBakedModel.java
@@ -24,7 +24,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction;
-import appeng.block.crafting.BlockCraftingUnit;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.client.render.cablebus.CubeBuilder;
@@ -52,7 +52,7 @@ class LightBakedModel extends CraftingCubeBakedModel
builder.setTexture( this.baseTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
- boolean powered = state.getValue( BlockCraftingUnit.POWERED );
+ boolean powered = state.get( AbstractCraftingUnitBlock.POWERED );
builder.setRenderFullBright( powered );
builder.setTexture( this.lightTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
diff --git a/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java b/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java
index 4374d825d..92507d1f2 100644
--- a/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java
+++ b/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java
@@ -78,7 +78,7 @@ class MonitorBakedModel extends CraftingCubeBakedModel
// Now add the three layered light textures
AEColor color = getColor( state );
- boolean powered = state.getValue( BlockCraftingMonitor.POWERED );
+ boolean powered = state.get( BlockCraftingMonitor.POWERED );
builder.setRenderFullBright( powered );
diff --git a/src/main/java/appeng/client/render/effects/EnergyFx.java b/src/main/java/appeng/client/render/effects/EnergyFx.java
index 023553455..414e4b812 100644
--- a/src/main/java/appeng/client/render/effects/EnergyFx.java
+++ b/src/main/java/appeng/client/render/effects/EnergyFx.java
@@ -25,26 +25,26 @@ 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.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.AEPartLocation;
-import appeng.client.render.textures.ParticleTextures;
@OnlyIn( Dist.CLIENT )
public class EnergyFx extends BreakingParticle
{
- private final TextureAtlasSprite particleTextureIndex;
+ // FIXME private final TextureAtlasSprite particleTextureIndex;
private final int startBlkX;
private final int startBlkY;
private final int startBlkZ;
- public EnergyFx( final World par1World, final double par2, final double par4, final double par6, final Item par8Item )
+ public EnergyFx( final World par1World, final double par2, final double par4, final double par6, final ItemStack par8Item )
{
super( par1World, par2, par4, par6, par8Item );
this.particleGravity = 0;
@@ -53,102 +53,102 @@ public class EnergyFx extends BreakingParticle
this.particleRed = 1;
this.particleAlpha = 1.4f;
this.particleScale = 3.5f;
- this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
+ // FIXME this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
- this.startBlkX = MathHelper.floor( this.getPosX() );
- this.startBlkY = MathHelper.floor( this.getPosY() );
- this.startBlkZ = MathHelper.floor( this.getPosZ() );
- }
-
- @Override
- public int getFXLayer()
- {
- 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 )
- {
- final float f6 = this.particleTextureIndex.getMinU();
- final float f7 = this.particleTextureIndex.getMaxU();
- final float f8 = this.particleTextureIndex.getMinV();
- final float f9 = this.particleTextureIndex.getMaxV();
- final float f10 = 0.1F * this.particleScale;
-
- 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.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 )
- {
- int i = this.getBrightnessForRender( partialTicks );
- int j = i >> 16 & 65535;
- int k = i & 65535;
-
- final float f14 = 1.0F;
- par1Tessellator.pos( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10 )
- .tex( f7, f9 )
- .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
- .lightmap( j, k )
- .endVertex();
- par1Tessellator.pos( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10 )
- .tex( f7, f8 )
- .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
- .lightmap( j, k )
- .endVertex();
- par1Tessellator.pos( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10 )
- .tex( f6, f8 )
- .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
- .lightmap( j, k )
- .endVertex();
- par1Tessellator.pos( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10 )
- .tex( f6, f9 )
- .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
- .lightmap( j, k )
- .endVertex();
- }
- }
-
- public void fromItem( final AEPartLocation d )
- {
- 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 tick()
- {
- this.prevPosX = this.getPosX();
- this.prevPosY = this.getPosY();
- this.prevPosZ = this.getPosZ();
-
- if( this.age++ >= this.maxAge )
- {
- this.setExpired();
- }
-
- this.motionY -= 0.04D * this.particleGravity;
- this.move( this.motionX, this.motionY, this.motionZ );
- this.motionX *= 0.9800000190734863D;
- this.motionY *= 0.9800000190734863D;
- this.motionZ *= 0.9800000190734863D;
-
- this.particleScale *= 0.89f;
- this.particleAlpha *= 0.89f;
+ this.startBlkX = MathHelper.floor( this.posX );
+ this.startBlkY = MathHelper.floor( this.posY );
+ this.startBlkZ = MathHelper.floor( this.posZ );
}
+// FIXME @Override
+// FIXME public int getFXLayer()
+// FIXME {
+// FIXME return 1;
+// FIXME }
+// FIXME
+// FIXME @Override
+// FIXME public IParticleRenderType getRenderType() {
+// FIXME // TODO: FIXME
+// FIXME return IParticleRenderType.NO_RENDER;
+// FIXME }
+// FIXME
+// FIXME @Override
+// FIXME 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 )
+// FIXME {
+// FIXME final float f6 = this.particleTextureIndex.getMinU();
+// FIXME final float f7 = this.particleTextureIndex.getMaxU();
+// FIXME final float f8 = this.particleTextureIndex.getMinV();
+// FIXME final float f9 = this.particleTextureIndex.getMaxV();
+// FIXME final float f10 = 0.1F * this.particleScale;
+// FIXME
+// FIXME final float f11 = (float) ( this.prevPosX + ( this.getPosX() - this.prevPosX ) * partialTicks - interpPosX );
+// FIXME final float f12 = (float) ( this.prevPosY + ( this.getPosY() - this.prevPosY ) * partialTicks - interpPosY );
+// FIXME final float f13 = (float) ( this.prevPosZ + ( this.getPosZ() - this.prevPosZ ) * partialTicks - interpPosZ );
+// FIXME
+// FIXME final int blkX = MathHelper.floor( this.getPosX() );
+// FIXME final int blkY = MathHelper.floor( this.getPosY() );
+// FIXME final int blkZ = MathHelper.floor( this.getPosZ() );
+// FIXME
+// FIXME if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
+// FIXME {
+// FIXME int i = this.getBrightnessForRender( partialTicks );
+// FIXME int j = i >> 16 & 65535;
+// FIXME int k = i & 65535;
+// FIXME
+// FIXME final float f14 = 1.0F;
+// FIXME par1Tessellator.pos( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10 )
+// FIXME .tex( f7, f9 )
+// FIXME .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
+// FIXME .lightmap( j, k )
+// FIXME .endVertex();
+// FIXME par1Tessellator.pos( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10 )
+// FIXME .tex( f7, f8 )
+// FIXME .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
+// FIXME .lightmap( j, k )
+// FIXME .endVertex();
+// FIXME par1Tessellator.pos( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10 )
+// FIXME .tex( f6, f8 )
+// FIXME .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
+// FIXME .lightmap( j, k )
+// FIXME .endVertex();
+// FIXME par1Tessellator.pos( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10 )
+// FIXME .tex( f6, f9 )
+// FIXME .color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha )
+// FIXME .lightmap( j, k )
+// FIXME .endVertex();
+// FIXME }
+// FIXME }
+// FIXME
+ 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.particleScale *= 0.8f;
+ }
+// FIXME
+// FIXME @Override
+// FIXME public void tick()
+// FIXME {
+// FIXME this.prevPosX = this.getPosX();
+// FIXME this.prevPosY = this.getPosY();
+// FIXME this.prevPosZ = this.getPosZ();
+// FIXME
+// FIXME if( this.age++ >= this.maxAge )
+// FIXME {
+// FIXME this.setExpired();
+// FIXME }
+// FIXME
+// FIXME this.motionY -= 0.04D * this.particleGravity;
+// FIXME this.move( this.motionX, this.motionY, this.motionZ );
+// FIXME this.motionX *= 0.9800000190734863D;
+// FIXME this.motionY *= 0.9800000190734863D;
+// FIXME this.motionZ *= 0.9800000190734863D;
+// FIXME
+// FIXME this.particleScale *= 0.89f;
+// FIXME this.particleAlpha *= 0.89f;
+// FIXME }
+// FIXME
public void setMotionX( float motionX )
{
this.motionX = motionX;
diff --git a/src/main/java/appeng/client/render/tesr/InscriberTESR.java b/src/main/java/appeng/client/render/tesr/InscriberTESR.java
index 7ae505a05..e34b002ac 100644
--- a/src/main/java/appeng/client/render/tesr/InscriberTESR.java
+++ b/src/main/java/appeng/client/render/tesr/InscriberTESR.java
@@ -2,18 +2,15 @@
package appeng.client.render.tesr;
-import org.lwjgl.opengl.GL11;
+import com.mojang.blaze3d.matrix.MatrixStack;
+import com.mojang.blaze3d.vertex.IVertexBuilder;
+import net.minecraft.client.renderer.*;
+import net.minecraft.client.renderer.model.ItemCameraTransforms;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.BufferBuilder;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -39,32 +36,35 @@ public final class InscriberTESR extends TileEntityRenderer
private static TextureAtlasSprite textureInside;
+ public InscriberTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
+ super(rendererDispatcherIn);
+ }
+
@Override
- public void render( final TileInscriber tile, final double x, final double y, final double z, final float partialTicks, final int destroyStage, final float p_render_10_ )
- {
+ public void render(TileInscriber tile, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay) {
+
// render inscriber
- GlStateManager.pushMatrix();
- GlStateManager.translate( x, y, z );
- GlStateManager.translate( 0.5F, 0.5F, 0.5F );
- FacingToRotation.get( tile.getForward(), tile.getUp() ).push(matrixStack);
- GlStateManager.translate( -0.5F, -0.5F, -0.5F );
+ ms.push();
+ ms.translate( 0.5F, 0.5F, 0.5F );
+ FacingToRotation.get( tile.getForward(), tile.getUp() ).push(ms);
+ ms.translate( -0.5F, -0.5F, -0.5F );
- RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
- RenderSystem.disableLighting();
- GlStateManager.disableRescaleNormal();
+ // FIXME RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
+ // FIXME RenderSystem.disableLighting();
+ // FIXME RenderSystem.disableRescaleNormal();
// render sides of stamps
Minecraft mc = Minecraft.getInstance();
- mc.renderEngine.bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE );
+// FIXME RenderingEngine.getInstance().bindTexture( AtlasTexture.LOCATION_BLOCKS_TEXTURE );
// << 20 | light << 4;
- final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
- final int var11 = br % 65536;
- final int var12 = br / 65536;
+ // FIXME final int br = combinedLight;
+ // FIXME final int var11 = br % 65536;
+ // FIXME final int var12 = br / 65536;
- OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
+ // FIXME OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
long absoluteProgress = 0;
@@ -88,8 +88,10 @@ public final class InscriberTESR extends TileEntityRenderer
float press = 0.2f;
press -= progress / 5.0f;
- final BufferBuilder buffer = Tessellator.getInstance().getBuffer();
- buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX );
+ IVertexBuilder buffer = buffers.getBuffer(RenderType.getSolid());
+
+// final BufferBuilder buffer = Tessellator.getInstance().getBuffer();
+ // FIXME buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX );
float middle = 0.5f;
middle += 0.02f;
@@ -128,7 +130,7 @@ public final class InscriberTESR extends TileEntityRenderer
Tessellator.getInstance().draw();
// render items.
- RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
+// FIXME RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
IItemHandler tileInv = tile.getInternalInventory();
@@ -159,46 +161,46 @@ public final class InscriberTESR extends TileEntityRenderer
}
}
- this.renderItem( is, 0.0f, tile, x, y, z );
+ this.renderItem( ms, is, 0.0f, buffers, combinedLight, combinedOverlay );
}
else
{
- this.renderItem( tileInv.getStackInSlot( 0 ), press, tile, x, y, z );
- this.renderItem( tileInv.getStackInSlot( 1 ), -press, tile, x, y, z );
- this.renderItem( tileInv.getStackInSlot( 2 ), 0.0f, tile, x, y, z );
+ this.renderItem( ms, tileInv.getStackInSlot( 0 ), press, buffers, combinedLight, combinedOverlay );
+ this.renderItem( ms, tileInv.getStackInSlot( 1 ), -press, buffers, combinedLight, combinedOverlay );
+ this.renderItem( ms, tileInv.getStackInSlot( 2 ), 0.0f, buffers, combinedLight, combinedOverlay );
}
- GlStateManager.popMatrix();
- RenderSystem.enableLighting();
- GlStateManager.enableRescaleNormal();
+ ms.pop();
+ // FIXME RenderSystem.enableLighting();
+ // FIXME GlStateManager.enableRescaleNormal();
}
- private void renderItem( final ItemStack stack, final float o, final AEBaseTile tile, final double x, final double y, final double z )
+ private void renderItem( MatrixStack ms, final ItemStack stack, final float o, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay )
{
if( !stack.isEmpty() )
{
- final ItemStack sis = stack.copy();
+ final ItemStack sis = stack.copy(); // FIXME WHY????
- GlStateManager.pushMatrix();
+ ms.push();
// move to center
- GlStateManager.translate( 0.5f, 0.5f + o, 0.5f );
- GlStateManager.rotate( 90, 1, 0, 0 );
+ ms.translate( 0.5f, 0.5f + o, 0.5f );
+ ms.rotate( new Quaternion(90, 0, 0, true) );
// set scale
- GlStateManager.scale( ITEM_RENDER_SCALE, ITEM_RENDER_SCALE, ITEM_RENDER_SCALE );
+ ms.scale( ITEM_RENDER_SCALE, ITEM_RENDER_SCALE, ITEM_RENDER_SCALE );
// heuristic to scale items down much further than blocks
if( !( sis.getItem() instanceof BlockItem ) )
{
- GlStateManager.scale( 0.5, 0.5, 0.5 );
+ ms.scale( 0.5f, 0.5f, 0.5f );
}
- Minecraft.getInstance().getRenderItem().renderItem( sis, ItemCameraTransforms.TransformType.FIXED );
- GlStateManager.popMatrix();
+ Minecraft.getInstance().getItemRenderer().renderItem(sis, ItemCameraTransforms.TransformType.FIXED, combinedLight, combinedOverlay, ms, buffers);
+ ms.pop();
}
}
public static void registerTexture( TextureStitchEvent.Pre event )
{
- textureInside = event.getMap().registerSprite( TEXTURE_INSIDE );
+ // FIXME textureInside = event.getMap().registerSprite( TEXTURE_INSIDE );
}
}
diff --git a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java
index 2e1ce7219..231f32a61 100644
--- a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java
+++ b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java
@@ -21,10 +21,12 @@ package appeng.container.implementations;
import java.util.Iterator;
+import appeng.core.Api;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
-import net.minecraft.inventory.Slot;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.IContainerListener;
+import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
@@ -58,9 +60,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
private ItemStack prevStack = ItemStack.EMPTY;
private int lastUpgrades = 0;
- public ContainerCellWorkbench( final PlayerInventory ip, final TileCellWorkbench te )
+ public ContainerCellWorkbench(ContainerType> containerType, int id, final PlayerInventory ip, final TileCellWorkbench te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
this.workBench = te;
}
diff --git a/src/main/java/appeng/container/implementations/ContainerChest.java b/src/main/java/appeng/container/implementations/ContainerChest.java
index 44d212880..47f7ad272 100644
--- a/src/main/java/appeng/container/implementations/ContainerChest.java
+++ b/src/main/java/appeng/container/implementations/ContainerChest.java
@@ -24,6 +24,7 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileChest;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerChest extends AEBaseContainer
@@ -31,9 +32,9 @@ public class ContainerChest extends AEBaseContainer
private final TileChest chest;
- public ContainerChest( final PlayerInventory ip, final TileChest chest )
+ public ContainerChest( ContainerType> containerType, int id, final PlayerInventory ip, final TileChest chest )
{
- super( ip, chest, null );
+ super( containerType, id, ip, chest, null );
this.chest = chest;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest.getInternalInventory(), 1, 80, 37, this
diff --git a/src/main/java/appeng/container/implementations/ContainerCondenser.java b/src/main/java/appeng/container/implementations/ContainerCondenser.java
index 9d3ec9de3..d39809bbd 100644
--- a/src/main/java/appeng/container/implementations/ContainerCondenser.java
+++ b/src/main/java/appeng/container/implementations/ContainerCondenser.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.CondenserOutput;
@@ -44,9 +45,9 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
@GuiSync( 2 )
public CondenserOutput output = CondenserOutput.TRASH;
- public ContainerCondenser( final PlayerInventory ip, final TileCondenser condenser )
+ public ContainerCondenser(ContainerType> containerType, int id, final PlayerInventory ip, final TileCondenser condenser )
{
- super( ip, condenser, null );
+ super( containerType, id, ip, condenser, null );
this.condenser = condenser;
IItemHandler inv = condenser.getInternalInventory();
diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java
index ed9444078..7c5bc8384 100644
--- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java
+++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java
@@ -19,24 +19,6 @@
package appeng.container.implementations;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.concurrent.Future;
-
-import javax.annotation.Nonnull;
-
-import com.google.common.collect.ImmutableSet;
-
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.text.TextComponentString;
-import net.minecraft.world.World;
-
-import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
@@ -55,15 +37,26 @@ import appeng.api.storage.data.IItemList;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.core.AELog;
-import appeng.core.sync.GuiBridge;
+import appeng.core.Api;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
-import appeng.helpers.WirelessTerminalGuiObject;
import appeng.me.helpers.PlayerSource;
-import appeng.parts.reporting.PartCraftingTerminal;
-import appeng.parts.reporting.PartPatternTerminal;
-import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
+import com.google.common.collect.ImmutableSet;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.IContainerListener;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.world.World;
+
+import javax.annotation.Nonnull;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.concurrent.Future;
public class ContainerCraftConfirm extends AEBaseContainer
@@ -89,9 +82,8 @@ public class ContainerCraftConfirm extends AEBaseContainer
@GuiSync( 7 )
public String myName = "";
- public ContainerCraftConfirm( final PlayerInventory ip, final ITerminalHost te )
- {
- super( ip, te );
+ public ContainerCraftConfirm(ContainerType> containerType, int id, PlayerInventory ip, ITerminalHost te) {
+ super(containerType, id, ip, te);
}
public void cycleCpu( final boolean next )
@@ -279,7 +271,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
catch( final Throwable e )
{
- this.getPlayerInv().player.sendMessage( new TextComponentString( "Error: " + e.toString() ) );
+ this.getPlayerInv().player.sendMessage( new StringTextComponent( "Error: " + e.toString() ) );
AELog.debug( e );
this.setValidContainer( false );
this.result = null;
@@ -322,28 +314,28 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void startJob()
{
- GuiBridge originalGui = null;
+ /* FIXME GuiBridge */ Object originalGui = null;
final IActionHost ah = this.getActionHost();
- if( ah instanceof WirelessTerminalGuiObject )
- {
- originalGui = GuiBridge.GUI_WIRELESS_TERM;
- }
-
- if( ah instanceof PartTerminal )
- {
- originalGui = GuiBridge.GUI_ME;
- }
-
- if( ah instanceof PartCraftingTerminal )
- {
- originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
- }
-
- if( ah instanceof PartPatternTerminal )
- {
- originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
- }
+ // FIXME if( ah instanceof WirelessTerminalGuiObject )
+ // FIXME {
+ // FIXME originalGui = GuiBridge.GUI_WIRELESS_TERM;
+ // FIXME }
+// FIXME
+ // FIXME if( ah instanceof PartTerminal )
+ // FIXME {
+ // FIXME originalGui = GuiBridge.GUI_ME;
+ // FIXME }
+// FIXME
+ // FIXME if( ah instanceof PartCraftingTerminal )
+ // FIXME {
+ // FIXME originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
+ // FIXME }
+// FIXME
+ // FIXME if( ah instanceof PartPatternTerminal )
+ // FIXME {
+ // FIXME originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
+ // FIXME }
if( this.result != null && !this.isSimulation() )
{
@@ -354,7 +346,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if( g != null && originalGui != null && this.getOpenContext() != null )
{
final TileEntity te = this.getOpenContext().getTile();
- Platform.openGUI( this.getPlayerInventory().player, te, this.getOpenContext().getSide(), originalGui );
+ // FIXME Platform.openGUI( this.getPlayerInventory().player, te, this.getOpenContext().getSide(), originalGui );
}
}
}
diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java
index 5b1d72944..c06958672 100644
--- a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java
+++ b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java
@@ -21,12 +21,11 @@ package appeng.container.implementations;
import java.io.IOException;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
-import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.crafting.CraftingItemList;
import appeng.api.networking.crafting.ICraftingCPU;
@@ -48,6 +47,9 @@ import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.IContainerListener;
+import net.minecraft.util.text.ITextComponent;
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver, ICustomNameObject
@@ -56,14 +58,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
private final IItemList list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IGrid network;
private CraftingCPUCluster monitor = null;
- private String cpuName = null;
+ private ITextComponent cpuName = null;
@GuiSync( 0 )
public long eta = -1;
- public ContainerCraftingCPU( final PlayerInventory ip, final Object te )
+ public ContainerCraftingCPU(ContainerType> containerType, int id, final PlayerInventory ip, final Object te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
final IActionHost host = (IActionHost) ( te instanceof IActionHost ? te : null );
if( host != null && host.getActionableNode() != null )
@@ -121,7 +123,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
else
{
this.setMonitor( null );
- this.cpuName = "";
+ this.cpuName = null;
this.setEstimatedTime( -1 );
}
}
@@ -238,7 +240,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
}
@Override
- public String getCustomInventoryName()
+ public ITextComponent getCustomInventoryName()
{
return this.cpuName;
}
@@ -246,7 +248,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
@Override
public boolean hasCustomInventoryName()
{
- return this.cpuName != null && this.cpuName.length() > 0;
+ return this.cpuName != null;
}
public long getEstimatedTime()
diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java
index 632296311..c128dd921 100644
--- a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java
+++ b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java
@@ -32,6 +32,7 @@ import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerCraftingStatus extends ContainerCraftingCPU
@@ -45,9 +46,9 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
@GuiSync( 7 )
public String myName = "";
- public ContainerCraftingStatus( final PlayerInventory ip, final ITerminalHost te )
+ public ContainerCraftingStatus(ContainerType> containerType, int id, final PlayerInventory ip, final ITerminalHost te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
}
@Override
diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java
index fb6814a4b..202e0771b 100644
--- a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java
+++ b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java
@@ -22,9 +22,11 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.CraftingInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.IRecipeType;
+import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -47,11 +49,11 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
private final SlotCraftingTerm outputSlot;
- private IRecipe currentRecipe;
+ private IRecipe currentRecipe;
- public ContainerCraftingTerm( final PlayerInventory ip, final ITerminalHost monitorable )
+ public ContainerCraftingTerm(ContainerType> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
- super( ip, monitorable, false );
+ super( containerType, id, ip, monitorable, false );
this.ct = (PartCraftingTerminal) monitorable;
final IItemHandler crafting = this.ct.getInventoryByName( "crafting" );
@@ -89,7 +91,8 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, this.getPlayerInv().player.world ) )
{
- this.currentRecipe = CraftingManager.findMatchingRecipe( ic, this.getPlayerInv().player.world );
+ World world = this.getPlayerInv().player.world;
+ this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
}
if( this.currentRecipe == null )
@@ -132,7 +135,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
return true;
}
- public IRecipe getCurrentRecipe()
+ public IRecipe getCurrentRecipe()
{
return this.currentRecipe;
}
diff --git a/src/main/java/appeng/container/implementations/ContainerDrive.java b/src/main/java/appeng/container/implementations/ContainerDrive.java
index 0003b47a6..3359cde63 100644
--- a/src/main/java/appeng/container/implementations/ContainerDrive.java
+++ b/src/main/java/appeng/container/implementations/ContainerDrive.java
@@ -24,14 +24,15 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileDrive;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerDrive extends AEBaseContainer
{
- public ContainerDrive( final PlayerInventory ip, final TileDrive drive )
+ public ContainerDrive(ContainerType> containerType, int id, final PlayerInventory ip, final TileDrive drive )
{
- super( ip, drive, null );
+ super( containerType, id, ip, drive, null );
for( int y = 0; y < 5; y++ )
{
diff --git a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java
index de55577a0..516f5e3b3 100644
--- a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java
+++ b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
@@ -41,9 +42,9 @@ public class ContainerFormationPlane extends ContainerUpgradeable
@GuiSync( 6 )
public YesNo placeMode;
- public ContainerFormationPlane( final PlayerInventory ip, final PartFormationPlane te )
+ public ContainerFormationPlane(ContainerType> containerType, int id, final PlayerInventory ip, final PartFormationPlane te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
}
@Override
diff --git a/src/main/java/appeng/container/implementations/ContainerIOPort.java b/src/main/java/appeng/container/implementations/ContainerIOPort.java
index 530406dfb..db1539a5f 100644
--- a/src/main/java/appeng/container/implementations/ContainerIOPort.java
+++ b/src/main/java/appeng/container/implementations/ContainerIOPort.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FullnessMode;
@@ -42,9 +43,9 @@ public class ContainerIOPort extends ContainerUpgradeable
@GuiSync( 3 )
public OperationMode opMode = OperationMode.EMPTY;
- public ContainerIOPort( final PlayerInventory ip, final TileIOPort te )
+ public ContainerIOPort(ContainerType> containerType, int id, final PlayerInventory ip, final TileIOPort te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
}
@Override
diff --git a/src/main/java/appeng/container/implementations/ContainerInscriber.java b/src/main/java/appeng/container/implementations/ContainerInscriber.java
index d06300fc8..c89b25389 100644
--- a/src/main/java/appeng/container/implementations/ContainerInscriber.java
+++ b/src/main/java/appeng/container/implementations/ContainerInscriber.java
@@ -19,8 +19,10 @@
package appeng.container.implementations;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.Slot;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -55,9 +57,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
@GuiSync( 3 )
public int processingTime = -1;
- public ContainerInscriber( final PlayerInventory ip, final TileInscriber te )
+ public ContainerInscriber(ContainerType> containerType, int id, final PlayerInventory ip, final TileInscriber te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
this.ti = te;
IItemHandler inv = te.getInternalInventory();
diff --git a/src/main/java/appeng/container/implementations/ContainerInterface.java b/src/main/java/appeng/container/implementations/ContainerInterface.java
index 955f6e3a1..6f09fd214 100644
--- a/src/main/java/appeng/container/implementations/ContainerInterface.java
+++ b/src/main/java/appeng/container/implementations/ContainerInterface.java
@@ -31,6 +31,7 @@ import appeng.container.slot.SlotNormal;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerInterface extends ContainerUpgradeable
@@ -44,9 +45,9 @@ public class ContainerInterface extends ContainerUpgradeable
@GuiSync( 4 )
public YesNo iTermMode = YesNo.YES;
- public ContainerInterface( final PlayerInventory ip, final IInterfaceHost te )
+ public ContainerInterface(ContainerType> containerType, int id, final PlayerInventory ip, final IInterfaceHost te )
{
- super( ip, te.getInterfaceDuality().getHost() );
+ super( containerType, id, ip, te.getInterfaceDuality().getHost() );
this.myDuality = te.getInterfaceDuality();
diff --git a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java
index 1fdea18a5..e2587b63e 100644
--- a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java
+++ b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java
@@ -26,6 +26,7 @@ import java.util.Map.Entry;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler;
@@ -69,9 +70,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
private IGrid grid;
private CompoundNBT data = new CompoundNBT();
- public ContainerInterfaceTerminal( final PlayerInventory ip, final PartInterfaceTerminal anchor )
+ public ContainerInterfaceTerminal(ContainerType> containerType, int id, final PlayerInventory ip, final PartInterfaceTerminal anchor )
{
- super( ip, anchor );
+ super( containerType, id, ip, anchor );
if( Platform.isServer() )
{
@@ -372,7 +373,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
private void addItems( final CompoundNBT data, final InvTracker inv, final int offset, final int length )
{
final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
- final CompoundNBT tag = data.getCompoundTag( name );
+ final CompoundNBT tag = data.getCompound( name );
if( tag.isEmpty() )
{
@@ -394,10 +395,10 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
is.write(itemNBT);
}
- tag.setTag( Integer.toString( x + offset ), itemNBT );
+ tag.put( Integer.toString( x + offset ), itemNBT );
}
- data.setTag( name, tag );
+ data.put( name, tag );
}
private static class InvTracker
diff --git a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java
index 331017c5d..6dd70f1a8 100644
--- a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java
+++ b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java
@@ -19,9 +19,10 @@
package appeng.container.implementations;
-import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
@@ -45,7 +46,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
private final PartLevelEmitter lvlEmitter;
@OnlyIn( Dist.CLIENT )
- private GuiTextField textField;
+ private TextFieldWidget textField;
@GuiSync( 2 )
public LevelType lvType;
@GuiSync( 3 )
@@ -53,14 +54,14 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
@GuiSync( 4 )
public YesNo cmType;
- public ContainerLevelEmitter( final PlayerInventory ip, final PartLevelEmitter te )
+ public ContainerLevelEmitter( ContainerType> containerType, int id, final PlayerInventory ip, final PartLevelEmitter te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
this.lvlEmitter = te;
}
@OnlyIn( Dist.CLIENT )
- public void setTextField( final GuiTextField level )
+ public void setTextField( final TextFieldWidget level )
{
this.textField = level;
this.textField.setText( String.valueOf( this.EmitterValue ) );
diff --git a/src/main/java/appeng/container/implementations/ContainerMAC.java b/src/main/java/appeng/container/implementations/ContainerMAC.java
index 59ab476a9..0dfb12087 100644
--- a/src/main/java/appeng/container/implementations/ContainerMAC.java
+++ b/src/main/java/appeng/container/implementations/ContainerMAC.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
@@ -46,9 +47,9 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
@GuiSync( 4 )
public int craftProgress = 0;
- public ContainerMAC( final PlayerInventory ip, final TileMolecularAssembler te )
+ public ContainerMAC(ContainerType> containerType, int id, final PlayerInventory ip, final TileMolecularAssembler te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
this.tma = te;
}
diff --git a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java
index 2efd137cb..f60f4e096 100644
--- a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java
+++ b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java
@@ -24,10 +24,12 @@ import java.nio.BufferOverflowException;
import javax.annotation.Nonnull;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -88,14 +90,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
private IConfigManager serverCM;
private IGridNode networkNode;
- public ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable )
+
+ public ContainerMEMonitorable( ContainerType> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
- this( ip, monitorable, true );
+ this( containerType, id, ip, monitorable, true );
}
- protected ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable, final boolean bindInventory )
- {
- super( ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null );
+ public ContainerMEMonitorable(ContainerType> containerType, int id, PlayerInventory ip, final ITerminalHost monitorable, final boolean bindInventory ) {
+ super( containerType,
+ id,
+ ip,
+ monitorable instanceof TileEntity ? (TileEntity) monitorable : null,
+ monitorable instanceof IPart ? (IPart) monitorable : null );
this.host = monitorable;
this.clientCM = new ConfigManager( this );
diff --git a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java
index de4abed4a..b490285eb 100644
--- a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java
+++ b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
@@ -37,9 +38,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
private int ticks = 0;
private final int slot;
- public ContainerMEPortableCell( final PlayerInventory ip, final IPortableCell monitorable )
+ public ContainerMEPortableCell(ContainerType> containerType, int id, final PlayerInventory ip, final IPortableCell monitorable )
{
- super( ip, monitorable, false );
+ super( containerType, id, ip, monitorable, false );
if( monitorable instanceof IInventorySlotAware )
{
final int slotIndex = ( (IInventorySlotAware) monitorable ).getInventorySlot();
diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java
index de9f2b993..23a901c0a 100644
--- a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java
+++ b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java
@@ -21,9 +21,12 @@ package appeng.container.implementations;
import java.io.IOException;
+import appeng.api.parts.IPart;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
@@ -43,6 +46,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
+import net.minecraft.tileentity.TileEntity;
public class ContainerNetworkStatus extends AEBaseContainer
@@ -59,9 +63,8 @@ public class ContainerNetworkStatus extends AEBaseContainer
private IGrid network;
private int delay = 40;
- public ContainerNetworkStatus( final PlayerInventory ip, final INetworkTool te )
- {
- super( ip, null, null );
+ public ContainerNetworkStatus(ContainerType> containerType, int id, PlayerInventory ip, final INetworkTool te) {
+ super(containerType, id, ip, null, null);
final IGridHost host = te.getGridHost();
if( host != null )
diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java
index c2c080ac3..7a365949f 100644
--- a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java
+++ b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -37,9 +38,9 @@ public class ContainerNetworkTool extends AEBaseContainer
@GuiSync( 1 )
public boolean facadeMode;
- public ContainerNetworkTool( final PlayerInventory ip, final INetworkTool te )
+ public ContainerNetworkTool(ContainerType> containerType, int id, final PlayerInventory ip, final INetworkTool te )
{
- super( ip, null, null );
+ super( containerType, id, ip, null, null );
this.toolInv = te;
this.lockPlayerInventorySlot( ip.currentItem );
diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java
index a885dc78b..81145fb6d 100644
--- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java
+++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java
@@ -19,28 +19,6 @@
package appeng.container.implementations;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
-import net.minecraft.inventory.InventoryCraftResult;
-import net.minecraft.inventory.CraftingInventory;
-import net.minecraft.inventory.Slot;
-import net.minecraft.inventory.SlotCrafting;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.CraftingManager;
-import net.minecraft.item.crafting.IRecipe;
-import net.minecraft.nbt.NBTBase;
-import net.minecraft.nbt.CompoundNBT;
-import net.minecraft.nbt.ListNBT;
-import net.minecraft.world.World;
-import net.minecraftforge.items.IItemHandler;
-import net.minecraftforge.items.wrapper.PlayerInvWrapper;
-
import appeng.api.config.Actionable;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.IMEMonitor;
@@ -50,12 +28,8 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull;
import appeng.container.guisync.GuiSync;
-import appeng.container.slot.IOptionalSlotHost;
-import appeng.container.slot.OptionalSlotFake;
-import appeng.container.slot.SlotFakeCraftingMatrix;
-import appeng.container.slot.SlotPatternOutputs;
-import appeng.container.slot.SlotPatternTerm;
-import appeng.container.slot.SlotRestrictedInput;
+import appeng.container.slot.*;
+import appeng.core.Api;
import appeng.core.sync.packets.PacketPatternSlot;
import appeng.helpers.IContainerCraftingPacket;
import appeng.items.storage.ItemViewCell;
@@ -69,6 +43,28 @@ import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.item.AEItemStack;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.inventory.CraftResultInventory;
+import net.minecraft.inventory.CraftingInventory;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.CraftingResultSlot;
+import net.minecraft.inventory.container.IContainerListener;
+import net.minecraft.inventory.container.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.IRecipeType;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.nbt.INBT;
+import net.minecraft.nbt.ListNBT;
+import net.minecraft.world.World;
+import net.minecraftforge.items.IItemHandler;
+import net.minecraftforge.items.wrapper.PlayerInvWrapper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket
@@ -83,15 +79,15 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private final SlotRestrictedInput patternSlotIN;
private final SlotRestrictedInput patternSlotOUT;
- private IRecipe currentRecipe;
+ private IRecipe currentRecipe;
@GuiSync( 97 )
public boolean craftingMode = true;
@GuiSync( 96 )
public boolean substitute = false;
- public ContainerPatternTerm( final PlayerInventory ip, final ITerminalHost monitorable )
+ public ContainerPatternTerm(ContainerType> type, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
- super( ip, monitorable, false );
+ super( type, id, ip, monitorable, false );
this.patternTerminal = (PartPatternTerminal) monitorable;
final IItemHandler patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
@@ -135,20 +131,20 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( !this.isCraftingMode() )
{
- this.craftSlot.xPos = -9000;
+ // FIXME this.craftSlot.xPos = -9000;
for( int y = 0; y < 3; y++ )
{
- this.outputSlots[y].xPos = this.outputSlots[y].getX();
+ // FIXME this.outputSlots[y].xPos = this.outputSlots[y].getX();
}
}
else
{
- this.craftSlot.xPos = this.craftSlot.getX();
+ // FIXME this.craftSlot.xPos = this.craftSlot.getX();
for( int y = 0; y < 3; y++ )
{
- this.outputSlots[y].xPos = -9000;
+ // FIXME this.outputSlots[y].xPos = -9000;
}
}
}
@@ -172,7 +168,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, world ) )
{
- this.currentRecipe = CraftingManager.findMatchingRecipe( ic, world );
+ this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
}
final ItemStack is;
@@ -252,20 +248,20 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
for( final ItemStack i : in )
{
- tagIn.appendTag( this.createItemTag( i ) );
+ tagIn.add( this.createItemTag( i ) );
}
for( final ItemStack i : out )
{
- tagOut.appendTag( this.createItemTag( i ) );
+ tagOut.add( this.createItemTag( i ) );
}
- encodedValue.setTag( "in", tagIn );
- encodedValue.setTag( "out", tagOut );
+ encodedValue.put( "in", tagIn );
+ encodedValue.put( "out", tagOut );
encodedValue.putBoolean("crafting", this.isCraftingMode());
encodedValue.putBoolean("substitute", this.isSubstitute());
- output.setTagCompound( encodedValue );
+ output.setTag( encodedValue );
}
private ItemStack[] getInputs()
@@ -341,7 +337,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
return isPattern;
}
- private NBTBase createItemTag( final ItemStack i )
+ private INBT createItemTag( final ItemStack i )
{
final CompoundNBT c = new CompoundNBT();
@@ -410,7 +406,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].createItemStack() );
}
- final IRecipe r = CraftingManager.findMatchingRecipe( ic, p.world );
+ final IRecipe r = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, p.world).orElse(null);
if( r == null )
{
@@ -433,14 +429,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
}
- final IRecipe rr = CraftingManager.findMatchingRecipe( real, p.world );
+ final IRecipe rr = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, real, p.world).orElse(null);
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
{
- final InventoryCraftResult craftingResult = new InventoryCraftResult();
+ final CraftResultInventory craftingResult = new CraftResultInventory();
craftingResult.setRecipeUsed( rr );
- final SlotCrafting sc = new SlotCrafting( p, real, craftingResult, 0, 0, 0 );
+ final CraftingResultSlot sc = new CraftingResultSlot( p, real, craftingResult, 0, 0, 0 );
sc.onTake( p, is );
for( int x = 0; x < real.getSizeInventory(); x++ )
@@ -504,6 +500,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
}
+
+
@Override
public void onSlotChange( final Slot s )
{
diff --git a/src/main/java/appeng/container/implementations/ContainerPriority.java b/src/main/java/appeng/container/implementations/ContainerPriority.java
index 9f0b5fdba..06b86b61a 100644
--- a/src/main/java/appeng/container/implementations/ContainerPriority.java
+++ b/src/main/java/appeng/container/implementations/ContainerPriority.java
@@ -19,9 +19,10 @@
package appeng.container.implementations;
-import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,18 +41,18 @@ public class ContainerPriority extends AEBaseContainer
private final IPriorityHost priHost;
@OnlyIn( Dist.CLIENT )
- private GuiTextField textField;
+ private TextFieldWidget textField;
@GuiSync( 2 )
public long PriorityValue = -1;
- public ContainerPriority( final PlayerInventory ip, final IPriorityHost te )
+ public ContainerPriority(ContainerType> containerType, int id, final PlayerInventory ip, final IPriorityHost te )
{
- super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
+ super( containerType, id, ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
this.priHost = te;
}
@OnlyIn( Dist.CLIENT )
- public void setTextField( final GuiTextField level )
+ public void setTextField( final TextFieldWidget level )
{
this.textField = level;
this.textField.setText( String.valueOf( this.PriorityValue ) );
diff --git a/src/main/java/appeng/container/implementations/ContainerQNB.java b/src/main/java/appeng/container/implementations/ContainerQNB.java
index 665fceb66..fab97e429 100644
--- a/src/main/java/appeng/container/implementations/ContainerQNB.java
+++ b/src/main/java/appeng/container/implementations/ContainerQNB.java
@@ -24,14 +24,15 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.qnb.TileQuantumBridge;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerQNB extends AEBaseContainer
{
- public ContainerQNB( final PlayerInventory ip, final TileQuantumBridge quantumBridge )
+ public ContainerQNB(ContainerType> containerType, int id, final PlayerInventory ip, final TileQuantumBridge quantumBridge )
{
- super( ip, quantumBridge, null );
+ super( containerType, id, ip, quantumBridge, null );
this.addSlot( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
.getInternalInventory(), 0, 80, 37, this.getPlayerInventory() ) ).setStackLimit( 1 ) );
diff --git a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java
index 65189cebe..1b1d3e202 100644
--- a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java
+++ b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java
@@ -21,8 +21,10 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.MinecraftForge;
@@ -45,9 +47,9 @@ public class ContainerQuartzKnife extends AEBaseContainer
private final IItemHandler inSlot = new AppEngInternalInventory( null, 1, 1 );
private String myName = "";
- public ContainerQuartzKnife( final PlayerInventory ip, final QuartzKnifeObj te )
+ public ContainerQuartzKnife(ContainerType> containerType, int id, final PlayerInventory ip, final QuartzKnifeObj te )
{
- super( ip, null, null );
+ super( containerType, id, ip, null, null );
this.toolInv = te;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip ) );
@@ -120,7 +122,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
if( ContainerQuartzKnife.this.myName.length() > 0 )
{
- return Api.INSTANCE.definitions().materials().namePress().maybeStack( 1 ).map( namePressStack ->
+ return Api.INSTANCE.definitions().materials().namePress().maybeStack( 1 ).map(namePressStack ->
{
final CompoundNBT compound = namePressStack.getOrCreateTag();
compound.putString("InscribeName", ContainerQuartzKnife.this.myName);
@@ -161,14 +163,11 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
final ItemStack before = item.copy();
- item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
-
- if( item.getCount() == 0 )
- {
+ item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player, p -> {
ContainerQuartzKnife.this.getPlayerInv()
.setInventorySlotContents( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, before, null ) );
- }
+ } );
ContainerQuartzKnife.this.detectAndSendChanges();
}
diff --git a/src/main/java/appeng/container/implementations/ContainerSecurityStation.java b/src/main/java/appeng/container/implementations/ContainerSecurityStation.java
index bd1f76303..389b4fdb1 100644
--- a/src/main/java/appeng/container/implementations/ContainerSecurityStation.java
+++ b/src/main/java/appeng/container/implementations/ContainerSecurityStation.java
@@ -19,9 +19,11 @@
package appeng.container.implementations;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.inventory.IContainerListener;
+import net.minecraft.inventory.container.ContainerType;
+import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -53,9 +55,9 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
@GuiSync( 0 )
public int permissionMode = 0;
- public ContainerSecurityStation( final PlayerInventory ip, final ITerminalHost monitorable )
+ public ContainerSecurityStation(ContainerType> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
- super( ip, monitorable, false );
+ super( containerType, id, ip, monitorable, false );
this.securityBox = (TileSecurityStation) monitorable;
diff --git a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java
index 2e3ce9bb7..4c76931b6 100644
--- a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java
+++ b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java
@@ -33,6 +33,7 @@ import appeng.container.slot.SlotOutput;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerSpatialIOPort extends AEBaseContainer
@@ -56,9 +57,9 @@ public class ContainerSpatialIOPort extends AEBaseContainer
@GuiSync( 33 )
public int zSize;
- public ContainerSpatialIOPort( final PlayerInventory ip, final TileSpatialIOPort spatialIOPort )
+ public ContainerSpatialIOPort(ContainerType> containerType, int id, final PlayerInventory ip, final TileSpatialIOPort spatialIOPort )
{
- super( ip, spatialIOPort, null );
+ super( containerType, id, ip, spatialIOPort, null );
if( Platform.isServer() )
{
diff --git a/src/main/java/appeng/container/implementations/ContainerStorageBus.java b/src/main/java/appeng/container/implementations/ContainerStorageBus.java
index 5f62bf12f..e08d25595 100644
--- a/src/main/java/appeng/container/implementations/ContainerStorageBus.java
+++ b/src/main/java/appeng/container/implementations/ContainerStorageBus.java
@@ -21,7 +21,9 @@ package appeng.container.implementations;
import java.util.Iterator;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -56,9 +58,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
@GuiSync( 4 )
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
- public ContainerStorageBus( final PlayerInventory ip, final PartStorageBus te )
+ public ContainerStorageBus(ContainerType> containerType, int id, final PlayerInventory ip, final PartStorageBus te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
this.storageBus = te;
}
diff --git a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java
index c6b5a7698..0894f8ea2 100644
--- a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java
+++ b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java
@@ -21,6 +21,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@@ -66,9 +67,9 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
private int tbSlot;
private NetworkToolViewer tbInventory;
- public ContainerUpgradeable( final PlayerInventory ip, final IUpgradeableHost te )
+ public ContainerUpgradeable(ContainerType> containerType, int id, final PlayerInventory ip, final IUpgradeableHost te )
{
- super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
+ super( containerType, id, ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
this.upgradeable = te;
World w = null;
diff --git a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java
index eb67b2390..e07a948e3 100644
--- a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java
+++ b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java
@@ -27,6 +27,7 @@ import appeng.container.interfaces.IProgressProvider;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerVibrationChamber extends AEBaseContainer implements IProgressProvider
@@ -37,9 +38,9 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
@GuiSync( 1 )
public int remainingBurnTime = 0;
- public ContainerVibrationChamber( final PlayerInventory ip, final TileVibrationChamber vibrationChamber )
+ public ContainerVibrationChamber(ContainerType> containerType, int id, final PlayerInventory ip, final TileVibrationChamber vibrationChamber )
{
- super( ip, vibrationChamber, null );
+ super( containerType, id, ip, vibrationChamber, null );
this.vibrationChamber = vibrationChamber;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber.getInternalInventory(), 0, 80, 37, this
diff --git a/src/main/java/appeng/container/implementations/ContainerWireless.java b/src/main/java/appeng/container/implementations/ContainerWireless.java
index ce36fec65..2f33b4039 100644
--- a/src/main/java/appeng/container/implementations/ContainerWireless.java
+++ b/src/main/java/appeng/container/implementations/ContainerWireless.java
@@ -26,6 +26,7 @@ import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AEConfig;
import appeng.tile.networking.TileWireless;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerWireless extends AEBaseContainer
@@ -38,9 +39,9 @@ public class ContainerWireless extends AEBaseContainer
@GuiSync( 2 )
public long drain = 0;
- public ContainerWireless( final PlayerInventory ip, final TileWireless te )
+ public ContainerWireless(ContainerType> containerType, int id, final PlayerInventory ip, final TileWireless te )
{
- super( ip, te, null );
+ super( containerType, id, ip, te, null );
this.wirelessTerminal = te;
this.addSlot( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal
diff --git a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java
index 83b7a0c28..800837e59 100644
--- a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java
+++ b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java
@@ -25,6 +25,7 @@ import appeng.core.AEConfig;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.util.Platform;
+import net.minecraft.inventory.container.ContainerType;
public class ContainerWirelessTerm extends ContainerMEPortableCell
@@ -32,9 +33,9 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
- public ContainerWirelessTerm( final PlayerInventory ip, final WirelessTerminalGuiObject gui )
+ public ContainerWirelessTerm(ContainerType> containerType, int id, final PlayerInventory ip, final WirelessTerminalGuiObject gui )
{
- super( ip, gui );
+ super( containerType, id, ip, gui );
this.wirelessTerminalGUIObject = gui;
}
diff --git a/src/main/java/appeng/container/implementations/CraftingCPURecord.java b/src/main/java/appeng/container/implementations/CraftingCPURecord.java
index 538210287..0f9b78bf9 100644
--- a/src/main/java/appeng/container/implementations/CraftingCPURecord.java
+++ b/src/main/java/appeng/container/implementations/CraftingCPURecord.java
@@ -22,12 +22,13 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
import appeng.api.networking.crafting.ICraftingCPU;
+import net.minecraft.util.text.ITextComponent;
public class CraftingCPURecord implements Comparable
{
- private final String myName;
+ private final ITextComponent myName;
private final ICraftingCPU cpu;
private final long size;
private final int processors;
@@ -56,7 +57,7 @@ public class CraftingCPURecord implements Comparable
return this.cpu;
}
- String getName()
+ ITextComponent getName()
{
return this.myName;
}
diff --git a/src/main/java/appeng/container/interfaces/IProgressProvider.java b/src/main/java/appeng/container/interfaces/IProgressProvider.java
index 4dbb294a7..2f6f72d1d 100644
--- a/src/main/java/appeng/container/interfaces/IProgressProvider.java
+++ b/src/main/java/appeng/container/interfaces/IProgressProvider.java
@@ -19,13 +19,11 @@
package appeng.container.interfaces;
-import appeng.client.gui.widgets.GuiProgressBar;
-
/**
* This interface provides the data for anything simulating a progress.
*
- * Its main use is in combination with the {@link GuiProgressBar}, which ensures to scale it to a percentage of 0 to
+ * Its main use is in combination with the {@link appeng.client.gui.widgets.GuiProgressBar}, which ensures to scale it to a percentage of 0 to
* 100.
*/
public interface IProgressProvider
diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java
index 205783442..84f7313af 100644
--- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java
+++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java
@@ -28,14 +28,13 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
+import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
-import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.IActionSource;
@@ -161,12 +160,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
- protected IRecipe findRecipe( CraftingInventory ic, World world )
+ protected IRecipe findRecipe( CraftingInventory ic, World world )
{
if( this.container instanceof ContainerCraftingTerm )
{
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
- final IRecipe recipe = containerTerminal.getCurrentRecipe();
+ final IRecipe recipe = containerTerminal.getCurrentRecipe();
if( recipe != null && recipe.matches( ic, world ) )
{
@@ -174,7 +173,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
}
- return CraftingManager.findMatchingRecipe( ic, world );
+ return world.getRecipeManager().getRecipe( IRecipeType.CRAFTING, ic, world ).orElse(null);
}
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
@@ -184,7 +183,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if( this.container instanceof ContainerCraftingTerm )
{
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
- final IRecipe recipe = containerTerminal.getCurrentRecipe();
+ final IRecipe recipe = containerTerminal.getCurrentRecipe();
if( recipe != null && recipe.matches( ic, world ) )
{
@@ -192,7 +191,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
}
- return CraftingManager.getRemainingItems( ic, world );
+ return world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world)
+ .map(r -> r.getRemainingItems(ic))
+ .orElse(NonNullList.create());
}
private int capCraftingAttempts( final int maxTimesToCraft )
@@ -220,12 +221,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
}
- final IRecipe r = this.findRecipe( ic, p.world );
+ final IRecipe r = this.findRecipe( ic, p.world );
if( r == null )
{
final Item target = request.getItem();
- if( target.isDamageable() && target.isRepairable() )
+ if( target.isDamageable() && target.isRepairable(request) )
{
boolean isBad = false;
for( int x = 0; x < ic.getSizeInventory(); x++ )
diff --git a/src/main/java/appeng/container/slot/SlotPatternTerm.java b/src/main/java/appeng/container/slot/SlotPatternTerm.java
index a22b16f08..687ebd2e2 100644
--- a/src/main/java/appeng/container/slot/SlotPatternTerm.java
+++ b/src/main/java/appeng/container/slot/SlotPatternTerm.java
@@ -21,6 +21,7 @@ package appeng.container.slot;
import java.io.IOException;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java
index 90d101c0b..308902896 100644
--- a/src/main/java/appeng/core/AppEng.java
+++ b/src/main/java/appeng/core/AppEng.java
@@ -51,6 +51,8 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
+import javax.annotation.Nonnull;
+
@Mod(AppEng.MOD_ID)
public final class AppEng
@@ -83,6 +85,7 @@ public final class AppEng
if (INSTANCE != null) {
throw new IllegalStateException();
}
+ INSTANCE = this;
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, AEConfig.CLIENT_SPEC);
@@ -126,12 +129,15 @@ public final class AppEng
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "sky_compass"), SkyCompassModelLoader.INSTANCE);
}
-// @Nonnull
-// public static AppEng instance()
-// {
-// return INSTANCE;
-// }
-//
+ @Nonnull
+ public static AppEng instance()
+ {
+ if (INSTANCE == null) {
+ throw new IllegalStateException();
+ }
+ return INSTANCE;
+ }
+
// public Biome getStorageBiome()
// {
// return this.registration.storageBiome;
diff --git a/src/main/java/appeng/core/FacadeConfig.java b/src/main/java/appeng/core/FacadeConfig.java
index fe1212e83..5bc10e50d 100644
--- a/src/main/java/appeng/core/FacadeConfig.java
+++ b/src/main/java/appeng/core/FacadeConfig.java
@@ -19,20 +19,12 @@
package appeng.core;
-import java.io.File;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import net.minecraft.block.Block;
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.common.config.ConfigCategory;
-import net.minecraftforge.common.config.Configuration;
-import net.minecraftforge.common.config.Property;
-import net.minecraftforge.common.config.Property.Type;
-
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
+import net.minecraft.block.Block;
+import net.minecraft.util.ResourceLocation;
+
+import java.io.File;
public class FacadeConfig
@@ -72,73 +64,73 @@ public class FacadeConfig
*/
public static void init( final File configFile )
{
- final Configuration configurartion = migrate( new Configuration( configFile, CONFIG_VERSION ) );
+// FIXME final Configuration configurartion = migrate( new Configuration( configFile, CONFIG_VERSION ) );
+// FIXME
+// FIXME final boolean allowTileEntityFacades = configurartion
+// FIXME .get( CONFIG_COMMON_KEY, CONFIG_COMMON_ALLOW_TILEENTITIES_KEY, false, CONFIG_COMMON_ALLOW_TILEENTITIES_COMMENT )
+// FIXME .setRequiresMcRestart( true )
+// FIXME .setShowInGui( false )
+// FIXME .getBoolean();
+// FIXME
+// FIXME final Object2IntMap configWhiteList = new Object2IntArrayMap<>();
+// FIXME
+// FIXME final Set whitelist = configurartion.getCategory( CONFIG_FACADES_KEY ).getChildren();
+// FIXME for( ConfigCategory configCategory : whitelist )
+// FIXME {
+// FIXME final String domain = configCategory.getName();
+// FIXME final Map values = configCategory.getValues();
+// FIXME
+// FIXME for( Entry entry : values.entrySet() )
+// FIXME {
+// FIXME configWhiteList.put( new ResourceLocation( domain, entry.getKey() ), entry.getValue().getInt() );
+// FIXME }
+// FIXME }
+// FIXME
+// FIXME if( configurartion.hasChanged() )
+// FIXME {
+// FIXME configurartion.save();
+// FIXME }
- final boolean allowTileEntityFacades = configurartion
- .get( CONFIG_COMMON_KEY, CONFIG_COMMON_ALLOW_TILEENTITIES_KEY, false, CONFIG_COMMON_ALLOW_TILEENTITIES_COMMENT )
- .setRequiresMcRestart( true )
- .setShowInGui( false )
- .getBoolean();
-
- final Object2IntMap configWhiteList = new Object2IntArrayMap<>();
-
- final Set whitelist = configurartion.getCategory( CONFIG_FACADES_KEY ).getChildren();
- for( ConfigCategory configCategory : whitelist )
- {
- final String domain = configCategory.getName();
- final Map values = configCategory.getValues();
-
- for( Entry entry : values.entrySet() )
- {
- configWhiteList.put( new ResourceLocation( domain, entry.getKey() ), entry.getValue().getInt() );
- }
- }
-
- if( configurartion.hasChanged() )
- {
- configurartion.save();
- }
-
- instance = new FacadeConfig( allowTileEntityFacades, configWhiteList );
+ instance = new FacadeConfig( false, new Object2IntArrayMap<>() ); // FIXME
}
- private static Configuration migrate( Configuration configurartion )
- {
- // Clear pre rv6 configs.
- if( configurartion.getLoadedConfigVersion() == null )
- {
- for( String category : configurartion.getCategoryNames() )
- {
- final ConfigCategory c = configurartion.getCategory( category );
- configurartion.removeCategory( c );
- }
- }
-
- // Create general category, if missing
- if( !configurartion.hasCategory( CONFIG_COMMON_KEY ) )
- {
- configurartion.getCategory( CONFIG_COMMON_KEY ).setComment( CONFIG_COMMON_COMMENT );
- }
-
- // Create whitelist, if missing
- if( !configurartion.hasCategory( CONFIG_FACADES_KEY ) )
- {
- final ConfigCategory category = configurartion.getCategory( CONFIG_FACADES_KEY );
- category.setComment( CONFIG_FACADES_COMMENT );
-
- // Whitelist some vanilla blocks like glass
- final ConfigCategory minecraft = new ConfigCategory( "minecraft", category );
- minecraft.put( "glass", new Property( "glass", "16", Type.INTEGER ) );
- minecraft.put( "stained_glass", new Property( "stained_glass", "16", Type.INTEGER ) );
-
- // Whitelist some AE2 blocks like quartz glass
- final ConfigCategory appliedenergistics = new ConfigCategory( "appliedenergistics2", category );
- appliedenergistics.put( "quartz_glass", new Property( "quartz_glass", "16", Type.INTEGER ) );
- appliedenergistics.put( "quartz_vibrant_glass", new Property( "quartz_vibrant_glass", "16", Type.INTEGER ) );
- }
-
- return configurartion;
- }
+// FIXME private static Configuration migrate( Configuration configurartion )
+// FIXME {
+// FIXME // Clear pre rv6 configs.
+// FIXME if( configurartion.getLoadedConfigVersion() == null )
+// FIXME {
+// FIXME for( String category : configurartion.getCategoryNames() )
+// FIXME {
+// FIXME final ConfigCategory c = configurartion.getCategory( category );
+// FIXME configurartion.removeCategory( c );
+// FIXME }
+// FIXME }
+// FIXME
+// FIXME // Create general category, if missing
+// FIXME if( !configurartion.hasCategory( CONFIG_COMMON_KEY ) )
+// FIXME {
+// FIXME configurartion.getCategory( CONFIG_COMMON_KEY ).setComment( CONFIG_COMMON_COMMENT );
+// FIXME }
+// FIXME
+// FIXME // Create whitelist, if missing
+// FIXME if( !configurartion.hasCategory( CONFIG_FACADES_KEY ) )
+// FIXME {
+// FIXME final ConfigCategory category = configurartion.getCategory( CONFIG_FACADES_KEY );
+// FIXME category.setComment( CONFIG_FACADES_COMMENT );
+// FIXME
+// FIXME // Whitelist some vanilla blocks like glass
+// FIXME final ConfigCategory minecraft = new ConfigCategory( "minecraft", category );
+// FIXME minecraft.put( "glass", new Property( "glass", "16", Type.INTEGER ) );
+// FIXME minecraft.put( "stained_glass", new Property( "stained_glass", "16", Type.INTEGER ) );
+// FIXME
+// FIXME // Whitelist some AE2 blocks like quartz glass
+// FIXME final ConfigCategory appliedenergistics = new ConfigCategory( "appliedenergistics2", category );
+// FIXME appliedenergistics.put( "quartz_glass", new Property( "quartz_glass", "16", Type.INTEGER ) );
+// FIXME appliedenergistics.put( "quartz_vibrant_glass", new Property( "quartz_vibrant_glass", "16", Type.INTEGER ) );
+// FIXME }
+// FIXME
+// FIXME return configurartion;
+// FIXME }
public static FacadeConfig instance()
{
diff --git a/src/main/java/appeng/core/api/definitions/ApiBlocks.java b/src/main/java/appeng/core/api/definitions/ApiBlocks.java
index 740dd166e..e85ba86a6 100644
--- a/src/main/java/appeng/core/api/definitions/ApiBlocks.java
+++ b/src/main/java/appeng/core/api/definitions/ApiBlocks.java
@@ -22,23 +22,28 @@ package appeng.core.api.definitions;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
+import appeng.block.crafting.*;
import appeng.block.grindstone.BlockCrank;
import appeng.block.grindstone.BlockGrinder;
-import appeng.block.misc.BlockQuartzFixture;
-import appeng.block.misc.BlockSkyCompass;
-import appeng.block.misc.SkyCompassRendering;
+import appeng.block.misc.*;
import appeng.block.spatial.BlockMatrixFrame;
import appeng.block.storage.BlockSkyChest;
import appeng.bootstrap.*;
import appeng.bootstrap.definitions.TileEntityDefinition;
+import appeng.client.render.crafting.CraftingCubeRendering;
import appeng.client.render.tesr.CrankTESR;
import appeng.client.render.tesr.SkyChestTESR;
import appeng.api.features.AEFeature;
import appeng.core.features.registries.PartModels;
import appeng.decorative.AEDecorativeBlock;
import appeng.decorative.solid.*;
+import appeng.tile.crafting.TileCraftingMonitorTile;
+import appeng.tile.crafting.TileCraftingStorageTile;
+import appeng.tile.crafting.TileCraftingTile;
+import appeng.tile.crafting.TileMolecularAssembler;
import appeng.tile.grindstone.TileCrank;
import appeng.tile.grindstone.TileGrinder;
+import appeng.tile.misc.TileInscriber;
import appeng.tile.misc.TileSkyCompass;
import appeng.tile.storage.TileSkyChest;
import net.minecraft.block.Block;
@@ -50,7 +55,7 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
-
+import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import static appeng.decorative.solid.BlockSkyStone.SkystoneType;
@@ -254,11 +259,12 @@ public final class ApiBlocks implements IBlocks
})
.build() )
.build();
-// this.inscriber = registry.block( "inscriber", BlockInscriber::new )
-// .features( AEFeature.INSCRIBER )
-// .tileEntity( registry.tileEntity("", TileInscriber.class, TileInscriber::new).build() )
-// .rendering( new InscriberRendering() )
-// .build();
+ this.inscriber = registry.block( "inscriber", () -> new BlockInscriber(Block.Properties.create(Material.IRON)) )
+ .features( AEFeature.INSCRIBER )
+ .tileEntity( registry.tileEntity("inscriber", TileInscriber.class, TileInscriber::new)
+ .rendering(new InscriberRendering())
+ .build() )
+ .build();
// this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new )
// .features( AEFeature.WIRELESS_ACCESS_TERMINAL )
// .tileEntity( registry.tileEntity("", TileWireless.class, TileWireless::new).build() )
@@ -299,12 +305,12 @@ public final class ApiBlocks implements IBlocks
// .build();
// this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new )
// .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
-// .tileEntity( new TileEntityDefinition( TileQuantumBridge.class, "quantum_ring" ) )
+// .tileEntity( registry.tileEntity( TileQuantumBridge.class, "quantum_ring" ) )
// .rendering( new QuantumBridgeRendering() )
// .build();
// this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new )
// .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
-// .tileEntity( new TileEntityDefinition( TileQuantumBridge.class, "quantum_ring" ) )
+// .tileEntity( registry.tileEntity( TileQuantumBridge.class, "quantum_ring" ) )
// .rendering( new QuantumBridgeRendering() )
// .build();
// this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new )
@@ -384,51 +390,74 @@ public final class ApiBlocks implements IBlocks
// .tileEntity( registry.tileEntity("", TileCreativeEnergyCell.class, TileCreativeEnergyCell::new).build() )
// .build();
//
-// FeatureFactory crafting = registry.features( AEFeature.CRAFTING_CPU );
-// this.craftingUnit = crafting.block( "crafting_unit", () -> new BlockCraftingUnit( CraftingUnitType.UNIT ) )
-// .rendering( new CraftingCubeRendering( "crafting_unit", CraftingUnitType.UNIT ) )
-// .tileEntity( new TileEntityDefinition( TileCraftingTile.class, "crafting_unit" ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingAccelerator = crafting.block( "crafting_accelerator", () -> new BlockCraftingUnit( CraftingUnitType.ACCELERATOR ) )
-// .rendering( new CraftingCubeRendering( "crafting_accelerator", CraftingUnitType.ACCELERATOR ) )
-// .tileEntity( new TileEntityDefinition( TileCraftingTile.class, "crafting_unit" ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingStorage1k = crafting.block( "crafting_storage_1k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_1K ) )
-// .item( ItemCraftingStorage::new )
-// .tileEntity( new TileEntityDefinition( TileCraftingStorageTile.class, "crafting_storage" ) )
-// .rendering( new CraftingCubeRendering( "crafting_storage_1k", CraftingUnitType.STORAGE_1K ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingStorage4k = crafting.block( "crafting_storage_4k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_4K ) )
-// .item( ItemCraftingStorage::new )
-// .tileEntity( new TileEntityDefinition( TileCraftingStorageTile.class, "crafting_storage" ) )
-// .rendering( new CraftingCubeRendering( "crafting_storage_4k", CraftingUnitType.STORAGE_4K ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingStorage16k = crafting.block( "crafting_storage_16k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_16K ) )
-// .item( ItemCraftingStorage::new )
-// .tileEntity( new TileEntityDefinition( TileCraftingStorageTile.class, "crafting_storage" ) )
-// .rendering( new CraftingCubeRendering( "crafting_storage_16k", CraftingUnitType.STORAGE_16K ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingStorage64k = crafting.block( "crafting_storage_64k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_64K ) )
-// .item( ItemCraftingStorage::new )
-// .tileEntity( new TileEntityDefinition( TileCraftingStorageTile.class, "crafting_storage" ) )
-// .rendering( new CraftingCubeRendering( "crafting_storage_64k", CraftingUnitType.STORAGE_64K ) )
-// .useCustomItemModel()
-// .build();
-// this.craftingMonitor = crafting.block( "crafting_monitor", BlockCraftingMonitor::new )
-// .tileEntity( registry.tileEntity("", TileCraftingMonitorTile.class, TileCraftingMonitorTile::new).build() )
-// .rendering( new CraftingCubeRendering( "crafting_monitor", CraftingUnitType.MONITOR ) )
-// .useCustomItemModel()
-// .build();
-//
-// this.molecularAssembler = registry.block( "molecular_assembler", BlockMolecularAssembler::new )
-// .features( AEFeature.MOLECULAR_ASSEMBLER )
-// .tileEntity( registry.tileEntity("", TileMolecularAssembler.class, TileMolecularAssembler::new).build() )
-// .build();
+
+ TileEntityDefinition craftingUnit = registry.tileEntity("crafting_unit", TileCraftingTile.class, TileCraftingTile::new)
+ .build();
+
+ FeatureFactory crafting = registry.features( AEFeature.CRAFTING_CPU );
+ Block.Properties craftingBlockProps = Block.Properties.create(Material.IRON);
+ this.craftingUnit = crafting.block( "crafting_unit", () -> new CraftingUnitBlock( craftingBlockProps, CraftingUnitType.UNIT ) )
+ .rendering( new CraftingCubeRendering( "crafting_unit", CraftingUnitType.UNIT ) )
+ .tileEntity( craftingUnit )
+ .build();
+ this.craftingAccelerator = crafting.block( "crafting_accelerator", () -> new CraftingUnitBlock( craftingBlockProps, CraftingUnitType.ACCELERATOR ) )
+ .rendering( new CraftingCubeRendering( "crafting_accelerator", CraftingUnitType.ACCELERATOR ) )
+ .tileEntity( craftingUnit )
+ .build();
+
+ TileEntityDefinition craftingStorage = registry.tileEntity("crafting_storage", TileCraftingStorageTile.class, TileCraftingStorageTile::new)
+ .build();
+ this.craftingStorage1k = crafting.block( "crafting_storage_1k", () -> new BlockCraftingStorage( craftingBlockProps, CraftingUnitType.STORAGE_1K ) )
+ .item( ItemCraftingStorage::new )
+ .tileEntity(craftingStorage)
+ .rendering( new CraftingCubeRendering( "crafting_storage_1k", CraftingUnitType.STORAGE_1K ) )
+ .build();
+ this.craftingStorage4k = crafting.block( "crafting_storage_4k", () -> new BlockCraftingStorage( craftingBlockProps, CraftingUnitType.STORAGE_4K ) )
+ .item( ItemCraftingStorage::new )
+ .tileEntity(craftingStorage)
+ .rendering( new CraftingCubeRendering( "crafting_storage_4k", CraftingUnitType.STORAGE_4K ) )
+ .build();
+ this.craftingStorage16k = crafting.block( "crafting_storage_16k", () -> new BlockCraftingStorage( craftingBlockProps, CraftingUnitType.STORAGE_16K ) )
+ .item( ItemCraftingStorage::new )
+ .tileEntity(craftingStorage)
+ .rendering( new CraftingCubeRendering( "crafting_storage_16k", CraftingUnitType.STORAGE_16K ) )
+ .build();
+ this.craftingStorage64k = crafting.block( "crafting_storage_64k", () -> new BlockCraftingStorage( craftingBlockProps, CraftingUnitType.STORAGE_64K ) )
+ .item( ItemCraftingStorage::new )
+ .tileEntity(craftingStorage)
+ .rendering( new CraftingCubeRendering( "crafting_storage_64k", CraftingUnitType.STORAGE_64K ) )
+ .build();
+ this.craftingMonitor = crafting.block( "crafting_monitor", () -> new BlockCraftingMonitor(craftingBlockProps) )
+ .tileEntity( registry.tileEntity("", TileCraftingMonitorTile.class, TileCraftingMonitorTile::new)
+ .rendering(new TileEntityRenderingCustomizer() {
+ @OnlyIn(Dist.CLIENT)
+ @Override
+ public void customize(TileEntityRendering rendering) {
+ // FIXME rendering.tileEntityRenderer(CraftingMonitorTESR::new);
+ }
+ })
+ .build() )
+ .rendering( new CraftingCubeRendering( "crafting_monitor", CraftingUnitType.MONITOR ) )
+ .build();
+
+ this.molecularAssembler = registry.block( "molecular_assembler", () -> new BlockMolecularAssembler(Block.Properties.create(Material.IRON).notSolid()) )
+ .features( AEFeature.MOLECULAR_ASSEMBLER )
+ .rendering(new BlockRenderingCustomizer() {
+ @OnlyIn(Dist.CLIENT)
+ @Override
+ public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
+ // FIXME: This is an old comment, check if it still applies
+ /**
+ * NOTE: This is only used to determine how to render an item being held in hand.
+ * For determining block rendering, the method below is used (canRenderInLayer).
+ */
+ rendering.renderType(RenderType.getCutout());
+ rendering.renderType(rt -> rt == RenderType.getCutout() || rt == RenderType.getTranslucent());
+ }
+ })
+ .tileEntity( registry.tileEntity("molecular_assembler", TileMolecularAssembler.class, TileMolecularAssembler::new).build() )
+ .build();
+
// this.lightDetector = registry.block( "light_detector", BlockLightDetector::new )
// .features( AEFeature.LIGHT_DETECTOR )
// .tileEntity( registry.tileEntity("", TileLightDetector.class, TileLightDetector::new).build() )
diff --git a/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java b/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java
index 490134b63..6c43ee7a3 100644
--- a/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java
+++ b/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java
@@ -25,17 +25,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import appeng.api.features.IMatterCannonAmmoRegistry;
-import appeng.recipes.ores.IOreListener;
-public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
+public class MatterCannonAmmoRegistry implements /* FIXME IOreListener, */ IMatterCannonAmmoRegistry
{
private final HashMap DamageModifiers = new HashMap<>();
public MatterCannonAmmoRegistry()
{
- OreDictionaryHandler.INSTANCE.observe( this );
+ // FIXME OreDictionaryHandler.INSTANCE.observe( this );
this.registerAmmo( new ItemStack( Items.GOLD_NUGGET ), 196.96655 );
}
@@ -58,86 +57,86 @@ public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmo
return 0;
}
- @Override
- public void oreRegistered( final String name, final ItemStack item )
- {
- if( !( name.startsWith( "berry" ) || name.startsWith( "nugget" ) ) )
- {
- return;
- }
-
- // addNugget( "Cobble", 18 ); // ?
- this.considerItem( name, item, "MeatRaw", 32 );
- this.considerItem( name, item, "MeatCooked", 32 );
- this.considerItem( name, item, "Meat", 32 );
- this.considerItem( name, item, "Chicken", 32 );
- this.considerItem( name, item, "Beef", 32 );
- this.considerItem( name, item, "Sheep", 32 );
- this.considerItem( name, item, "Fish", 32 );
-
- // real world...
- this.considerItem( name, item, "Lithium", 6.941 );
- this.considerItem( name, item, "Beryllium", 9.0122 );
- this.considerItem( name, item, "Boron", 10.811 );
- this.considerItem( name, item, "Carbon", 12.0107 );
- this.considerItem( name, item, "Coal", 12.0107 );
- this.considerItem( name, item, "Charcoal", 12.0107 );
- this.considerItem( name, item, "Sodium", 22.9897 );
- this.considerItem( name, item, "Magnesium", 24.305 );
- this.considerItem( name, item, "Aluminum", 26.9815 );
- this.considerItem( name, item, "SILICON", 28.0855 );
- this.considerItem( name, item, "Phosphorus", 30.9738 );
- this.considerItem( name, item, "Sulfur", 32.065 );
- this.considerItem( name, item, "Potassium", 39.0983 );
- this.considerItem( name, item, "Calcium", 40.078 );
- this.considerItem( name, item, "Scandium", 44.9559 );
- this.considerItem( name, item, "Titanium", 47.867 );
- this.considerItem( name, item, "Vanadium", 50.9415 );
- this.considerItem( name, item, "Manganese", 54.938 );
- this.considerItem( name, item, "Iron", 55.845 );
- this.considerItem( name, item, "Nickel", 58.6934 );
- this.considerItem( name, item, "Cobalt", 58.9332 );
- this.considerItem( name, item, "Copper", 63.546 );
- this.considerItem( name, item, "Zinc", 65.39 );
- this.considerItem( name, item, "Gallium", 69.723 );
- this.considerItem( name, item, "Germanium", 72.64 );
- this.considerItem( name, item, "Bromine", 79.904 );
- this.considerItem( name, item, "Krypton", 83.8 );
- this.considerItem( name, item, "Rubidium", 85.4678 );
- this.considerItem( name, item, "Strontium", 87.62 );
- this.considerItem( name, item, "Yttrium", 88.9059 );
- this.considerItem( name, item, "Zirconiumm", 91.224 );
- this.considerItem( name, item, "Niobiumm", 92.9064 );
- this.considerItem( name, item, "Technetium", 98 );
- this.considerItem( name, item, "Ruthenium", 101.07 );
- this.considerItem( name, item, "Rhodium", 102.9055 );
- this.considerItem( name, item, "Palladium", 106.42 );
- this.considerItem( name, item, "Silver", 107.8682 );
- this.considerItem( name, item, "Cadmium", 112.411 );
- this.considerItem( name, item, "Indium", 114.818 );
- this.considerItem( name, item, "Tin", 118.71 );
- this.considerItem( name, item, "Antimony", 121.76 );
- this.considerItem( name, item, "Iodine", 126.9045 );
- this.considerItem( name, item, "Tellurium", 127.6 );
- this.considerItem( name, item, "Xenon", 131.293 );
- this.considerItem( name, item, "Cesium", 132.9055 );
- this.considerItem( name, item, "Barium", 137.327 );
- this.considerItem( name, item, "Lanthanum", 138.9055 );
- this.considerItem( name, item, "Cerium", 140.116 );
- this.considerItem( name, item, "Tantalum", 180.9479 );
- this.considerItem( name, item, "Tungsten", 183.84 );
- this.considerItem( name, item, "Osmium", 190.23 );
- this.considerItem( name, item, "Iridium", 192.217 );
- this.considerItem( name, item, "Platinum", 195.078 );
- this.considerItem( name, item, "Lead", 207.2 );
- this.considerItem( name, item, "Bismuth", 208.9804 );
- this.considerItem( name, item, "Uranium", 238.0289 );
- this.considerItem( name, item, "Plutonium", 244 );
-
- // TE stuff...
- this.considerItem( name, item, "Invar", ( 58.6934 + 55.845 + 55.845 ) / 3.0 );
- this.considerItem( name, item, "Electrum", ( 107.8682 + 196.96655 ) / 2.0 );
- }
+// FIXME @Override
+// FIXME public void oreRegistered( final String name, final ItemStack item )
+// FIXME {
+// FIXME if( !( name.startsWith( "berry" ) || name.startsWith( "nugget" ) ) )
+// FIXME {
+// FIXME return;
+// FIXME }
+// FIXME
+// FIXME // addNugget( "Cobble", 18 ); // ?
+// FIXME this.considerItem( name, item, "MeatRaw", 32 );
+// FIXME this.considerItem( name, item, "MeatCooked", 32 );
+// FIXME this.considerItem( name, item, "Meat", 32 );
+// FIXME this.considerItem( name, item, "Chicken", 32 );
+// FIXME this.considerItem( name, item, "Beef", 32 );
+// FIXME this.considerItem( name, item, "Sheep", 32 );
+// FIXME this.considerItem( name, item, "Fish", 32 );
+// FIXME
+// FIXME // real world...
+// FIXME this.considerItem( name, item, "Lithium", 6.941 );
+// FIXME this.considerItem( name, item, "Beryllium", 9.0122 );
+// FIXME this.considerItem( name, item, "Boron", 10.811 );
+// FIXME this.considerItem( name, item, "Carbon", 12.0107 );
+// FIXME this.considerItem( name, item, "Coal", 12.0107 );
+// FIXME this.considerItem( name, item, "Charcoal", 12.0107 );
+// FIXME this.considerItem( name, item, "Sodium", 22.9897 );
+// FIXME this.considerItem( name, item, "Magnesium", 24.305 );
+// FIXME this.considerItem( name, item, "Aluminum", 26.9815 );
+// FIXME this.considerItem( name, item, "SILICON", 28.0855 );
+// FIXME this.considerItem( name, item, "Phosphorus", 30.9738 );
+// FIXME this.considerItem( name, item, "Sulfur", 32.065 );
+// FIXME this.considerItem( name, item, "Potassium", 39.0983 );
+// FIXME this.considerItem( name, item, "Calcium", 40.078 );
+// FIXME this.considerItem( name, item, "Scandium", 44.9559 );
+// FIXME this.considerItem( name, item, "Titanium", 47.867 );
+// FIXME this.considerItem( name, item, "Vanadium", 50.9415 );
+// FIXME this.considerItem( name, item, "Manganese", 54.938 );
+// FIXME this.considerItem( name, item, "Iron", 55.845 );
+// FIXME this.considerItem( name, item, "Nickel", 58.6934 );
+// FIXME this.considerItem( name, item, "Cobalt", 58.9332 );
+// FIXME this.considerItem( name, item, "Copper", 63.546 );
+// FIXME this.considerItem( name, item, "Zinc", 65.39 );
+// FIXME this.considerItem( name, item, "Gallium", 69.723 );
+// FIXME this.considerItem( name, item, "Germanium", 72.64 );
+// FIXME this.considerItem( name, item, "Bromine", 79.904 );
+// FIXME this.considerItem( name, item, "Krypton", 83.8 );
+// FIXME this.considerItem( name, item, "Rubidium", 85.4678 );
+// FIXME this.considerItem( name, item, "Strontium", 87.62 );
+// FIXME this.considerItem( name, item, "Yttrium", 88.9059 );
+// FIXME this.considerItem( name, item, "Zirconiumm", 91.224 );
+// FIXME this.considerItem( name, item, "Niobiumm", 92.9064 );
+// FIXME this.considerItem( name, item, "Technetium", 98 );
+// FIXME this.considerItem( name, item, "Ruthenium", 101.07 );
+// FIXME this.considerItem( name, item, "Rhodium", 102.9055 );
+// FIXME this.considerItem( name, item, "Palladium", 106.42 );
+// FIXME this.considerItem( name, item, "Silver", 107.8682 );
+// FIXME this.considerItem( name, item, "Cadmium", 112.411 );
+// FIXME this.considerItem( name, item, "Indium", 114.818 );
+// FIXME this.considerItem( name, item, "Tin", 118.71 );
+// FIXME this.considerItem( name, item, "Antimony", 121.76 );
+// FIXME this.considerItem( name, item, "Iodine", 126.9045 );
+// FIXME this.considerItem( name, item, "Tellurium", 127.6 );
+// FIXME this.considerItem( name, item, "Xenon", 131.293 );
+// FIXME this.considerItem( name, item, "Cesium", 132.9055 );
+// FIXME this.considerItem( name, item, "Barium", 137.327 );
+// FIXME this.considerItem( name, item, "Lanthanum", 138.9055 );
+// FIXME this.considerItem( name, item, "Cerium", 140.116 );
+// FIXME this.considerItem( name, item, "Tantalum", 180.9479 );
+// FIXME this.considerItem( name, item, "Tungsten", 183.84 );
+// FIXME this.considerItem( name, item, "Osmium", 190.23 );
+// FIXME this.considerItem( name, item, "Iridium", 192.217 );
+// FIXME this.considerItem( name, item, "Platinum", 195.078 );
+// FIXME this.considerItem( name, item, "Lead", 207.2 );
+// FIXME this.considerItem( name, item, "Bismuth", 208.9804 );
+// FIXME this.considerItem( name, item, "Uranium", 238.0289 );
+// FIXME this.considerItem( name, item, "Plutonium", 244 );
+// FIXME
+// FIXME // TE stuff...
+// FIXME this.considerItem( name, item, "Invar", ( 58.6934 + 55.845 + 55.845 ) / 3.0 );
+// FIXME this.considerItem( name, item, "Electrum", ( 107.8682 + 196.96655 ) / 2.0 );
+// FIXME }
private void considerItem( final String ore, final ItemStack item, final String name, final double weight )
{
diff --git a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java
index 78bbcc925..a41e058cb 100644
--- a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java
+++ b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java
@@ -77,22 +77,22 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( blocks.energyCell(), TunnelType.FE_POWER );
this.addNewAttunement( blocks.energyCellCreative(), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 0 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 1 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 2 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 3 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 4 ), TunnelType.FE_POWER );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_0", 5 ), TunnelType.FE_POWER );
/**
* EU tunnel items
*/
- this.addNewAttunement( this.getModItem( "ic2", "cable", 0 ), TunnelType.IC2_POWER ); // Copper cable
- this.addNewAttunement( this.getModItem( "ic2", "cable", 1 ), TunnelType.IC2_POWER ); // Glass fibre cable
- this.addNewAttunement( this.getModItem( "ic2", "cable", 2 ), TunnelType.IC2_POWER ); // Gold cable
- this.addNewAttunement( this.getModItem( "ic2", "cable", 3 ), TunnelType.IC2_POWER ); // HV cable
- this.addNewAttunement( this.getModItem( "ic2", "cable", 4 ), TunnelType.IC2_POWER ); // Tin cable
+// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 0 ), TunnelType.IC2_POWER ); // Copper cable
+// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 1 ), TunnelType.IC2_POWER ); // Glass fibre cable
+// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 2 ), TunnelType.IC2_POWER ); // Gold cable
+// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 3 ), TunnelType.IC2_POWER ); // HV cable
+// FIXME this.addNewAttunement( this.getModItem( "ic2", "cable", 4 ), TunnelType.IC2_POWER ); // Tin cable
/**
* attune based on most redstone base items.
@@ -119,15 +119,15 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Blocks.HOPPER ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.CHEST ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.TRAPPED_CHEST ), TunnelType.ITEM );
- this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
- this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct
- // (opaque)
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 2 ), TunnelType.ITEM ); // impulse
- // itemduct
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 3 ), TunnelType.ITEM ); // impulse
- // itemduct
+// FIXME this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
+// FIXME this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct
+// FIXME // (opaque)
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 2 ), TunnelType.ITEM ); // impulse
+// FIXME // itemduct
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 3 ), TunnelType.ITEM ); // impulse
+// FIXME // itemduct
// (opaque)
/**
@@ -137,18 +137,18 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Items.LAVA_BUCKET ), TunnelType.FLUID );
this.addNewAttunement( new ItemStack( Items.MILK_BUCKET ), TunnelType.FLUID );
this.addNewAttunement( new ItemStack( Items.WATER_BUCKET ), TunnelType.FLUID );
- this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
- this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
- this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct
- // (opaque)
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 2 ), TunnelType.FLUID ); // fluiduct
- // hardened
- this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 3 ), TunnelType.FLUID ); // fluiduct
- // hardened
- // (opaque)
-
+// FIXME this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
+// FIXME this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
+// FIXME this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct
+// FIXME // (opaque)
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 2 ), TunnelType.FLUID ); // fluiduct
+// FIXME // hardened
+// FIXME this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 3 ), TunnelType.FLUID ); // fluiduct
+// FIXME // hardened
+// FIXME // (opaque)
+// FIXME
for( final AEColor c : AEColor.values() )
{
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
diff --git a/src/main/java/appeng/core/features/registries/WirelessRegistry.java b/src/main/java/appeng/core/features/registries/WirelessRegistry.java
index 80ebc2951..8e7b0344c 100644
--- a/src/main/java/appeng/core/features/registries/WirelessRegistry.java
+++ b/src/main/java/appeng/core/features/registries/WirelessRegistry.java
@@ -32,7 +32,7 @@ import appeng.api.features.IWirelessTermHandler;
import appeng.api.features.IWirelessTermRegistry;
import appeng.core.Api;
import appeng.core.localization.PlayerMessages;
-import appeng.core.sync.GuiBridge;
+
import appeng.util.Platform;
@@ -112,7 +112,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry
if( handler.hasPower( player, 0.5, item ) )
{
- Platform.openGUI( player, null, null, GuiBridge.GUI_WIRELESS_TERM );
+ // FIXME Platform.openGUI( player, null, null, GuiBridge.GUI_WIRELESS_TERM );
}
else
{
diff --git a/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java b/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java
index a905b26d5..1541dead9 100644
--- a/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java
+++ b/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java
@@ -16,7 +16,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AEPartLocation;
import appeng.core.Api;
-import appeng.core.sync.GuiBridge;
+
import appeng.util.Platform;
@@ -31,6 +31,6 @@ public class BasicItemCellGuiHandler implements ICellGuiHandler
@Override
public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
{
- Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
+ // FIXME Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME );
}
}
diff --git a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java
index e74222e90..d69d55fda 100644
--- a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java
+++ b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java
@@ -41,11 +41,10 @@ import appeng.api.features.IInscriberRecipe;
import appeng.api.features.IInscriberRecipeBuilder;
import appeng.core.AEConfig;
import appeng.core.AELog;
-import appeng.recipes.ores.IOreListener;
import appeng.util.Platform;
-public final class GrinderRecipeManager implements IGrinderRegistry, IOreListener
+public final class GrinderRecipeManager implements IGrinderRegistry // FIXME, IOreListener
{
private final Map recipes;
private final Map ores;
@@ -84,7 +83,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
this.addIngot( "Wheat", new ItemStack( Items.WHEAT ) );
- OreDictionaryHandler.INSTANCE.observe( this );
+ // FIXME OreDictionaryHandler.INSTANCE.observe( this );
}
@Override
@@ -162,29 +161,29 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
return this.dustToOreRatio.remove( oredictName ) != null;
}
- @Override
- public void oreRegistered( final String name, final ItemStack item )
- {
- if( !AEConfig.instance().getGrinderBlackList().contains( name ) && ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name
- .startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) ) )
- {
- for( final String ore : AEConfig.instance().getGrinderOres() )
- {
- if( name.equals( "ore" + ore ) )
- {
- this.addOre( ore, item );
- }
- else if( name.equals( "crystal" + ore ) || name.equals( "ingot" + ore ) || name.equals( "gem" + ore ) )
- {
- this.addIngot( ore, item );
- }
- else if( name.equals( "dust" + ore ) )
- {
- this.addDust( ore, item );
- }
- }
- }
- }
+// FIXME @Override
+// FIXME public void oreRegistered( final String name, final ItemStack item )
+// FIXME {
+// FIXME if( !AEConfig.instance().getGrinderBlackList().contains( name ) && ( name.startsWith( "ore" ) || name.startsWith( "crystal" ) || name
+// FIXME .startsWith( "gem" ) || name.startsWith( "ingot" ) || name.startsWith( "dust" ) ) )
+// FIXME {
+// FIXME for( final String ore : AEConfig.instance().getGrinderOres() )
+// FIXME {
+// FIXME if( name.equals( "ore" + ore ) )
+// FIXME {
+// FIXME this.addOre( ore, item );
+// FIXME }
+// FIXME else if( name.equals( "crystal" + ore ) || name.equals( "ingot" + ore ) || name.equals( "gem" + ore ) )
+// FIXME {
+// FIXME this.addIngot( ore, item );
+// FIXME }
+// FIXME else if( name.equals( "dust" + ore ) )
+// FIXME {
+// FIXME this.addDust( ore, item );
+// FIXME }
+// FIXME }
+// FIXME }
+// FIXME }
private boolean injectRecipe( final IGrinderRecipe grinderRecipe )
{
diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java
index 2fd8674a2..2a49624db 100644
--- a/src/main/java/appeng/core/localization/GuiText.java
+++ b/src/main/java/appeng/core/localization/GuiText.java
@@ -20,6 +20,8 @@ package appeng.core.localization;
import net.minecraft.client.resources.I18n;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
public enum GuiText
@@ -220,4 +222,8 @@ public enum GuiText
return this.root + '.' + this.toString();
}
+ public ITextComponent textComponent() {
+ return new TranslationTextComponent(getTranslationKey());
+ }
+
}
diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java
index d05b237de..4c38969b2 100644
--- a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java
+++ b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java
@@ -19,6 +19,7 @@
package appeng.core.sync.packets;
+import appeng.hooks.CompassResult;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.PlayerEntity;
@@ -26,8 +27,6 @@ import net.minecraft.network.PacketBuffer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
-import appeng.hooks.CompassManager;
-import appeng.hooks.CompassResult;
public class PacketCompassResponse extends AppEngPacket
diff --git a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java
index 516c5587f..de20fc74e 100644
--- a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java
+++ b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java
@@ -37,9 +37,7 @@ import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
-import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.INetworkInfo;
-import appeng.util.Platform;
public class PacketCraftRequest extends AppEngPacket
@@ -102,7 +100,7 @@ public class PacketCraftRequest extends AppEngPacket
if( context != null )
{
final TileEntity te = context.getTile();
- Platform.openGUI( player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM );
+ // FIXME Platform.openGUI( player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM );
if( player.openContainer instanceof ContainerCraftConfirm )
{
diff --git a/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java b/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java
index 9b38e3cce..f8db15d43 100644
--- a/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java
+++ b/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java
@@ -44,7 +44,6 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
-import appeng.fluids.client.gui.GuiFluidTerminal;
import appeng.fluids.util.AEFluidStack;
@@ -156,10 +155,10 @@ public class PacketMEFluidInventoryUpdate extends AppEngPacket
{
final Screen gs = Minecraft.getInstance().currentScreen;
- if( gs instanceof GuiFluidTerminal )
- {
- ( (GuiFluidTerminal) gs ).postUpdate( this.list );
- }
+ // FIXME if( gs instanceof GuiFluidTerminal )
+ // FIXME {
+ // FIXME ( (GuiFluidTerminal) gs ).postUpdate( this.list );
+ // FIXME }
}
@Nullable
diff --git a/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java b/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java
index 4378c5fad..60c5c6cfe 100644
--- a/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java
+++ b/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java
@@ -41,10 +41,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkDirection;
import appeng.api.storage.data.IAEItemStack;
-import appeng.client.gui.implementations.GuiCraftConfirm;
-import appeng.client.gui.implementations.GuiCraftingCPU;
-import appeng.client.gui.implementations.GuiMEMonitorable;
-import appeng.client.gui.implementations.GuiNetworkStatus;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
@@ -153,25 +149,25 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
final Screen gs = Minecraft.getInstance().currentScreen;
- if( gs instanceof GuiCraftConfirm )
- {
- ( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
- }
-
- if( gs instanceof GuiCraftingCPU )
- {
- ( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
- }
-
- if( gs instanceof GuiMEMonitorable )
- {
- ( (GuiMEMonitorable) gs ).postUpdate( this.list );
- }
-
- if( gs instanceof GuiNetworkStatus )
- {
- ( (GuiNetworkStatus) gs ).postUpdate( this.list );
- }
+// FIXME if( gs instanceof GuiCraftConfirm )
+// FIXME {
+// FIXME ( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
+// FIXME }
+// FIXME
+// FIXME if( gs instanceof GuiCraftingCPU )
+// FIXME {
+// FIXME ( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
+// FIXME }
+// FIXME
+// FIXME if( gs instanceof GuiMEMonitorable )
+// FIXME {
+// FIXME ( (GuiMEMonitorable) gs ).postUpdate( this.list );
+// FIXME }
+// FIXME
+// FIXME if( gs instanceof GuiNetworkStatus )
+// FIXME {
+// FIXME ( (GuiNetworkStatus) gs ).postUpdate( this.list );
+// FIXME }
}
@Nullable
diff --git a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java
index 5c9c0600b..178d7fdf2 100644
--- a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java
+++ b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java
@@ -23,14 +23,11 @@ import io.netty.buffer.Unpooled;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.Items;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-import appeng.client.render.effects.MatterCannonFX;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
@@ -95,9 +92,9 @@ public class PacketMatterCannon extends AppEngPacket
final World world = Minecraft.getInstance().world;
for( int a = 1; a < this.len; a++ )
{
- final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, new ItemStack( Items.DIAMOND ) );
+ // FIXME final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, new ItemStack( Items.DIAMOND ) );
- Minecraft.getInstance().particles.addEffect( fx );
+ // FIXME Minecraft.getInstance().particles.addEffect( fx );
}
}
catch( final Exception ignored )
diff --git a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java
index d440f4c5b..af2527315 100644
--- a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java
+++ b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java
@@ -29,7 +29,7 @@ import net.minecraft.tileentity.TileEntity;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.core.sync.AppEngPacket;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.INetworkInfo;
import appeng.util.Platform;
diff --git a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java
index 0350ba50c..64f51c9ac 100644
--- a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java
+++ b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java
@@ -26,6 +26,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SimpleSound;
import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.SoundCategory;
@@ -94,7 +95,7 @@ public class PacketTransitionEffect extends AppEngPacket
final EnergyFx fx = new EnergyFx( world, this.x + ( this.mode ? ( Platform
.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.y + ( this.mode ? ( Platform
.getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), this.z + ( this.mode ? ( Platform
- .getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), Items.DIAMOND );
+ .getRandomInt() % 100 ) * 0.01 : ( Platform.getRandomInt() % 100 ) * 0.005 - 0.25 ), new ItemStack(Items.DIAMOND, 1) );
if( !this.mode )
{
diff --git a/src/main/java/appeng/debug/TileChunkLoader.java b/src/main/java/appeng/debug/TileChunkLoader.java
index c90a221bc..42fb72970 100644
--- a/src/main/java/appeng/debug/TileChunkLoader.java
+++ b/src/main/java/appeng/debug/TileChunkLoader.java
@@ -25,7 +25,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.ChunkPos;
-import net.minecraft.util.text.TextComponentString;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
@@ -70,7 +70,7 @@ public class TileChunkLoader extends AEBaseTile implements ITickableTileEntity
final List pl = server.getPlayerList().getPlayers();
for( final ServerPlayerEntity p : pl )
{
- p.sendMessage( new TextComponentString( "Can't chunk load.." ) );
+ p.sendMessage( new StringTextComponent( "Can't chunk load.." ) );
}
}
return;
diff --git a/src/main/java/appeng/debug/TileEnergyGenerator.java b/src/main/java/appeng/debug/TileEnergyGenerator.java
index 2868fa125..5d9d20bda 100644
--- a/src/main/java/appeng/debug/TileEnergyGenerator.java
+++ b/src/main/java/appeng/debug/TileEnergyGenerator.java
@@ -29,6 +29,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
@@ -80,23 +81,14 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickableTileEnti
}
}
- @Override
- public boolean hasCapability( Capability> capability, @Nullable Direction facing )
- {
- if( capability == CapabilityEnergy.ENERGY )
- {
- return true;
- }
- return super.hasCapability( capability, facing );
- }
-
+ @SuppressWarnings("unchecked")
@Override
@Nullable
- public T getCapability( Capability capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
if( capability == CapabilityEnergy.ENERGY )
{
- return (T) this;
+ return (LazyOptional) LazyOptional.of(() ->this);
}
return super.getCapability( capability, facing );
}
diff --git a/src/main/java/appeng/debug/TileItemGen.java b/src/main/java/appeng/debug/TileItemGen.java
index 915704b6e..9fa0a67a6 100644
--- a/src/main/java/appeng/debug/TileItemGen.java
+++ b/src/main/java/appeng/debug/TileItemGen.java
@@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -71,23 +72,14 @@ public class TileItemGen extends AEBaseTile
}
}
- @Override
- public boolean hasCapability( Capability> capability, @Nullable Direction facing )
- {
- if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability )
- {
- return true;
- }
- return super.hasCapability( capability, facing );
- }
-
+ @SuppressWarnings("unchecked")
@Override
@Nullable
- public T getCapability( Capability capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability )
{
- return (T) this.handler;
+ return (LazyOptional) LazyOptional.of(() ->this.handler);
}
return super.getCapability( capability, facing );
}
diff --git a/src/main/java/appeng/debug/ToolDebugCard.java b/src/main/java/appeng/debug/ToolDebugCard.java
index 8828697de..1f116412c 100644
--- a/src/main/java/appeng/debug/ToolDebugCard.java
+++ b/src/main/java/appeng/debug/ToolDebugCard.java
@@ -25,11 +25,11 @@ import java.util.Set;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.text.TextComponentString;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import appeng.api.networking.IGridConnection;
@@ -56,11 +56,11 @@ import appeng.util.Platform;
public class ToolDebugCard extends AEBaseItem
{
@Override
- public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
+ public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
{
if( Platform.isClient() )
{
- return EnumActionResult.PASS;
+ return ActionResultType.PASS;
}
if( player.isCrouching() )
@@ -202,12 +202,12 @@ public class ToolDebugCard extends AEBaseItem
}
}
}
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
private void outputMsg( final ICommandSender player, final String string )
{
- player.sendMessage( new TextComponentString( string ) );
+ player.sendMessage( new StringTextComponent( string ) );
}
private String timeMeasurement( final long nanos )
diff --git a/src/main/java/appeng/debug/ToolEraser.java b/src/main/java/appeng/debug/ToolEraser.java
index 6ed6d0fc7..a033dbf2d 100644
--- a/src/main/java/appeng/debug/ToolEraser.java
+++ b/src/main/java/appeng/debug/ToolEraser.java
@@ -24,7 +24,7 @@ import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -41,11 +41,11 @@ public class ToolEraser extends AEBaseItem
private static final int BLOCK_ERASE_LIMIT = 90000;
@Override
- public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
+ public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
{
if( Platform.isClient() )
{
- return EnumActionResult.PASS;
+ return ActionResultType.PASS;
}
final BlockState state = world.getBlockState( pos );
@@ -80,6 +80,6 @@ public class ToolEraser extends AEBaseItem
AELog.info( "Delete " + blocks + " blocks" );
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
}
diff --git a/src/main/java/appeng/debug/ToolMeteoritePlacer.java b/src/main/java/appeng/debug/ToolMeteoritePlacer.java
index a6a593211..cd3e3da20 100644
--- a/src/main/java/appeng/debug/ToolMeteoritePlacer.java
+++ b/src/main/java/appeng/debug/ToolMeteoritePlacer.java
@@ -20,11 +20,11 @@ package appeng.debug;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.text.TextComponentString;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import appeng.items.AEBaseItem;
@@ -36,11 +36,11 @@ import appeng.worldgen.meteorite.StandardWorld;
public class ToolMeteoritePlacer extends AEBaseItem
{
@Override
- public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
+ public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
{
if( Platform.isClient() )
{
- return EnumActionResult.PASS;
+ return ActionResultType.PASS;
}
final MeteoritePlacer mp = new MeteoritePlacer();
@@ -48,9 +48,9 @@ public class ToolMeteoritePlacer extends AEBaseItem
if( !worked )
{
- player.sendMessage( new TextComponentString( "Un-suitable Location." ) );
+ player.sendMessage( new StringTextComponent( "Un-suitable Location." ) );
}
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
}
diff --git a/src/main/java/appeng/debug/ToolReplicatorCard.java b/src/main/java/appeng/debug/ToolReplicatorCard.java
index 1d4ebe344..3741de2c7 100644
--- a/src/main/java/appeng/debug/ToolReplicatorCard.java
+++ b/src/main/java/appeng/debug/ToolReplicatorCard.java
@@ -25,11 +25,11 @@ import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.text.TextComponentString;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
@@ -46,11 +46,11 @@ import appeng.util.Platform;
public class ToolReplicatorCard extends AEBaseItem
{
@Override
- public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
+ public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
{
if( Platform.isClient() )
{
- return EnumActionResult.PASS;
+ return ActionResultType.PASS;
}
int x = pos.getX();
@@ -62,11 +62,11 @@ public class ToolReplicatorCard extends AEBaseItem
if( world.getTileEntity( pos ) instanceof IGridHost )
{
final CompoundNBT tag = new CompoundNBT();
- tag.setInteger( "x", x );
- tag.setInteger( "y", y );
- tag.setInteger( "z", z );
- tag.setInteger( "side", side.ordinal() );
- tag.setInteger( "dimid", world.provider.getDimension() );
+ tag.putInt( "x", x );
+ tag.putInt( "y", y );
+ tag.putInt( "z", z );
+ tag.putInt( "side", side.ordinal() );
+ tag.putInt( "dimid", world.provider.getDimension() );
player.getHeldItem( hand ).setTagCompound( tag );
}
else
@@ -79,11 +79,11 @@ public class ToolReplicatorCard extends AEBaseItem
final CompoundNBT ish = player.getHeldItem( hand ).getTag();
if( ish != null )
{
- final int src_x = ish.getInteger( "x" );
- final int src_y = ish.getInteger( "y" );
- final int src_z = ish.getInteger( "z" );
- final int src_side = ish.getInteger( "side" );
- final int dimid = ish.getInteger( "dimid" );
+ final int src_x = ish.getInt( "x" );
+ final int src_y = ish.getInt( "y" );
+ final int src_z = ish.getInt( "z" );
+ final int src_side = ish.getInt( "side" );
+ final int dimid = ish.getInt( "dimid" );
final World src_w = DimensionManager.getWorld( dimid );
final TileEntity te = src_w.getTileEntity( new BlockPos( src_x, src_y, src_z ) );
@@ -172,11 +172,11 @@ public class ToolReplicatorCard extends AEBaseItem
this.outputMsg( player, "No Source Defined" );
}
}
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
private void outputMsg( final ICommandSender player, final String string )
{
- player.sendMessage( new TextComponentString( string ) );
+ player.sendMessage( new StringTextComponent( string ) );
}
}
diff --git a/src/main/java/appeng/facade/FacadePart.java b/src/main/java/appeng/facade/FacadePart.java
index 30611b5b0..643afd66e 100644
--- a/src/main/java/appeng/facade/FacadePart.java
+++ b/src/main/java/appeng/facade/FacadePart.java
@@ -109,7 +109,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
return true;
}
- return this.getBlockState().isOpaqueCube();
+ return false; // FIXME this.getBlockState().isOpaqueCube();
}
@Override
diff --git a/src/main/java/appeng/fluids/block/BlockFluidInterface.java b/src/main/java/appeng/fluids/block/BlockFluidInterface.java
index a19d50bd6..cbc9b0eb8 100644
--- a/src/main/java/appeng/fluids/block/BlockFluidInterface.java
+++ b/src/main/java/appeng/fluids/block/BlockFluidInterface.java
@@ -31,18 +31,17 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
-import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
-import appeng.core.sync.GuiBridge;
+
import appeng.fluids.tile.TileFluidInterface;
import appeng.util.Platform;
-public class BlockFluidInterface extends AEBaseTileBlock
+public class BlockFluidInterface extends AEBaseTileBlock
{
public BlockFluidInterface()
{
- super( Material.IRON );
+ super(Properties.create( Material.IRON ));
}
@Override
@@ -54,11 +53,11 @@ public class BlockFluidInterface extends AEBaseTileBlock
}
final TileEntity tg = this.getTileEntity( w, pos );
- if( tg instanceof TileFluidInterface )
+ if( tg != null )
{
if( Platform.isServer() )
{
- Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_FLUID_INTERFACE );
+ // FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_FLUID_INTERFACE );
}
return ActionResultType.SUCCESS;
}
diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java b/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java
index 5514bef65..088c4d7f4 100644
--- a/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java
+++ b/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java
@@ -10,7 +10,7 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java b/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java
index 4cade6127..1e06726e2 100644
--- a/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java
+++ b/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java
@@ -27,7 +27,7 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java b/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java
index 879179882..b0c04aef7 100644
--- a/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java
+++ b/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java
@@ -36,7 +36,7 @@ import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java b/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java
index 9d00890e4..13fac3594 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java
@@ -6,6 +6,7 @@ import java.util.Collections;
import java.util.Map;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional;
@@ -26,9 +27,9 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
{
private FluidSyncHelper sync = null;
- public ContainerFluidConfigurable( PlayerInventory ip, IUpgradeableHost te )
+ public ContainerFluidConfigurable(ContainerType> containerType, int id, PlayerInventory ip, IUpgradeableHost te )
{
- super( ip, te );
+ super( containerType, id, ip, te );
}
public abstract IAEFluidTank getFluidConfigInventory();
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java b/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java
index 821ba5187..bf284dfa9 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java
@@ -3,6 +3,7 @@ package appeng.fluids.container;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.SecurityPermissions;
@@ -17,9 +18,9 @@ public class ContainerFluidFormationPlane extends ContainerFluidConfigurable
{
private final PartFluidFormationPlane plane;
- public ContainerFluidFormationPlane( final PlayerInventory ip, final PartFluidFormationPlane te )
+ public ContainerFluidFormationPlane(ContainerType> containerType, int id, final PlayerInventory ip, final PartFluidFormationPlane te )
{
- super( ip, te );
+ super( containerType, id,ip, te );
this.plane = te;
}
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidIO.java b/src/main/java/appeng/fluids/container/ContainerFluidIO.java
index db9023b32..94326f135 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidIO.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidIO.java
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.fluids.parts.PartSharedFluidBus;
import appeng.fluids.util.IAEFluidTank;
+import net.minecraft.inventory.container.ContainerType;
/**
@@ -34,9 +35,9 @@ public class ContainerFluidIO extends ContainerFluidConfigurable
{
private final PartSharedFluidBus bus;
- public ContainerFluidIO( PlayerInventory ip, PartSharedFluidBus te )
+ public ContainerFluidIO(ContainerType> containerType, int id, PlayerInventory ip, PartSharedFluidBus te )
{
- super( ip, te );
+ super( containerType, id,ip, te );
this.bus = te;
}
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidInterface.java b/src/main/java/appeng/fluids/container/ContainerFluidInterface.java
index da704e0b3..515c5cb0d 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidInterface.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidInterface.java
@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.Map;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import appeng.api.config.SecurityPermissions;
@@ -40,9 +41,9 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable
private final DualityFluidInterface myDuality;
private final FluidSyncHelper tankSync;
- public ContainerFluidInterface( final PlayerInventory ip, final IFluidInterfaceHost te )
+ public ContainerFluidInterface(ContainerType> containerType, int id, final PlayerInventory ip, final IFluidInterfaceHost te )
{
- super( ip, te.getDualityFluidInterface().getHost() );
+ super( containerType, id,ip, te.getDualityFluidInterface().getHost() );
this.myDuality = te.getDualityFluidInterface();
this.tankSync = new FluidSyncHelper( this.myDuality.getTanks(), DualityFluidInterface.NUMBER_OF_TANKS );
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java b/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java
index b4e64450e..91277b757 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java
@@ -4,6 +4,7 @@ package appeng.fluids.container;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -25,9 +26,9 @@ public class ContainerFluidLevelEmitter extends ContainerFluidConfigurable
@GuiSync( 3 )
public long EmitterValue = -1;
- public ContainerFluidLevelEmitter( final PlayerInventory ip, final PartFluidLevelEmitter te )
+ public ContainerFluidLevelEmitter(ContainerType> containerType, int id, final PlayerInventory ip, final PartFluidLevelEmitter te )
{
- super( ip, te );
+ super( containerType, id,ip, te );
this.lvlEmitter = te;
}
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java b/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java
index 2da1e9399..7ec345f37 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java
@@ -22,6 +22,7 @@ package appeng.fluids.container;
import java.util.Iterator;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.AccessRestriction;
@@ -59,9 +60,9 @@ public class ContainerFluidStorageBus extends ContainerFluidConfigurable
@GuiSync( 4 )
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
- public ContainerFluidStorageBus( PlayerInventory ip, PartFluidStorageBus te )
+ public ContainerFluidStorageBus(ContainerType> containerType, int id, PlayerInventory ip, PartFluidStorageBus te )
{
- super( ip, te );
+ super( containerType, id,ip, te );
this.storageBus = te;
}
diff --git a/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java b/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java
index c948f1029..0bc6e2624 100644
--- a/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java
+++ b/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java
@@ -26,6 +26,7 @@ import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional;
@@ -92,9 +93,8 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
// Holds the fluid the client wishes to extract, or null for insert
private IAEFluidStack clientRequestedTargetFluid = null;
- public ContainerFluidTerminal( PlayerInventory ip, ITerminalHost terminal )
- {
- super( ip, terminal );
+ public ContainerFluidTerminal(ContainerType> containerType, int id, PlayerInventory ip, ITerminalHost terminal) {
+ super(containerType, id, ip, terminal);
this.terminal = terminal;
this.clientCM = new ConfigManager( this );
diff --git a/src/main/java/appeng/fluids/helper/DualityFluidInterface.java b/src/main/java/appeng/fluids/helper/DualityFluidInterface.java
index 8dd65c3d2..006d98d6e 100644
--- a/src/main/java/appeng/fluids/helper/DualityFluidInterface.java
+++ b/src/main/java/appeng/fluids/helper/DualityFluidInterface.java
@@ -26,9 +26,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraft.fluid.Fluid;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
+import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
@@ -231,21 +233,16 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
return new DimensionalCoord( this.iHost.getTileEntity() );
}
- public boolean hasCapability( Capability> capabilityClass, Direction facing )
- {
- return capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR;
- }
-
@SuppressWarnings( "unchecked" )
- public T getCapability( Capability capabilityClass, Direction facing )
+ public LazyOptional getCapability( Capability capabilityClass, Direction facing )
{
if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
- return (T) this.tanks;
+ return (LazyOptional) LazyOptional.of(() -> this.tanks);
}
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
{
- return (T) this.accessor;
+ return (LazyOptional) LazyOptional.of(() -> this.accessor);
}
return null;
}
diff --git a/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java b/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java
index 8451fd2d5..17a06f077 100644
--- a/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java
+++ b/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java
@@ -45,9 +45,9 @@ public final class BasicFluidStorageCell extends AbstractStorageCell capabilityClass )
- {
- return this.duality.hasCapability( capabilityClass, this.getSide().getFacing() );
- }
-
- @Override
- public T getCapability( Capability capabilityClass )
+ public LazyOptional getCapability(Capability capabilityClass )
{
return this.duality.getCapability( capabilityClass, this.getSide().getFacing() );
}
@@ -239,9 +234,9 @@ public class PartFluidInterface extends PartBasicState implements IGridTickable,
return Api.INSTANCE.definitions().parts().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_FLUID_INTERFACE;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_FLUID_INTERFACE;
+// FIXME }
}
diff --git a/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java b/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java
index 7af658f1e..39b6dc4ee 100644
--- a/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java
+++ b/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java
@@ -7,10 +7,8 @@ import java.util.Random;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
-import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
-import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -40,7 +38,7 @@ import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.fluids.util.AEFluidInventory;
import appeng.fluids.util.IAEFluidInventory;
import appeng.fluids.util.IAEFluidTank;
@@ -319,8 +317,8 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
- world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
- new int[0] );
+ // FIXME world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
+ // FIXME new int[0] );
}
}
@@ -329,7 +327,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_FLUID_LEVEL_EMITTER );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_FLUID_LEVEL_EMITTER );
}
return true;
}
diff --git a/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java b/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java
index f06b0aa6b..88372b6bf 100644
--- a/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java
+++ b/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java
@@ -65,7 +65,7 @@ import appeng.capabilities.Capabilities;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
-import appeng.core.sync.GuiBridge;
+
import appeng.fluids.util.AEFluidInventory;
import appeng.fluids.util.IAEFluidInventory;
import appeng.fluids.util.IAEFluidTank;
@@ -224,7 +224,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS_FLUID );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS_FLUID );
}
return true;
}
@@ -489,9 +489,9 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
return Api.INSTANCE.definitions().parts().fluidStorageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_STORAGEBUS_FLUID;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_STORAGEBUS_FLUID;
+// FIXME }
}
diff --git a/src/main/java/appeng/fluids/parts/PartFluidTerminal.java b/src/main/java/appeng/fluids/parts/PartFluidTerminal.java
index cc3388fb4..6337ec27b 100644
--- a/src/main/java/appeng/fluids/parts/PartFluidTerminal.java
+++ b/src/main/java/appeng/fluids/parts/PartFluidTerminal.java
@@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
import appeng.parts.reporting.AbstractPartTerminal;
@@ -53,11 +53,11 @@ public class PartFluidTerminal extends AbstractPartTerminal
super( is );
}
- @Override
- public GuiBridge getGui( PlayerEntity player )
- {
- return GuiBridge.GUI_FLUID_TERMINAL;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGui( PlayerEntity player )
+// FIXME {
+// FIXME return GuiBridge.GUI_FLUID_TERMINAL;
+// FIXME }
@Override
public IPartModel getStaticModels()
diff --git a/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java b/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java
index 3ab86682e..6a00b090d 100644
--- a/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java
+++ b/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java
@@ -39,7 +39,7 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.util.AECableType;
import appeng.core.Api;
-import appeng.core.sync.GuiBridge;
+
import appeng.fluids.util.AEFluidInventory;
import appeng.fluids.util.IAEFluidTank;
import appeng.me.GridAccessException;
@@ -107,7 +107,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS_FLUID );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS_FLUID );
}
return true;
diff --git a/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java b/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java
index 35aca83a8..1e9abf28d 100644
--- a/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java
+++ b/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java
@@ -32,7 +32,7 @@ import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AEPartLocation;
import appeng.core.Api;
-import appeng.core.sync.GuiBridge;
+
import appeng.util.Platform;
@@ -48,6 +48,6 @@ public class BasicFluidCellGuiHandler implements ICellGuiHandler
@Override
public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan )
{
- Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_FLUID_TERMINAL );
+ // FIXME Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_FLUID_TERMINAL );
}
}
diff --git a/src/main/java/appeng/fluids/tile/TileFluidInterface.java b/src/main/java/appeng/fluids/tile/TileFluidInterface.java
index 62c26ae6b..23deea40c 100644
--- a/src/main/java/appeng/fluids/tile/TileFluidInterface.java
+++ b/src/main/java/appeng/fluids/tile/TileFluidInterface.java
@@ -26,11 +26,12 @@ import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
-import appeng.api.AEApi;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkChannelsChanged;
@@ -44,7 +45,7 @@ import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
-import appeng.core.sync.GuiBridge;
+
import appeng.fluids.helper.DualityFluidInterface;
import appeng.fluids.helper.IFluidInterfaceHost;
import appeng.helpers.IPriorityHost;
@@ -55,6 +56,10 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
{
private final DualityFluidInterface duality = new DualityFluidInterface( this.getProxy(), this );
+ public TileFluidInterface(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c )
{
@@ -98,17 +103,17 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
this.duality.writeToNBT( data );
return data;
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.duality.readFromNBT( data );
}
@@ -143,16 +148,10 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
}
@Override
- public boolean hasCapability( Capability> capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
- return this.duality.hasCapability( capability, facing ) || super.hasCapability( capability, facing );
- }
-
- @Override
- public T getCapability( Capability capability, @Nullable Direction facing )
- {
- T result = this.duality.getCapability( capability, facing );
- if( result != null )
+ LazyOptional result = this.duality.getCapability( capability, facing );
+ if( result.isPresent() )
{
return result;
}
@@ -183,9 +182,9 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable,
return Api.INSTANCE.definitions().blocks().fluidIface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_FLUID_INTERFACE;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_FLUID_INTERFACE;
+// FIXME }
}
diff --git a/src/main/java/appeng/fluids/util/AEFluidInventory.java b/src/main/java/appeng/fluids/util/AEFluidInventory.java
index 89dc0cb18..54328b2ca 100644
--- a/src/main/java/appeng/fluids/util/AEFluidInventory.java
+++ b/src/main/java/appeng/fluids/util/AEFluidInventory.java
@@ -110,9 +110,48 @@ public class AEFluidInventory implements IAEFluidTank
return stack != FluidStack.EMPTY;
}
+ public int fill( final int slot, final FluidStack resource, final boolean doFill )
+ {
+ if( resource.isEmpty()|| resource.getAmount() <= 0 )
+ {
+ return 0;
+ }
+
+ final IAEFluidStack fluid = this.fluids[slot];
+
+ if( fluid != null && !fluid.getFluidStack().equals( resource ) )
+ {
+ return 0;
+ }
+
+ int amountToStore = this.capacity;
+
+ if( fluid != null )
+ {
+ amountToStore -= fluid.getStackSize();
+ }
+
+ amountToStore = Math.min( amountToStore, resource.getAmount() );
+
+ if( doFill )
+ {
+ if( fluid == null )
+ {
+ this.setFluidInSlot( slot, AEFluidStack.fromFluidStack( resource ) );
+ }
+ else
+ {
+ fluid.setStackSize( fluid.getStackSize() + amountToStore );
+ this.onContentChanged( slot );
+ }
+ }
+
+ return amountToStore;
+ }
+
@Override
public int fill(FluidStack resource, FluidAction action) {
- if( resource == null || resource == FluidStack.EMPTY || resource.getAmount() <= 0 )
+ if( resource == null || resource.isEmpty() || resource.getAmount() <= 0 )
{
return 0;
}
@@ -158,18 +197,18 @@ public class AEFluidInventory implements IAEFluidTank
{
if( fluid == null || fluid.getAmount() <= 0 )
{
- return null;
+ return FluidStack.EMPTY;
}
final FluidStack resource = fluid.copy();
- FluidStack totalDrained = null;
+ FluidStack totalDrained = FluidStack.EMPTY;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
FluidStack drain = this.drain( slot, resource, action == FluidAction.EXECUTE );
if( drain != null )
{
- if( totalDrained == null )
+ if( totalDrained.isEmpty() )
{
totalDrained = drain;
}
@@ -193,18 +232,18 @@ public class AEFluidInventory implements IAEFluidTank
{
if( maxDrain == 0 )
{
- return null;
+ return FluidStack.EMPTY;
}
- FluidStack totalDrained = null;
+ FluidStack totalDrained = FluidStack.EMPTY;
int toDrain = maxDrain;
for( int slot = 0; slot < this.getSlots(); ++slot )
{
- if( totalDrained == null )
+ if( totalDrained.isEmpty() )
{
totalDrained = this.drain( slot, toDrain, action == FluidAction.EXECUTE );
- if( totalDrained != null )
+ if( totalDrained.isEmpty() )
{
toDrain -= totalDrained.getAmount();
}
@@ -250,7 +289,7 @@ public class AEFluidInventory implements IAEFluidTank
public FluidStack drain( final int slot, final FluidStack resource, final boolean doDrain )
{
final IAEFluidStack fluid = this.fluids[slot];
- if( resource == null || fluid == null || !fluid.equals( resource ) )
+ if( resource.isEmpty() || fluid == null || !fluid.getFluidStack().equals( resource ) )
{
return null;
}
diff --git a/src/main/java/appeng/fluids/util/FluidSorters.java b/src/main/java/appeng/fluids/util/FluidSorters.java
index c1ec8a4a4..a48386168 100644
--- a/src/main/java/appeng/fluids/util/FluidSorters.java
+++ b/src/main/java/appeng/fluids/util/FluidSorters.java
@@ -37,11 +37,12 @@ public class FluidSorters
public static final Comparator CONFIG_BASED_SORT_BY_NAME = ( o1, o2 ) ->
{
+ // FIXME: Calling .getString() to compare two untranslated strings is a problem, we need to investigate how to do this better
if( getDirection() == SortDir.ASCENDING )
{
- return Platform.getFluidDisplayName( o1 ).compareToIgnoreCase( Platform.getFluidDisplayName( o2 ) );
+ return Platform.getFluidDisplayName( o1 ).getString().compareToIgnoreCase( Platform.getFluidDisplayName( o2 ).getString() );
}
- return Platform.getFluidDisplayName( o2 ).compareToIgnoreCase( Platform.getFluidDisplayName( o1 ) );
+ return Platform.getFluidDisplayName( o2 ).getString().compareToIgnoreCase( Platform.getFluidDisplayName( o1 ).getString() );
};
public static final Comparator CONFIG_BASED_SORT_BY_MOD = new Comparator()
@@ -64,7 +65,8 @@ public class FluidSorters
{
if( compareToIgnoreCase == 0 )
{
- return Platform.getFluidDisplayName( o2 ).compareToIgnoreCase( Platform.getFluidDisplayName( o1 ) );
+ // FIXME: Calling .getString() to compare two untranslated strings is a problem, we need to investigate how to do this better
+ return Platform.getFluidDisplayName( o2 ).getString().compareToIgnoreCase( Platform.getFluidDisplayName( o1 ).getString() );
}
return compareToIgnoreCase;
diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java
index 3e430bba9..d30c22c07 100644
--- a/src/main/java/appeng/helpers/DualityInterface.java
+++ b/src/main/java/appeng/helpers/DualityInterface.java
@@ -46,8 +46,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.RangedWrapper;
@@ -1139,7 +1143,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
this.craftingTracker.jobStateChange( link );
}
- public String getTermName()
+ public ITextComponent getTermName()
{
final TileEntity hostTile = this.iHost.getTileEntity();
final World hostWorld = hostTile.getWorld();
@@ -1211,18 +1215,18 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( what.getItem() != Items.AIR )
{
- return what.getTranslationKey();
+ return new TranslationTextComponent(what.getTranslationKey());
}
final Item item = Item.getItemFromBlock( directedBlock );
if( item == Items.AIR )
{
- return directedBlock.getTranslationKey();
+ return new TranslationTextComponent(directedBlock.getTranslationKey());
}
}
}
- return "Nothing";
+ return new StringTextComponent("Nothing");
}
public long getSortValue()
@@ -1262,17 +1266,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
}
@SuppressWarnings( "unchecked" )
- public T getCapability( Capability capabilityClass, Direction facing )
+ public LazyOptional getCapability(Capability capabilityClass, Direction facing )
{
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
{
- return (T) this.storage;
+ return (LazyOptional) LazyOptional.of(() -> this.storage);
}
else if( capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
{
- return (T) this.accessor;
+ return (LazyOptional) LazyOptional.of(() -> this.accessor);
}
- return null;
+ return LazyOptional.empty();
}
private class InterfaceRequestSource extends MachineSource
diff --git a/src/main/java/appeng/helpers/ICustomNameObject.java b/src/main/java/appeng/helpers/ICustomNameObject.java
index 616814c8e..e9db7a058 100644
--- a/src/main/java/appeng/helpers/ICustomNameObject.java
+++ b/src/main/java/appeng/helpers/ICustomNameObject.java
@@ -19,10 +19,12 @@
package appeng.helpers;
+import net.minecraft.util.text.ITextComponent;
+
public interface ICustomNameObject
{
- String getCustomInventoryName();
+ ITextComponent getCustomInventoryName();
boolean hasCustomInventoryName();
}
diff --git a/src/main/java/appeng/helpers/IPriorityHost.java b/src/main/java/appeng/helpers/IPriorityHost.java
index 641e36a6b..33299ec3a 100644
--- a/src/main/java/appeng/helpers/IPriorityHost.java
+++ b/src/main/java/appeng/helpers/IPriorityHost.java
@@ -21,7 +21,7 @@ package appeng.helpers;
import net.minecraft.item.ItemStack;
-import appeng.core.sync.GuiBridge;
+
public interface IPriorityHost
@@ -39,5 +39,6 @@ public interface IPriorityHost
ItemStack getItemStackRepresentation();
- GuiBridge getGuiBridge();
+ // FIXME Needs to be wired up to the static method in containers somehow
+ // FIXME GuiBridge getGuiBridge();
}
diff --git a/src/main/java/appeng/helpers/InvalidPatternHelper.java b/src/main/java/appeng/helpers/InvalidPatternHelper.java
index 453675789..718d099b5 100644
--- a/src/main/java/appeng/helpers/InvalidPatternHelper.java
+++ b/src/main/java/appeng/helpers/InvalidPatternHelper.java
@@ -19,15 +19,16 @@
package appeng.helpers;
-import java.util.ArrayList;
-import java.util.List;
-
+import appeng.util.Platform;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
-import appeng.util.Platform;
+import java.util.ArrayList;
+import java.util.List;
public class InvalidPatternHelper
@@ -117,9 +118,10 @@ public class InvalidPatternHelper
return !this.stack.isEmpty();
}
- public String getName()
+ public ITextComponent getName()
{
- return this.isValid() ? Platform.getItemDisplayName( this.stack ) : this.id + '@' + String.valueOf( this.getDamage() );
+ return this.isValid() ? Platform.getItemDisplayName( this.stack.getDisplayName() )
+ : new StringTextComponent(this.id + '@' + this.getDamage());
}
public int getDamage()
@@ -142,13 +144,13 @@ public class InvalidPatternHelper
return this.stack;
}
- public String getFormattedToolTip()
+ public ITextComponent getFormattedToolTip()
{
- String result = String.valueOf( this.getCount() ) + ' ' + this.getName();
+ ITextComponent result = new StringTextComponent( this.getCount() + " " ).appendSibling( this.getName() );
if( !this.isValid() )
{
- result = TextFormatting.RED + ( ' ' + result );
+ result.applyTextStyle(TextFormatting.RED);
}
return result;
diff --git a/src/main/java/appeng/hooks/TickHandler.java b/src/main/java/appeng/hooks/TickHandler.java
index aaa65b803..adce34e85 100644
--- a/src/main/java/appeng/hooks/TickHandler.java
+++ b/src/main/java/appeng/hooks/TickHandler.java
@@ -44,7 +44,6 @@ import net.minecraftforge.event.TickEvent.WorldTickEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
-import appeng.api.AEApi;
import appeng.api.networking.IGridNode;
import appeng.api.parts.CableRenderMode;
import appeng.api.util.AEColor;
diff --git a/src/main/java/appeng/items/materials/ItemMaterial.java b/src/main/java/appeng/items/materials/ItemMaterial.java
index fb954b2ea..4175029bd 100644
--- a/src/main/java/appeng/items/materials/ItemMaterial.java
+++ b/src/main/java/appeng/items/materials/ItemMaterial.java
@@ -33,10 +33,10 @@ import java.util.regex.Pattern;
import com.google.common.base.Preconditions;
import net.minecraft.client.util.ITooltipFlag;
-import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
@@ -45,6 +45,8 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -76,9 +78,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
private final Map dmgToMaterial = new HashMap<>();
- public ItemMaterial()
- {
- this.setHasSubtypes( true );
+ public ItemMaterial(Properties properties) {
+ super(properties);
+ // FIXME this.setHasSubtypes( true );
instance = this;
}
@@ -97,16 +99,16 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
if( mt == MaterialType.NAME_PRESS )
{
final CompoundNBT c = stack.getOrCreateTag();
- lines.add( c.getString( "InscribeName" ) );
+ lines.add( new StringTextComponent( c.getString( "InscribeName" ) ) );
}
final Upgrades u = this.getType( stack );
if( u != null )
{
- final List textList = new ArrayList<>();
+ final List textList = new ArrayList<>();
for( final Entry j : u.getSupported().entrySet() )
{
- String name = null;
+ ITextComponent name = null;
final int limit = j.getValue();
@@ -116,13 +118,13 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
final String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
if( str != null )
{
- name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
+ name = new TranslationTextComponent( str ).appendText( limit > 1 ? " (" + limit + ')' : "" );
}
}
if( name == null )
{
- name = j.getKey().getDisplayName() + ( limit > 1 ? " (" + limit + ')' : "" );
+ name = j.getKey().getDisplayName().appendText( ( limit > 1 ? " (" + limit + ')' : "" ) );
}
if( !textList.contains( name ) )
@@ -132,8 +134,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
}
final Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
+ // FIXME This comparison is not great...
final SlightlyBetterSort s = new SlightlyBetterSort( p );
- Collections.sort( textList, s );
+ textList.sort(s);
lines.addAll( textList );
}
}
@@ -206,8 +209,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
- protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks )
- {
+ public void fillItemGroup(ItemGroup group, NonNullList items) {
final List types = Arrays.asList( MaterialType.values() );
Collections.sort( types, ( o1, o2 ) -> o1.name().compareTo( o2.name() ) );
@@ -215,7 +217,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
{
if( mat.getDamageValue() >= 0 && mat.isRegistered() && mat.getItemInstance() == this )
{
- itemStacks.add( new ItemStack( this, 1, mat.getDamageValue() ) );
+ items.add( new ItemStack( this, 1/* FIXME, mat.getDamageValue() */ ) );
}
}
}
@@ -345,7 +347,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
return false;
}
- private static class SlightlyBetterSort implements Comparator
+ private static class SlightlyBetterSort implements Comparator
{
private final Pattern pattern;
@@ -355,12 +357,12 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
- public int compare( final String o1, final String o2 )
+ public int compare( final ITextComponent o1, final ITextComponent o2 )
{
try
{
- final Matcher a = this.pattern.matcher( o1 );
- final Matcher b = this.pattern.matcher( o2 );
+ final Matcher a = this.pattern.matcher( o1.getString() );
+ final Matcher b = this.pattern.matcher( o2.getString() );
if( a.find() && b.find() )
{
final int ia = Integer.parseInt( a.group( 1 ) );
@@ -372,7 +374,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
{
// ek!
}
- return o1.compareTo( o2 );
+ return o1.getString().compareTo( o2.getString() );
}
}
}
diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeed.java b/src/main/java/appeng/items/misc/ItemCrystalSeed.java
index 462bf61b2..ca8f6514a 100644
--- a/src/main/java/appeng/items/misc/ItemCrystalSeed.java
+++ b/src/main/java/appeng/items/misc/ItemCrystalSeed.java
@@ -27,8 +27,8 @@ import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
-import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
+import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.NonNullList;
@@ -59,9 +59,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public static final int FLUIX = SINGLE_OFFSET * 2;
public static final int FINAL_STAGE = SINGLE_OFFSET * 3;
- public ItemCrystalSeed()
- {
- this.setHasSubtypes( true );
+ public ItemCrystalSeed(Properties properties) {
+ super(properties);
+ // FIXME this.setHasSubtypes( true );
}
@Nullable
@@ -75,9 +75,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
.maybeStack( 1 )
.map( crystalSeedStack ->
{
- crystalSeedStack.setItemDamage( certus2 );
+ // FIXME crystalSeedStack.setItemDamage( certus2 );
crystalSeedStack = newStyle( crystalSeedStack );
- String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
+ String itemName = crystalSeedStack.getItem().getRegistryName().getPath();
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTag() );
} )
.orElse( null );
@@ -101,7 +101,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
final int progress;
final CompoundNBT comp = is.getOrCreateTag();
comp.putInt( "progress", progress = is.getDamage() );
- is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
+ // FIXME is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
return progress;
}
}
@@ -151,7 +151,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
final CompoundNBT comp = is.getOrCreateTag();
comp.putInt( "progress", newDamage );
- is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
+ // FIXME is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
}
@Override
@@ -239,22 +239,21 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
- protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks )
- {
+ public void fillItemGroup(ItemGroup group, NonNullList items) {
// lvl 0
- itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, NETHER ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, FLUIX ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , CERTUS */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , NETHER */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , FLUIX */ ) ) );
// lvl 1
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + CERTUS ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + NETHER ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + FLUIX ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + CERTUS */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + NETHER */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + FLUIX */ ) ) );
// lvl 2
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + CERTUS ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + NETHER ) ) );
- itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + FLUIX ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + CERTUS */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + NETHER */ ) ) );
+ items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + FLUIX */ ) ) );
}
}
diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java b/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java
index f0e882026..127c96803 100644
--- a/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java
+++ b/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java
@@ -21,7 +21,6 @@ package appeng.items.misc;
import com.google.common.collect.ImmutableList;
-import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
@@ -55,49 +54,49 @@ public class ItemCrystalSeedRendering extends ItemRenderingCustomizer
public void customize( IItemRendering rendering )
{
rendering.variants( ImmutableList.builder().add( MODELS_CERTUS ).add( MODELS_FLUIX ).add( MODELS_NETHER ).build() );
- rendering.meshDefinition( this.getItemMeshDefinition() );
+ // FIXME rendering.meshDefinition( this.getItemMeshDefinition() );
}
- private ItemMeshDefinition getItemMeshDefinition()
- {
- return is ->
- {
- int damage = ItemCrystalSeed.getProgress( is );
-
- // Split the damage value into crystal type and growth level
- int type = damage / ItemCrystalSeed.SINGLE_OFFSET;
- int level = ( damage % ItemCrystalSeed.SINGLE_OFFSET ) / ItemCrystalSeed.LEVEL_OFFSET;
-
- // Determine which list of models to use based on the type of crystal
- ModelResourceLocation[] models;
- switch( type )
- {
- case 0:
- models = MODELS_CERTUS;
- break;
- case 1:
- models = MODELS_NETHER;
- break;
- case 2:
- models = MODELS_FLUIX;
- break;
- default:
- // We use this as the fallback for broken items
- models = MODELS_CERTUS;
- break;
- }
-
- // Return one of the 3 models based on the level
- if( level < 0 )
- {
- level = 0;
- }
- else if( level >= models.length )
- {
- level = models.length - 1;
- }
-
- return models[level];
- };
- }
+ // FIXME private ItemMeshDefinition getItemMeshDefinition()
+ // FIXME {
+ // FIXME return is ->
+ // FIXME {
+ // FIXME int damage = ItemCrystalSeed.getProgress( is );
+// FIXME
+ // FIXME // Split the damage value into crystal type and growth level
+ // FIXME int type = damage / ItemCrystalSeed.SINGLE_OFFSET;
+ // FIXME int level = ( damage % ItemCrystalSeed.SINGLE_OFFSET ) / ItemCrystalSeed.LEVEL_OFFSET;
+// FIXME
+ // FIXME // Determine which list of models to use based on the type of crystal
+ // FIXME ModelResourceLocation[] models;
+ // FIXME switch( type )
+ // FIXME {
+ // FIXME case 0:
+ // FIXME models = MODELS_CERTUS;
+ // FIXME break;
+ // FIXME case 1:
+ // FIXME models = MODELS_NETHER;
+ // FIXME break;
+ // FIXME case 2:
+ // FIXME models = MODELS_FLUIX;
+ // FIXME break;
+ // FIXME default:
+ // FIXME // We use this as the fallback for broken items
+ // FIXME models = MODELS_CERTUS;
+ // FIXME break;
+ // FIXME }
+// FIXME
+ // FIXME // Return one of the 3 models based on the level
+ // FIXME if( level < 0 )
+ // FIXME {
+ // FIXME level = 0;
+ // FIXME }
+ // FIXME else if( level >= models.length )
+ // FIXME {
+ // FIXME level = models.length - 1;
+ // FIXME }
+// FIXME
+ // FIXME return models[level];
+ // FIXME };
+ // FIXME }
}
diff --git a/src/main/java/appeng/items/misc/ItemEncodedPattern.java b/src/main/java/appeng/items/misc/ItemEncodedPattern.java
index ee113a6dd..dbab5b105 100644
--- a/src/main/java/appeng/items/misc/ItemEncodedPattern.java
+++ b/src/main/java/appeng/items/misc/ItemEncodedPattern.java
@@ -19,25 +19,6 @@
package appeng.items.misc;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import net.minecraft.client.util.ITooltipFlag;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.ItemUseContext;
-import net.minecraft.util.ActionResult;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.Hand;
-import net.minecraft.util.text.ITextComponent;
-import net.minecraft.util.text.TextFormatting;
-import net.minecraft.world.World;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
-
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack;
@@ -48,6 +29,26 @@ import appeng.helpers.InvalidPatternHelper;
import appeng.helpers.PatternHelper;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
+import net.minecraft.client.util.ITooltipFlag;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemUseContext;
+import net.minecraft.util.ActionResult;
+import net.minecraft.util.ActionResultType;
+import net.minecraft.util.Hand;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.util.text.TextFormatting;
+import net.minecraft.util.text.TranslationTextComponent;
+import net.minecraft.world.World;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.api.distmarker.OnlyIn;
+
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem
@@ -115,34 +116,35 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
return;
}
- stack.setStackDisplayName( TextFormatting.RED + GuiText.InvalidPattern.getLocal() );
+ stack.setDisplayName(new TranslationTextComponent(GuiText.InvalidPattern.getTranslationKey())
+ .applyTextStyle(TextFormatting.RED));
InvalidPatternHelper invalid = new InvalidPatternHelper( stack );
- final String label = ( invalid.isCraftable() ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
- final String and = ' ' + GuiText.And.getLocal() + ' ';
- final String with = GuiText.With.getLocal() + ": ";
+ final ITextComponent label = new TranslationTextComponent( invalid.isCraftable() ? GuiText.Crafts.getTranslationKey() : GuiText.Creates.getTranslationKey() ).appendText(": ");
+ final ITextComponent and = new StringTextComponent(" ").appendSibling(new TranslationTextComponent(GuiText.And.getTranslationKey())).appendText(" ");
+ final ITextComponent with = new TranslationTextComponent(GuiText.With.getTranslationKey()).appendText(": ");
boolean first = true;
for( final InvalidPatternHelper.PatternIngredient output : invalid.getOutputs() )
{
- lines.add( ( first ? label : and ) + output.getFormattedToolTip() );
+ lines.add( ( first ? label : and ).shallowCopy().appendSibling(output.getFormattedToolTip()) );
first = false;
}
first = true;
for( final InvalidPatternHelper.PatternIngredient input : invalid.getInputs() )
{
- lines.add( ( first ? with : and ) + input.getFormattedToolTip() );
+ lines.add( ( first ? with : and ).shallowCopy().appendSibling(input.getFormattedToolTip()) );
first = false;
}
if( invalid.isCraftable() )
{
- final String substitutionLabel = GuiText.Substitute.getLocal() + " ";
- final String canSubstitute = invalid.canSubstitute() ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
+ final ITextComponent substitutionLabel = new TranslationTextComponent(GuiText.Substitute.getTranslationKey()).appendText(" ");
+ final ITextComponent canSubstitute = new TranslationTextComponent(invalid.canSubstitute() ? GuiText.Yes.getTranslationKey() : GuiText.No.getTranslationKey());
- lines.add( substitutionLabel + canSubstitute );
+ lines.add( substitutionLabel.appendSibling(canSubstitute) );
}
return;
@@ -159,9 +161,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final IAEItemStack[] in = details.getCondensedInputs();
final IAEItemStack[] out = details.getCondensedOutputs();
- final String label = ( isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
- final String and = ' ' + GuiText.And.getLocal() + ' ';
- final String with = GuiText.With.getLocal() + ": ";
+ final ITextComponent label = ( isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent() ).appendText(": ");
+ final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent()).appendText(" ");
+ final ITextComponent with = GuiText.With.textComponent().appendText(": ");
boolean first = true;
for( final IAEItemStack anOut : out )
@@ -171,7 +173,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue;
}
- lines.add( ( first ? label : and ) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
+ lines.add( ( first ? label : and ).shallowCopy().appendText(anOut.getStackSize() + " ").appendSibling(Platform.getItemDisplayName( anOut )));
first = false;
}
@@ -183,16 +185,16 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue;
}
- lines.add( ( first ? with : and ) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
+ lines.add((first ? with : and).shallowCopy().appendText(anIn.getStackSize() + " ").appendSibling(Platform.getItemDisplayName(anIn)));
first = false;
}
if( isCrafting )
{
- final String substitutionLabel = GuiText.Substitute.getLocal() + " ";
- final String canSubstitute = substitute ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
+ final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
+ final ITextComponent canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
- lines.add( substitutionLabel + canSubstitute );
+ lines.add( substitutionLabel.appendSibling(canSubstitute) );
}
}
diff --git a/src/main/java/appeng/items/misc/ItemPaintBall.java b/src/main/java/appeng/items/misc/ItemPaintBall.java
index d517c9d86..9af11b3c1 100644
--- a/src/main/java/appeng/items/misc/ItemPaintBall.java
+++ b/src/main/java/appeng/items/misc/ItemPaintBall.java
@@ -38,9 +38,9 @@ public class ItemPaintBall extends AEBaseItem
private static final int DAMAGE_THRESHOLD = 20;
- public ItemPaintBall()
- {
- this.setHasSubtypes( true );
+ public ItemPaintBall(Properties properties) {
+ super(properties);
+ // FIXME this.setHasSubtypes( true );
}
@Override
@@ -84,7 +84,7 @@ public class ItemPaintBall extends AEBaseItem
{
if( c != AEColor.TRANSPARENT )
{
- itemStacks.add( new ItemStack( this, 1, c.ordinal() ) );
+ itemStacks.add( new ItemStack( this, 1 /* FIXME, c.ordinal() */ ) );
}
}
@@ -92,7 +92,7 @@ public class ItemPaintBall extends AEBaseItem
{
if( c != AEColor.TRANSPARENT )
{
- itemStacks.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
+ itemStacks.add( new ItemStack( this, 1 /* FIXME , DAMAGE_THRESHOLD + c.ordinal() */ ) );
}
}
}
diff --git a/src/main/java/appeng/items/misc/ItemPaintBallRendering.java b/src/main/java/appeng/items/misc/ItemPaintBallRendering.java
index 4019aad9b..a90e1e299 100644
--- a/src/main/java/appeng/items/misc/ItemPaintBallRendering.java
+++ b/src/main/java/appeng/items/misc/ItemPaintBallRendering.java
@@ -39,7 +39,7 @@ public class ItemPaintBallRendering extends ItemRenderingCustomizer
{
rendering.color( ItemPaintBallRendering::getColorFromItemstack );
rendering.variants( MODEL_NORMAL, MODEL_SHIMMER );
- rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
+ // FIXME rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
}
private static int getColorFromItemstack( ItemStack stack, int tintIndex )
diff --git a/src/main/java/appeng/items/parts/FacadeRendering.java b/src/main/java/appeng/items/parts/FacadeRendering.java
index 308e107a9..e52288e7f 100644
--- a/src/main/java/appeng/items/parts/FacadeRendering.java
+++ b/src/main/java/appeng/items/parts/FacadeRendering.java
@@ -21,7 +21,6 @@ package appeng.items.parts;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
-import appeng.client.render.FacadeItemModel;
/**
@@ -34,6 +33,6 @@ public class FacadeRendering extends ItemRenderingCustomizer
public void customize( IItemRendering rendering )
{
// This actually just uses the path it will look for by default, no custom model redirection needed
- rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
+ // FIXME rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
}
}
diff --git a/src/main/java/appeng/items/parts/ItemFacade.java b/src/main/java/appeng/items/parts/ItemFacade.java
index e50b94e38..caefcf12f 100644
--- a/src/main/java/appeng/items/parts/ItemFacade.java
+++ b/src/main/java/appeng/items/parts/ItemFacade.java
@@ -25,30 +25,18 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.block.Blocks;
-import net.minecraft.item.ItemUseContext;
-import net.minecraft.item.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
+import net.minecraft.item.*;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
-import net.minecraft.util.BlockRenderLayer;
-import net.minecraft.util.EnumActionResult;
-import net.minecraft.util.BlockRenderType;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.text.ITextComponent;
-import net.minecraft.world.World;
-import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.registries.ForgeRegistries;
-import appeng.api.AEApi;
import appeng.api.exceptions.MissingDefinitionException;
import appeng.api.parts.IAlphaPassItem;
import appeng.api.util.AEPartLocation;
@@ -67,9 +55,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
private List subTypes = null;
- public ItemFacade()
- {
- this.setHasSubtypes( true );
+ public ItemFacade(Properties properties) {
+ super(properties);
+ // FIXME this.setHasSubtypes( true );
}
@Override
@@ -97,10 +85,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
- protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks )
- {
+ public void fillItemGroup(ItemGroup group, NonNullList items) {
this.calculateSubTypes();
- itemStacks.addAll( this.subTypes );
+ items.addAll( this.subTypes );
}
private void calculateSubTypes()
@@ -118,14 +105,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
continue;
}
- final NonNullList tmpList = NonNullList.create();
- b.getSubBlocks( b.getCreativeTabToDisplayOn(), tmpList );
- for( final ItemStack l : tmpList )
- {
- final ItemStack facade = this.createFacadeForItem( l, false );
- if( !facade.isEmpty() )
- {
- this.subTypes.add( facade );
+ Item blockItem = b.asItem();
+ if (blockItem != null && blockItem.getGroup() != null) {
+ final NonNullList tmpList = NonNullList.create();
+ b.fillItemGroup(blockItem.getGroup(), tmpList);
+ for (final ItemStack l : tmpList) {
+ final ItemStack facade = this.createFacadeForItem(l, false);
+ if (!facade.isEmpty()) {
+ this.subTypes.add(facade);
+ }
}
}
}
@@ -150,14 +138,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return ItemStack.EMPTY;
}
- final int metadata = itemStack.getItem().getMetadata( itemStack.getDamage() );
+ final int metadata = 0; // FIXME 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
BlockState blockState;
try
{
- blockState = block.getStateFromMeta( metadata );
+ blockState = null; // FIXME block.getStateFromMeta( metadata );
}
catch( Exception e )
{
@@ -171,7 +159,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
final BlockState defaultState = block.getDefaultState();
final boolean isTileEntity = block.hasTileEntity( defaultState );
- final boolean isFullCube = block.isFullCube( defaultState );
+ final boolean isFullCube = true; // FIXME defaultState.isFullCube( defaultState );
final boolean isTileEntityAllowed = !isTileEntity || ( areTileEntitiesEnabled && isWhiteListed );
final boolean isBlockAllowed = isFullCube || isWhiteListed;
@@ -267,11 +255,11 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return Blocks.GLASS.getDefaultState();
}
- int metadata = baseItemStack.getItem().getMetadata( baseItemStack );
+ int metadata = 0; // FIXME baseItemStack.getItem().getMetadata( baseItemStack );
try
{
- return block.getStateFromMeta( metadata );
+ return null; // FIXME block.getStateFromMeta( metadata );
}
catch( Exception e )
{
@@ -329,7 +317,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
return false;
}
- Block blk = blockState.getBlock();
- return blk.canRenderInLayer( blockState, BlockRenderLayer.TRANSLUCENT );
+ return RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucent() )
+ || RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucentNoCrumbling() );
}
}
diff --git a/src/main/java/appeng/items/parts/ItemPart.java b/src/main/java/appeng/items/parts/ItemPart.java
index 0a703fa43..27c69275e 100644
--- a/src/main/java/appeng/items/parts/ItemPart.java
+++ b/src/main/java/appeng/items/parts/ItemPart.java
@@ -19,34 +19,6 @@
package appeng.items.parts;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import com.google.common.base.Preconditions;
-
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.item.ItemUseContext;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.Direction;
-import net.minecraft.util.EnumActionResult;
-import net.minecraft.util.Hand;
-import net.minecraft.util.NonNullList;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
-
-import appeng.api.AEApi;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
@@ -56,6 +28,21 @@ import appeng.core.features.ActivityState;
import appeng.core.features.ItemStackSrc;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
+import com.google.common.base.Preconditions;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemGroup;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemUseContext;
+import net.minecraft.util.ActionResultType;
+import net.minecraft.util.NonNullList;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+import java.util.Map.Entry;
public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
@@ -66,11 +53,11 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
public static ItemPart instance;
private final Map registered;
- public ItemPart()
- {
+ public ItemPart(Properties properties) {
+ super(properties);
this.registered = new HashMap<>( INITIAL_REGISTERED_CAPACITY );
- this.setHasSubtypes( true );
+// FIXME this.setHasSubtypes( true );
instance = this;
}
@@ -113,7 +100,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
final int partDamage = mat.getBaseDamage() + varID;
final ActivityState state = ActivityState.from( enabled );
- final ItemStackSrc output = new ItemStackSrc( this, partDamage, state );
+ final ItemStackSrc output = new ItemStackSrc( this/* FIXME, partDamage */, state );
final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
@@ -175,7 +162,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
}
@Override
- public String getItemStackDisplayName( final ItemStack is )
+ public ITextComponent getDisplayName(final ItemStack is )
{
final PartType pt = this.getTypeByStack( is );
@@ -187,27 +174,26 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
if( registeredPartType != null )
{
- return super.getItemStackDisplayName( is ) + " - " + variants[registeredPartType.variant].toString();
+ return super.getDisplayName( is ).appendText(" - ").appendSibling(new TranslationTextComponent(variants[registeredPartType.variant].translationKey));
}
}
if( pt.getExtraName() != null )
{
- return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();
+ return super.getDisplayName( is ).appendText(" - ").appendSibling(pt.getExtraName().textComponent());
}
- return super.getItemStackDisplayName( is );
+ return super.getDisplayName( is );
}
@Override
- protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks )
- {
+ public void fillItemGroup(ItemGroup group, NonNullList items) {
final List> types = new ArrayList<>( this.registered.entrySet() );
Collections.sort( types, REGISTERED_COMPARATOR );
for( final Entry part : types )
{
- itemStacks.add( new ItemStack( this, 1, part.getKey() ) );
+ items.add( new ItemStack( this, 1/* FIXME, part.getKey() */ ) );
}
}
@@ -227,8 +213,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
@Nullable
@Override
- public IPart createPartFromItemStack( final ItemStack is )
- {
+ public IPart createPartFromItemStack( final ItemStack is ) {
final PartType type = this.getTypeByStack( is );
final Class extends IPart> part = type.getPart();
if( part == null )
@@ -245,22 +230,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
return type.getConstructor().newInstance( is );
}
- catch( final InstantiationException e )
- {
- throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
- .getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
- }
- catch( final IllegalAccessException e )
- {
- throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
- .getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
- }
- catch( final InvocationTargetException e )
- {
- throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
- .getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
- }
- catch( final NoSuchMethodException e )
+ catch( final InstantiationException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
{
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
@@ -332,11 +302,11 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
if( group && importBus && exportBus && ( u == PartType.IMPORT_BUS || u == PartType.EXPORT_BUS ) )
{
- return GuiText.IOBuses.getUnlocalized();
+ return GuiText.IOBuses.getTranslationKey();
}
if( group && importBusFluids && exportBusFluids && ( u == PartType.FLUID_IMPORT_BUS || u == PartType.FLUID_EXPORT_BUS ) )
{
- return GuiText.IOBusesFluids.getUnlocalized();
+ return GuiText.IOBusesFluids.getTranslationKey();
}
return null;
diff --git a/src/main/java/appeng/items/parts/ItemPartRendering.java b/src/main/java/appeng/items/parts/ItemPartRendering.java
index 7857c286f..8be4ed197 100644
--- a/src/main/java/appeng/items/parts/ItemPartRendering.java
+++ b/src/main/java/appeng/items/parts/ItemPartRendering.java
@@ -34,7 +34,6 @@ import appeng.api.util.AEColor;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
import appeng.client.render.StaticItemColor;
-import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
import appeng.core.AppEng;
import appeng.core.features.registries.PartModels;
import appeng.parts.automation.PlaneConnections;
@@ -59,7 +58,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
public void customize( IItemRendering rendering )
{
- rendering.meshDefinition( this::getItemMeshDefinition );
+ // FIXME rendering.meshDefinition( this::getItemMeshDefinition );
rendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
@@ -130,7 +129,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
}
// base p2p model with frequency
- rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
+ // FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
List partResourceLocs = modelNames.stream()
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java
index fab98ae89..670b4cab2 100644
--- a/src/main/java/appeng/items/parts/PartType.java
+++ b/src/main/java/appeng/items/parts/PartType.java
@@ -41,16 +41,6 @@ import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.api.features.AEFeature;
import appeng.core.localization.GuiText;
-import appeng.fluids.parts.PartFluidAnnihilationPlane;
-import appeng.fluids.parts.PartFluidExportBus;
-import appeng.fluids.parts.PartFluidFormationPlane;
-import appeng.fluids.parts.PartFluidImportBus;
-import appeng.fluids.parts.PartFluidInterface;
-import appeng.fluids.parts.PartFluidLevelEmitter;
-import appeng.fluids.parts.PartFluidStorageBus;
-import appeng.fluids.parts.PartFluidTerminal;
-import appeng.integration.IntegrationRegistry;
-import appeng.integration.IntegrationType;
import appeng.parts.automation.PartAnnihilationPlane;
import appeng.parts.automation.PartExportBus;
import appeng.parts.automation.PartFormationPlane;
@@ -69,9 +59,6 @@ import appeng.parts.networking.PartDenseCableCovered;
import appeng.parts.networking.PartDenseCableSmart;
import appeng.parts.networking.PartQuartzFiber;
import appeng.parts.p2p.PartP2PFEPower;
-import appeng.parts.p2p.PartP2PFluids;
-import appeng.parts.p2p.PartP2PIC2Power;
-import appeng.parts.p2p.PartP2PItems;
import appeng.parts.p2p.PartP2PLight;
import appeng.parts.p2p.PartP2PRedstone;
import appeng.parts.p2p.PartP2PTunnelME;
@@ -199,20 +186,20 @@ public enum PartType
DARK_MONITOR( 200, "dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
STORAGE_BUS( 220, "storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
- FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
- .noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
+// FIXME FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
IMPORT_BUS( 240, "import_bus", EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
- FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
+// FIXME FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
EXPORT_BUS( 260, "export_bus", EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
- FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
+// FIXME FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
LEVEL_EMITTER( 280, "level_emitter", EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
- FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
- .noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
+// FIXME FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
ANNIHILATION_PLANE( 300, "annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
@@ -220,13 +207,13 @@ public enum PartType
IDENTITY_ANNIHILATION_PLANE( 301, "identity_annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
- FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
- .noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
+// FIXME FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
- FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
- .noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
+// FIXME FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
@@ -241,7 +228,7 @@ public enum PartType
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
INTERFACE( 440, "interface", EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
- FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
+// FIXME FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
P2P_TUNNEL_ME( 460, "p2p_tunnel_me", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
@@ -263,35 +250,35 @@ public enum PartType
}
},
- P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
- .noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
- {
- @Override
- String getTranslationKey()
- {
- return "p2p_tunnel";
- }
- },
-
- P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
- .noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
- {
- @Override
- String getTranslationKey()
- {
- return "p2p_tunnel";
- }
- },
-
- P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
- .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
- {
- @Override
- String getTranslationKey()
- {
- return "p2p_tunnel";
- }
- },
+// FIXME P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
+// FIXME {
+// FIXME @Override
+// FIXME String getTranslationKey()
+// FIXME {
+// FIXME return "p2p_tunnel";
+// FIXME }
+// FIXME },
+// FIXME
+// FIXME P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
+// FIXME .noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
+// FIXME {
+// FIXME @Override
+// FIXME String getTranslationKey()
+// FIXME {
+// FIXME return "p2p_tunnel";
+// FIXME }
+// FIXME },
+// FIXME
+// FIXME P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
+// FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
+// FIXME {
+// FIXME @Override
+// FIXME String getTranslationKey()
+// FIXME {
+// FIXME return "p2p_tunnel";
+// FIXME }
+// FIXME },
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
@@ -317,9 +304,9 @@ public enum PartType
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
- .noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
+ .noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
- FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
+// FIXME FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
private final int baseDamage;
private final Set features;
@@ -358,8 +345,8 @@ public enum PartType
this.oreName = oreDict;
// The part is enabled if all features + integrations it needs are enabled
- this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ) && integrations.stream()
- .allMatch( IntegrationRegistry.INSTANCE::isEnabled );
+ this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ); /* FIXME && integrations.stream()
+ .allMatch( IntegrationRegistry.INSTANCE::isEnabled ); */
if( this.enabled )
{
@@ -467,3 +454,5 @@ public enum PartType
}
}
+
+enum IntegrationType {}
\ No newline at end of file
diff --git a/src/main/java/appeng/items/storage/AbstractStorageCell.java b/src/main/java/appeng/items/storage/AbstractStorageCell.java
index c3b377e88..1a830c698 100644
--- a/src/main/java/appeng/items/storage/AbstractStorageCell.java
+++ b/src/main/java/appeng/items/storage/AbstractStorageCell.java
@@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -71,9 +71,9 @@ public abstract class AbstractStorageCell> extends AEBaseI
protected final MaterialType component;
protected final int totalBytes;
- public AbstractStorageCell( final MaterialType whichCell, final int kilobytes )
- {
- this.setMaxStackSize( 1 );
+ public AbstractStorageCell(Properties properties, final MaterialType whichCell, final int kilobytes ) {
+ super(properties);
+ // FIXME this.setMaxStackSize( 1 ); ---- see point of registration
this.totalBytes = kilobytes * 1024;
this.component = whichCell;
}
@@ -120,7 +120,7 @@ public abstract class AbstractStorageCell> extends AEBaseI
@Override
public String getUnlocalizedGroupName( final Set others, final ItemStack is )
{
- return GuiText.StorageCells.getUnlocalized();
+ return GuiText.StorageCells.getTranslationKey();
}
@Override
diff --git a/src/main/java/appeng/items/storage/BasicItemStorageCell.java b/src/main/java/appeng/items/storage/BasicItemStorageCell.java
index cf45815ae..9d306e863 100644
--- a/src/main/java/appeng/items/storage/BasicItemStorageCell.java
+++ b/src/main/java/appeng/items/storage/BasicItemStorageCell.java
@@ -37,9 +37,9 @@ public final class BasicItemStorageCell extends AbstractStorageCell= 0 )
{
- lines.add( GuiText.CellId.getLocal() + ": " + id );
+ lines.add( GuiText.CellId.textComponent().appendText( ": " + id ) );
}
final WorldCoord wc = this.getStoredSize( stack );
if( wc.x > 0 )
{
- lines.add( GuiText.StoredSize.getLocal() + ": " + wc.x + " x " + wc.y + " x " + wc.z );
+ lines.add( GuiText.StoredSize.textComponent().appendText( ": " + wc.x + " x " + wc.y + " x " + wc.z ) );
}
}
@@ -89,17 +90,19 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
@Override
public ISpatialDimension getSpatialDimension()
{
- final int id = AppEng.instance().getStorageDimensionID();
- World w = DimensionManager.getWorld( id );
- if( w == null )
- {
- DimensionManager.initDimension( id );
- w = DimensionManager.getWorld( id );
- }
+ World w = null;
+// FIXME final int id = AppEng.instance().getStorageDimensionID();
+// FIXME World w = DimensionManager.getWorld( id );
+// FIXME if( w == null )
+// FIXME {
+// FIXME DimensionManager.initDimension( id );
+// FIXME w = DimensionManager.getWorld( id );
+// FIXME }
- if( w != null && w.hasCapability( Capabilities.SPATIAL_DIMENSION, null ) )
+ if( w != null )
{
- return w.getCapability( Capabilities.SPATIAL_DIMENSION, null );
+ LazyOptional spatialCap = w.getCapability(Capabilities.SPATIAL_DIMENSION, null);
+ return spatialCap.orElse(null);
}
return null;
}
@@ -157,10 +160,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
BlockPos offset = manager.getCellDimensionOrigin( cellid );
this.setStorageCell( is, cellid, targetSize );
- StorageHelper.getInstance()
- .swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(),
- offset.getZ(), targetX - 1, targetY - 1,
- targetZ - 1 );
+ // FIXME StorageHelper.getInstance()
+ // FIXME .swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(),
+ // FIXME offset.getZ(), targetX - 1, targetY - 1,
+ // FIXME targetZ - 1 );
return new TransitionResult( true, 0 );
}
diff --git a/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java b/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java
index cc5e157c1..73d67b45a 100644
--- a/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java
+++ b/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java
@@ -8,7 +8,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
-import appeng.client.render.model.BiometricCardModel;
import appeng.core.AppEng;
@@ -21,7 +20,7 @@ public class ToolBiometricCardRendering extends ItemRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
- rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
+ // FIXME rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
}
}
diff --git a/src/main/java/appeng/items/tools/ToolMemoryCard.java b/src/main/java/appeng/items/tools/ToolMemoryCard.java
index c77e54c03..3f52a2db0 100644
--- a/src/main/java/appeng/items/tools/ToolMemoryCard.java
+++ b/src/main/java/appeng/items/tools/ToolMemoryCard.java
@@ -33,6 +33,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
+import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -70,12 +71,14 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
@OnlyIn( Dist.CLIENT )
public void addInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips )
{
- lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
+ String firstLineKey = this.getFirstValidTranslationKey( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) );
+ lines.add( new TranslationTextComponent(firstLineKey));
final CompoundNBT data = this.getData( stack );
if( data.contains( "tooltip" ) )
{
- lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
+ String tooltipKey = getFirstValidTranslationKey( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) );
+ lines.add( new TranslationTextComponent(tooltipKey) );
}
if( data.contains( "freq" ) )
@@ -83,7 +86,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
final short freq = data.getShort( "freq" );
final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString( freq );
- lines.add( I18n.translateToLocalFormatted( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
+ lines.add( new TranslationTextComponent( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
}
}
@@ -94,14 +97,13 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
*
* @return localized name
*/
- private String getLocalizedName( final String... name )
+ private String getFirstValidTranslationKey( final String... name )
{
for( final String n : name )
{
- final String l = I18n.translateToLocal( n );
- if( !l.equals( n ) )
+ if( I18n.hasKey(n) )
{
- return l;
+ return n;
}
}
@@ -126,7 +128,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
final CompoundNBT c = is.getOrCreateTag();
final String name = c.getString( "Config" );
- return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
+ return name.isEmpty() ? GuiText.Blank.getTranslationKey() : name;
}
@Override
@@ -134,10 +136,6 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
final CompoundNBT c = is.getOrCreateTag();
CompoundNBT o = c.getCompound( "Data" );
- if( o == null )
- {
- o = new CompoundNBT();
- }
return o.copy();
}
diff --git a/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java b/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java
index e4d18c0e3..38189e811 100644
--- a/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java
+++ b/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java
@@ -8,7 +8,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
-import appeng.client.render.model.MemoryCardModel;
import appeng.core.AppEng;
@@ -21,7 +20,7 @@ public class ToolMemoryCardRendering extends ItemRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
- rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
+ // FIXME rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
}
}
diff --git a/src/main/java/appeng/items/tools/ToolNetworkTool.java b/src/main/java/appeng/items/tools/ToolNetworkTool.java
index 1324a39cf..1e1ed244a 100644
--- a/src/main/java/appeng/items/tools/ToolNetworkTool.java
+++ b/src/main/java/appeng/items/tools/ToolNetworkTool.java
@@ -20,16 +20,15 @@ package appeng.items.tools;
import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ActionResult;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
+import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
@@ -48,7 +47,7 @@ import appeng.api.util.DimensionalCoord;
import appeng.api.util.INetworkToolAgent;
import appeng.container.AEBaseContainer;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.items.AEBaseItem;
@@ -90,12 +89,12 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
@Override
public ActionResultType onItemUseFirst( ItemStack stack, ItemUseContext context )
{
- final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
+ final BlockRayTraceResult mop = new BlockRayTraceResult( context.getHitVec(), context.getFace(), context.getPos(), context.isInside() );
final TileEntity te = context.getWorld().getTileEntity( context.getPos() );
if( te instanceof IPartHost )
{
- final SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
+ final SelectedPart part = ( (IPartHost) te ).selectPart( mop.getHitVec() );
if( part.part != null || part.facade != null )
{
@@ -116,7 +115,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
if( Platform.isClient() )
{
- NetworkHandler.instance().sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ, hand ) );
+ NetworkHandler.instance().sendToServer( new PacketClick( context.getPos(), context.getFace(), context.getPos().getX(), context.getPos().getY(), context.getPos().getZ(), context.getHand() ) );
}
return ActionResultType.SUCCESS;
@@ -137,15 +136,15 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
return false;
}
- final Block b = w.getBlockState( pos ).getBlock();
+ final BlockState bs = w.getBlockState( pos );
if( !p.isCrouching() )
{
final TileEntity te = w.getTileEntity( pos );
if( !( te instanceof IGridHost ) )
{
- if( b.rotateBlock( w, pos, side ) )
+ if( bs.rotate( w, pos, Rotation.CLOCKWISE_90 ) != bs )
{
- b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null, false );
+ bs.neighborChanged( w, pos, Platform.AIR_BLOCK, pos, false );
p.swingArm( hand );
return !w.isRemote;
}
@@ -163,23 +162,24 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
if( te instanceof IGridHost )
{
- Platform.openGUI( p, te, AEPartLocation.fromFacing( side ), GuiBridge.GUI_NETWORK_STATUS );
+ // FIXME Platform.openGUI( p, te, AEPartLocation.fromFacing( side ), GuiBridge.GUI_NETWORK_STATUS );
}
else
{
- Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
+ // FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
}
return true;
}
else
{
- b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, side, hitX, hitY, hitZ );
+ BlockRayTraceResult rtr = new BlockRayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos, false);
+ bs.onBlockActivated( w, p, hand, rtr );
}
}
else
{
- Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
+ // FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
}
return false;
diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java
index 7a835f619..e3fb24fa7 100644
--- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java
+++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java
@@ -19,41 +19,6 @@
package appeng.items.tools.powered;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.minecraft.item.SnowballItem;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.text.ITextComponent;
-import org.apache.commons.lang3.text.WordUtils;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockColored;
-import net.minecraft.block.BlockStainedGlass;
-import net.minecraft.block.BlockStainedGlassPane;
-import net.minecraft.block.BlockState;
-import net.minecraft.client.util.ITooltipFlag;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.block.Blocks;
-import net.minecraft.item.EnumDyeColor;
-import net.minecraft.item.ItemSnowball;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompoundNBT;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumActionResult;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
-import net.minecraftforge.items.IItemHandler;
-import net.minecraftforge.oredict.OreDictionary;
-
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IItemGroup;
@@ -82,6 +47,27 @@ import appeng.me.helpers.BaseActionSource;
import appeng.tile.misc.TilePaint;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.util.ITooltipFlag;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.SnowballItem;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ActionResultType;
+import net.minecraft.util.Direction;
+import net.minecraft.util.Hand;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
+import net.minecraft.world.World;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.api.distmarker.OnlyIn;
+import net.minecraftforge.items.IItemHandler;
+import org.apache.commons.lang3.text.WordUtils;
+
+import java.util.*;
public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem
@@ -95,9 +81,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
final String dyeName = color.dye.getTranslationKey();
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
- final int oreDictId = OreDictionary.getOreID( oreDictName );
+ // FIXME final int oreDictId = OreDictionary.getOreID( oreDictName );
- ORE_TO_COLOR.put( oreDictId, color );
+ // FIXME ORE_TO_COLOR.put( oreDictId, color );
}
}
@@ -197,18 +183,18 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
- public String getItemStackDisplayName( final ItemStack par1ItemStack )
+ public ITextComponent getDisplayName( final ItemStack is )
{
- String extra = GuiText.Empty.getLocal();
+ ITextComponent extra = GuiText.Empty.textComponent();
- final AEColor selected = this.getActiveColor( par1ItemStack );
+ final AEColor selected = this.getActiveColor( is );
if( selected != null && Platform.isClient() )
{
- extra = Platform.gui_localize( selected.translationKey);
+ extra = new TranslationTextComponent(selected.translationKey);
}
- return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
+ return super.getDisplayName( is ).appendText(" - ").appendSibling( extra );
}
public AEColor getActiveColor( final ItemStack tol )
@@ -235,15 +221,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
else
{
- final int[] id = OreDictionary.getOreIDs( paintBall );
-
- for( final int oreID : id )
- {
- if( ORE_TO_COLOR.containsKey( oreID ) )
- {
- return ORE_TO_COLOR.get( oreID );
- }
- }
+ // FIXME final int[] id = OreDictionary.getOreIDs( paintBall );
+// FIXME
+ // FIXME for( final int oreID : id )
+ // FIXME {
+ // FIXME if( ORE_TO_COLOR.containsKey( oreID ) )
+ // FIXME {
+ // FIXME return ORE_TO_COLOR.get( oreID );
+ // FIXME }
+ // FIXME }
}
return null;
@@ -353,63 +339,63 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
final BlockState state = w.getBlockState( pos );
- if( blk instanceof BlockColored )
- {
- final EnumDyeColor color = state.getValue( BlockColored.COLOR );
+// FIXME if( blk instanceof BlockColored )
+// FIXME {
+// FIXME final DyeColor color = state.get( BlockColored.COLOR );
+// FIXME
+// FIXME if( newColor.dye == color )
+// FIXME {
+// FIXME return false;
+// FIXME }
+// FIXME
+// FIXME return w.setBlockState( pos, state.with( BlockColored.COLOR, newColor.dye ) );
+// FIXME }
- if( newColor.dye == color )
- {
- return false;
- }
+// if( blk == Blocks.GLASS )
+// {
+// return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().with( BlockStainedGlass.COLOR, newColor.dye ) );
+// }
+//
+// if( blk == Blocks.STAINED_GLASS )
+// {
+// final DyeColor color = state.get( BlockStainedGlass.COLOR );
+//
+// if( newColor.dye == color )
+// {
+// return false;
+// }
+//
+// return w.setBlockState( pos, state.with( BlockStainedGlass.COLOR, newColor.dye ) );
+// }
- return w.setBlockState( pos, state.with( BlockColored.COLOR, newColor.dye ) );
- }
-
- if( blk == Blocks.GLASS )
- {
- return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().with( BlockStainedGlass.COLOR, newColor.dye ) );
- }
-
- if( blk == Blocks.STAINED_GLASS )
- {
- final EnumDyeColor color = state.getValue( BlockStainedGlass.COLOR );
-
- if( newColor.dye == color )
- {
- return false;
- }
-
- return w.setBlockState( pos, state.with( BlockStainedGlass.COLOR, newColor.dye ) );
- }
-
- if( blk == Blocks.GLASS_PANE )
- {
- return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().with( BlockStainedGlassPane.COLOR, newColor.dye ) );
- }
-
- if( blk == Blocks.STAINED_GLASS_PANE )
- {
- final EnumDyeColor color = state.getValue( BlockStainedGlassPane.COLOR );
-
- if( newColor.dye == color )
- {
- return false;
- }
-
- return w.setBlockState( pos, state.with( BlockStainedGlassPane.COLOR, newColor.dye ) );
- }
-
- if( blk == Blocks.HARDENED_CLAY )
- {
- return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().with( BlockColored.COLOR, newColor.dye ) );
- }
+// if( blk == Blocks.GLASS_PANE )
+// {
+// return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().with( BlockStainedGlassPane.COLOR, newColor.dye ) );
+// }
+//
+// if( blk == Blocks.STAINED_GLASS_PANE )
+// {
+// final DyeColor color = state.get( BlockStainedGlassPane.COLOR );
+//
+// if( newColor.dye == color )
+// {
+// return false;
+// }
+//
+// return w.setBlockState( pos, state.with( BlockStainedGlassPane.COLOR, newColor.dye ) );
+// }
+//
+// if( blk == Blocks.HARDENED_CLAY )
+// {
+// return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().with( BlockColored.COLOR, newColor.dye ) );
+// }
if( blk instanceof BlockCableBus )
{
return ( (BlockCableBus) blk ).recolorBlock( w, pos, side, newColor.dye, p );
}
- return blk.recolorBlock( w, pos, side, newColor.dye );
+ return blk.recolorBlock( state, w, pos, side, newColor.dye );
}
public void cycleColors( final ItemStack is, final ItemStack paintBall, final int i )
@@ -460,25 +446,25 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
- if( requestedAddition != null )
- {
- final int[] id = OreDictionary.getOreIDs( requestedAddition.getDefinition() );
-
- for( final int x : id )
- {
- if( ORE_TO_COLOR.containsKey( x ) )
- {
- return false;
- }
- }
-
- if( requestedAddition.getItem() instanceof SnowballItem )
- {
- return false;
- }
-
- return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
- }
+// FIXME if( requestedAddition != null )
+// FIXME {
+// FIXME final int[] id = OreDictionary.getOreIDs( requestedAddition.getDefinition() );
+// FIXME
+// FIXME for( final int x : id )
+// FIXME {
+// FIXME if( ORE_TO_COLOR.containsKey( x ) )
+// FIXME {
+// FIXME return false;
+// FIXME }
+// FIXME }
+// FIXME
+// FIXME if( requestedAddition.getItem() instanceof SnowballItem )
+// FIXME {
+// FIXME return false;
+// FIXME }
+// FIXME
+// FIXME return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
+// FIXME }
return true;
}
@@ -509,7 +495,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
@Override
public String getUnlocalizedGroupName( final Set others, final ItemStack is )
{
- return GuiText.StorageCells.getUnlocalized();
+ return GuiText.StorageCells.getTranslationKey();
}
@Override
diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java
index 14a9970e2..4af276578 100644
--- a/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java
+++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java
@@ -10,7 +10,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.AEColor;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
-import appeng.client.render.model.ColorApplicatorModel;
import appeng.core.AppEng;
@@ -24,10 +23,10 @@ public class ToolColorApplicatorRendering extends ItemRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
- rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() );
+ // FIXME rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() );
rendering.variants( MODEL_COLORED, MODEL_UNCOLORED );
rendering.color( this::getColor );
- rendering.meshDefinition( this::getMesh );
+ // FIXME rendering.meshDefinition( this::getMesh );
}
private ModelResourceLocation getMesh( ItemStack itemStack )
diff --git a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java
index 78b2ff4cf..9dea9fe05 100644
--- a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java
+++ b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java
@@ -26,14 +26,13 @@ import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
-import net.minecraft.block.BlockTNT;
import net.minecraft.block.Blocks;
+import net.minecraft.block.TNTBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.FurnaceRecipes;
+import net.minecraft.item.Items;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
@@ -41,6 +40,8 @@ import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.BlockRayTraceResult;
+import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@@ -68,23 +69,23 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE.getDefaultState() ),
new InWorldToolOperationResult( Blocks.COBBLESTONE.getDefaultState() ) );
- this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONEBRICK.getDefaultState() ),
- new InWorldToolOperationResult( Blocks.STONEBRICK.getStateFromMeta( 2 ) ) );
+// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE_BRICKS.getDefaultState() ),
+// FIXME new InWorldToolOperationResult( Blocks.STONE_BRICKS.getStateFromMeta( 2 ) ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.LAVA, true ), new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
- this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_LAVA, true ),
- new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
+// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_LAVA, true ),
+// FIXME new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.GRASS, true ), new InWorldToolOperationResult( Blocks.DIRT.getDefaultState() ) );
final List snowBalls = new ArrayList<>();
snowBalls.add( new ItemStack( Items.SNOWBALL ) );
- this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( null, snowBalls ) );
+// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( null, snowBalls ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult( Blocks.ICE.getDefaultState() ) );
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.ICE.getDefaultState() ), new InWorldToolOperationResult( Blocks.WATER.getDefaultState() ) );
- this.heatUp.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult() );
+// FIXME this.heatUp.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult() );
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult() );
- this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ),
- new InWorldToolOperationResult( Blocks.FLOWING_WATER.getStateFromMeta( 7 ) ) );
+// FIXME this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ),
+// FIXME new InWorldToolOperationResult( Blocks.FLOWING_WATER.getStateFromMeta( 7 ) ) );
}
private static class InWorldToolOperationIngredient
@@ -213,28 +214,26 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
@Override
public ActionResult onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
{
- final RayTraceResult target = this.rayTrace( w, p, true );
+ final RayTraceResult target = this.rayTrace( w, p, RayTraceContext.FluidMode.ANY );
- if( target == null )
+ if( target.getType() != RayTraceResult.Type.BLOCK )
{
return new ActionResult<>( ActionResultType.FAIL, p.getHeldItem( hand ) );
}
else
{
- if( target.getType() == RayTraceResult.Type.BLOCK )
+ BlockPos pos = ((BlockRayTraceResult) target).getPos();
+ final BlockState state = w.getBlockState( pos );
+ if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
{
- final BlockState state = w.getBlockState( target.getBlockPos() );
- if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
+ if( Platform.hasPermissions( new DimensionalCoord( w, pos ), p ) )
{
- if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
- {
- this.onItemUse( p, w, target.getBlockPos(), hand, Direction.UP, 0.0F, 0.0F, 0.0F );
- }
+ this.onItemUse( p, w, pos, hand, Direction.UP, 0.0F, 0.0F, 0.0F );
}
}
}
- return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
+ return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
@Override
@@ -244,13 +243,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
- public ActionResult onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
+ public ActionResultType onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
{
if( this.getAECurrentPower( item ) > 1600 )
{
if( !p.canPlayerEdit( pos, side, item ) )
{
- return EnumActionResult.FAIL;
+ return ActionResultType.FAIL;
}
final BlockState state = w.getBlockState( pos );
@@ -262,30 +261,30 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
this.extractAEPower( item, 1600, Actionable.MODULATE );
this.cool( state, w, pos );
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
}
else
{
- if( blockID instanceof BlockTNT )
+ if( blockID instanceof TNTBlock)
{
w.removeBlock(pos, false);
- ( (BlockTNT) blockID ).explode( w, pos, state, p );
- return EnumActionResult.SUCCESS;
+ ( (TNTBlock) blockID ).explode( w, pos );
+ return ActionResultType.SUCCESS;
}
if( blockID instanceof BlockTinyTNT )
{
w.removeBlock(pos, false);
( (BlockTinyTNT) blockID ).startFuse( w, pos, p );
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
if( this.canHeat( state ) )
{
this.extractAEPower( item, 1600, Actionable.MODULATE );
this.heat( state, w, pos );
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
final ItemStack[] stack = Platform.getBlockDrops( w, pos );
@@ -295,26 +294,26 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
for( final ItemStack i : stack )
{
- final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
-
- if( !result.isEmpty() )
- {
- if( result.getItem() instanceof BlockItem )
- {
- if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID
- .getMetaFromState( state ) )
- {
- canFurnaceable = false;
- }
- }
- hasFurnaceable = true;
- out.add( result );
- }
- else
- {
- canFurnaceable = false;
- out.add( i );
- }
+// FIXME final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
+// FIXME
+// FIXME if( !result.isEmpty() )
+// FIXME {
+// FIXME if( result.getItem() instanceof BlockItem )
+// FIXME {
+// FIXME if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID
+// FIXME .getMetaFromState( state ) )
+// FIXME {
+// FIXME canFurnaceable = false;
+// FIXME }
+// FIXME }
+// FIXME hasFurnaceable = true;
+// FIXME out.add( result );
+// FIXME }
+// FIXME else
+// FIXME {
+// FIXME canFurnaceable = false;
+// FIXME out.add( i );
+// FIXME }
}
if( hasFurnaceable && canFurnaceable )
@@ -322,7 +321,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
this.extractAEPower( item, 1600, Actionable.MODULATE );
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
w.playSound( p, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F,
- itemRand.nextFloat() * 0.4F + 0.8F );
+ random.nextFloat() * 0.4F + 0.8F );
if( or.getBlockState() == null )
{
@@ -338,7 +337,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
Platform.spawnDrops( w, pos, or.getDrops() );
}
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
else
{
@@ -346,22 +345,22 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( !p.canPlayerEdit( offsetPos, side, item ) )
{
- return EnumActionResult.FAIL;
+ return ActionResultType.FAIL;
}
if( w.isAirBlock( offsetPos ) )
{
this.extractAEPower( item, 1600, Actionable.MODULATE );
w.playSound( p, offsetPos.getX() + 0.5D, offsetPos.getY() + 0.5D, offsetPos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE,
- SoundCategory.PLAYERS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
+ SoundCategory.PLAYERS, 1.0F, random.nextFloat() * 0.4F + 0.8F );
w.setBlockState( offsetPos, Blocks.FIRE.getDefaultState() );
}
- return EnumActionResult.SUCCESS;
+ return ActionResultType.SUCCESS;
}
}
}
- return EnumActionResult.PASS;
+ return ActionResultType.PASS;
}
}
diff --git a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java
index 397557b06..d1f55e228 100644
--- a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java
+++ b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java
@@ -22,25 +22,17 @@ package appeng.items.tools.powered;
import java.util.List;
import javax.annotation.Nullable;
-import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
-import net.minecraft.entity.passive.EntitySheep;
+import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ActionResult;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
-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.*;
+import net.minecraft.util.math.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -186,6 +178,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
Entity entity = null;
+ Vec3d entityIntersection = null;
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
@@ -205,16 +198,17 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final float f1 = 0.3F;
- final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
- final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
+ final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow( f1, f1, f1 );
+ final Vec3d intersection = boundingBox.rayTrace( Vec3d, Vec3d1 ).orElse(null);
- if( RayTraceResult != null )
+ if( intersection != null )
{
- final double nd = Vec3d.squareDistanceTo( RayTraceResult.hitVec );
+ final double nd = Vec3d.squareDistanceTo( intersection );
if( nd < closest )
{
entity = entity1;
+ entityIntersection = intersection;
closest = nd;
}
}
@@ -222,61 +216,66 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
}
}
- RayTraceResult pos = w.rayTraceBlocks( Vec3d, Vec3d1, false );
+ RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, p);
+ RayTraceResult pos = w.rayTraceBlocks( rayTraceContext );
final Vec3d vec = new Vec3d( d0, d1, d2 );
- if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
+ if( entity != null && pos.getType() != RayTraceResult.Type.MISS && pos.getHitVec().squareDistanceTo( vec ) > closest )
{
- pos = new RayTraceResult( entity );
+ pos = new EntityRayTraceResult( entity, entityIntersection );
}
- else if( entity != null && pos == null )
+ else if( entity != null && pos.getType() == RayTraceResult.Type.MISS )
{
- pos = new RayTraceResult( entity );
+ pos = new EntityRayTraceResult( entity, entityIntersection );
}
try
{
- AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
+ AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos.getType() == RayTraceResult.Type.MISS ? 32 : pos.getHitVec().squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
AELog.debug( err );
}
- if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
+ if( pos.getType() != RayTraceResult.Type.MISS && type != null && type.getItem() instanceof ItemPaintBall )
{
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
final AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
- if( pos.getType() == RayTraceResult.Type.ENTITY )
+ if( pos instanceof EntityRayTraceResult )
{
- final int id = pos.entityHit.getEntityId();
+ EntityRayTraceResult entityResult = (EntityRayTraceResult) pos;
+ Entity entityHit = entityResult.getEntity();
+
+ final int id = entityHit.getEntityId();
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
- if( pos.entityHit instanceof EntitySheep )
+ if( entityHit instanceof SheepEntity)
{
- final EntitySheep sh = (EntitySheep) pos.entityHit;
+ final SheepEntity sh = (SheepEntity) entityHit;
sh.setFleeceColor( col.dye );
}
- pos.entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
+ entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
NetworkHandler.instance().sendToAll( marker.getPacket() );
}
- else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
+ else if( pos instanceof BlockRayTraceResult )
{
- final Direction side = pos.sideHit;
- final BlockPos hitPos = pos.getBlockPos().offset( side );
+ BlockRayTraceResult blockResult = (BlockRayTraceResult) pos;
+ final Direction side = blockResult.getFace();
+ final BlockPos hitPos = blockResult.getPos().offset( side );
if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) )
{
return;
}
- final Block whatsThere = w.getBlockState( hitPos ).getBlock();
- if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
+ final BlockState whatsThere = w.getBlockState( hitPos );
+ if( whatsThere.getMaterial().isReplaceable() && w.isAirBlock( hitPos ) )
{
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock -> {
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
@@ -286,7 +285,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final TileEntity te = w.getTileEntity( hitPos );
if( te instanceof TilePaint )
{
- final Vec3d hp = pos.hitVec.subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
+ final Vec3d hp = pos.getHitVec().subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
( (TilePaint) te ).addBlot( type, side.getOpposite(), hp );
}
}
@@ -303,6 +302,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
Entity entity = null;
+ Vec3d entityIntersection = null;
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
@@ -310,7 +310,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
final Entity entity1 = (Entity) list.get( l );
- if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
+ if( entity1.isAlive() && entity1 != p && !( entity1 instanceof ItemEntity ) )
{
if( entity1.isAlive() )
{
@@ -322,16 +322,17 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final float f1 = 0.3F;
- final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
- final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
+ final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow( f1, f1, f1 );
+ final Vec3d intersection = boundingBox.rayTrace( Vec3d, Vec3d1 ).orElse(null);
- if( RayTraceResult != null )
+ if( intersection != null )
{
- final double nd = Vec3d.squareDistanceTo( RayTraceResult.hitVec );
+ final double nd = Vec3d.squareDistanceTo( intersection );
if( nd < closest )
{
entity = entity1;
+ entityIntersection = intersection;
closest = nd;
}
}
@@ -339,37 +340,40 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
}
}
+ RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, p);
final Vec3d vec = new Vec3d( d0, d1, d2 );
- RayTraceResult pos = w.rayTraceBlocks( Vec3d, Vec3d1, true );
- if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
+ RayTraceResult pos = w.rayTraceBlocks( rayTraceContext );
+ if( entity != null && pos.getType() != RayTraceResult.Type.MISS && pos.getHitVec().squareDistanceTo( vec ) > closest )
{
- pos = new RayTraceResult( entity );
+ pos = new EntityRayTraceResult( entity, entityIntersection );
}
- else if( entity != null && pos == null )
+ else if( entity != null && pos.getType() == RayTraceResult.Type.MISS )
{
- pos = new RayTraceResult( entity );
+ pos = new EntityRayTraceResult( entity, entityIntersection );
}
try
{
- AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
+ AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos.getType() == RayTraceResult.Type.MISS ? 32 : pos.getHitVec().squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
AELog.debug( err );
}
- if( pos != null )
+ if( pos.getType() != RayTraceResult.Type.MISS )
{
- final DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
- dmgSrc.damageType = "matter_cannon";
+ final DamageSource dmgSrc = new EntityDamageSource( "matter_cannon", p );
- if( pos.typeOfHit == RayTraceResult.Type.ENTITY )
+ if( pos instanceof EntityRayTraceResult )
{
+ EntityRayTraceResult entityResult = (EntityRayTraceResult) pos;
+ Entity entityHit = entityResult.getEntity();
+
final int dmg = (int) Math.ceil( penetration / 20.0f );
- if( pos.entityHit instanceof LivingEntity )
+ if( entityHit instanceof LivingEntity )
{
- final LivingEntity el = (LivingEntity) pos.entityHit;
+ final LivingEntity el = (LivingEntity) entityHit;
penetration -= dmg;
el.knockBack( p, 0, -direction.x, -direction.z );
// el.knockBack( p, 0, Vec3d.x,
@@ -380,37 +384,38 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
hasDestroyed = true;
}
}
- else if( pos.entityHit instanceof EntityItem )
+ else if( entityHit instanceof ItemEntity )
{
hasDestroyed = true;
- pos.entityHit.setDead();
+ entityHit.remove();
}
- else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
+ else if( entityHit.attackEntityFrom( dmgSrc, dmg ) )
{
hasDestroyed = true;
}
}
- else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
+ else if( pos instanceof BlockRayTraceResult )
{
+ BlockRayTraceResult blockResult = (BlockRayTraceResult) pos;
+
if( !AEConfig.instance().isFeatureEnabled( AEFeature.MASS_CANNON_BLOCK_DAMAGE ) )
{
penetration = 0;
}
else
{
- final BlockState bs = w.getBlockState( pos.getBlockPos() );
- // int meta = w.getBlockMetadata(
- // pos.blockX, pos.blockY, pos.blockZ );
+ BlockPos blockPos = blockResult.getPos();
+ final BlockState bs = w.getBlockState(blockPos);
- final float hardness = bs.getBlockHardness( w, pos.getBlockPos() ) * 9.0f;
+ final float hardness = bs.getBlockHardness( w, blockPos) * 9.0f;
if( hardness >= 0.0 )
{
- if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.getBlockPos() ), p ) )
+ if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, blockPos), p ) )
{
hasDestroyed = true;
penetration -= hardness;
penetration *= 0.60;
- w.destroyBlock( pos.getBlockPos(), true );
+ w.destroyBlock(blockPos, true );
}
}
}
diff --git a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java
index ecb3a1bb1..54b0c6fd4 100644
--- a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java
+++ b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java
@@ -27,7 +27,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
@@ -50,7 +50,7 @@ import appeng.api.util.AEPartLocation;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
-import appeng.core.sync.GuiBridge;
+
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.items.contents.PortableCellViewer;
@@ -68,17 +68,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public ActionResult onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
{
- Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
+ // FIXME Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
}
- @OnlyIn( Dist.CLIENT )
- @Override
- public boolean isFull3D()
- {
- return false;
- }
-
@Override
@OnlyIn( Dist.CLIENT )
public void addInformation(final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips )
@@ -145,7 +138,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
@Override
public String getUnlocalizedGroupName( final Set others, final ItemStack is )
{
- return GuiText.StorageCells.getUnlocalized();
+ return GuiText.StorageCells.getTranslationKey();
}
@Override
diff --git a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java
index cce3fe475..43e1ddb0c 100644
--- a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java
+++ b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java
@@ -30,6 +30,7 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -63,13 +64,6 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
}
- @OnlyIn( Dist.CLIENT )
- @Override
- public boolean isFull3D()
- {
- return false;
- }
-
@Override
@OnlyIn( Dist.CLIENT )
public void addInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips )
@@ -85,17 +79,17 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
if( encKey == null || encKey.isEmpty() )
{
- lines.add( GuiText.Unlinked.getLocal() );
+ lines.add( GuiText.Unlinked.textComponent() );
}
else
{
- lines.add( GuiText.Linked.getLocal() );
+ lines.add( GuiText.Linked.textComponent() );
}
}
}
else
{
- lines.add( I18n.format( "AppEng.GuiITooltip.Unlinked" ) );
+ lines.add( new TranslationTextComponent( "AppEng.GuiITooltip.Unlinked" ) );
}
}
diff --git a/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java b/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java
index b8293408e..a0efa3a52 100644
--- a/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java
+++ b/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java
@@ -23,11 +23,12 @@ import java.text.MessageFormat;
import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
-import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.api.distmarker.Dist;
@@ -50,7 +51,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
public AEBasePoweredItem( final double powerCapacity )
{
- super(new Properties().maxStackSize( 1 ).maxDamage( 32 ));
+ super(new Properties().maxStackSize( 1 ).maxDamage( 32 ).setNoRepair());
//FIXME
// this.hasSubtypes = false;
// this.setFull3D();
@@ -73,8 +74,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
final double percent = internalCurrentPower / internalMaxPower;
- lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
- .gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
+ lines.add( GuiText.StoredEnergy.textComponent().appendText( + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) )
+ .appendSibling( new TranslationTextComponent( PowerUnits.AE.unlocalizedName ) )
+ .appendText( " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) ) );
}
@Override
@@ -84,22 +86,15 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
- protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks )
- {
- super.getCheckedSubItems( creativeTab, itemStacks );
+ public void fillItemGroup(ItemGroup group, NonNullList items) {
+ super.fillItemGroup(group, items);
final ItemStack charged = new ItemStack( this, 1 );
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 );
- }
-
- @Override
- public boolean isRepairable()
- {
- return false;
+ items.add( charged );
}
@Override
diff --git a/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java b/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java
index 31ace0fa3..4edf4855c 100644
--- a/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java
+++ b/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java
@@ -21,12 +21,11 @@ package appeng.items.tools.powered.powersink;
import javax.annotation.Nullable;
-import net.darkhax.tesla.api.ITeslaConsumer;
-import net.darkhax.tesla.api.ITeslaHolder;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
import appeng.api.config.Actionable;
@@ -45,41 +44,21 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
private final IAEItemPowerStorage item;
- private final Object teslaAdapter;
-
PoweredItemCapabilities( ItemStack is, IAEItemPowerStorage item )
{
this.is = is;
this.item = item;
- if( Capabilities.TESLA_CONSUMER != null || Capabilities.TESLA_HOLDER != null )
- {
- this.teslaAdapter = new TeslaAdapter();
- }
- else
- {
- this.teslaAdapter = null;
- }
- }
-
- @Override
- public boolean hasCapability( Capability> capability, @Nullable Direction facing )
- {
- return capability == Capabilities.FORGE_ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
}
@SuppressWarnings( "unchecked" )
@Override
- public T getCapability( Capability capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
if( capability == Capabilities.FORGE_ENERGY )
{
- return (T) this;
+ return (LazyOptional) LazyOptional.of(() -> this);
}
- else if( capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER )
- {
- return (T) this.teslaAdapter;
- }
- return null;
+ return LazyOptional.empty();
}
@Override
@@ -121,25 +100,4 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
return true;
}
- private class TeslaAdapter implements ITeslaConsumer, ITeslaHolder
- {
-
- @Override
- public long givePower( long power, boolean simulated )
- {
- return PoweredItemCapabilities.this.receiveEnergy( (int) power, simulated );
- }
-
- @Override
- public long getStoredPower()
- {
- return PoweredItemCapabilities.this.getEnergyStored();
- }
-
- @Override
- public long getCapacity()
- {
- return PoweredItemCapabilities.this.getMaxEnergyStored();
- }
- }
}
diff --git a/src/main/java/appeng/me/Grid.java b/src/main/java/appeng/me/Grid.java
index 2691b1b56..65dbb22dc 100644
--- a/src/main/java/appeng/me/Grid.java
+++ b/src/main/java/appeng/me/Grid.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridHost;
diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java
index 3794a7c59..546231bb7 100644
--- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java
+++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java
@@ -33,6 +33,7 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
+import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fml.hooks.BasicEventHooks;
@@ -94,7 +95,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private final List status = new ArrayList<>();
private final HashMap, Object> listeners = new HashMap<>();
private ICraftingLink myLastLink;
- private String myName = "";
+ private ITextComponent myName = null;
private boolean isDestroyed = false;
/**
* crafting job info
@@ -971,7 +972,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
@Override
- public String getName()
+ public ITextComponent getName()
{
return this.myName;
}
@@ -1258,19 +1259,19 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void updateName()
{
- this.myName = "";
+ this.myName = null;
for( final TileCraftingTile te : this.tiles )
{
if( te.hasCustomInventoryName() )
{
- if( this.myName.length() > 0 )
+ if( this.myName != null )
{
- this.myName += ' ' + te.getCustomInventoryName();
+ this.myName.appendText(" ").appendSibling(te.getCustomInventoryName());
}
else
{
- this.myName = te.getCustomInventoryName();
+ this.myName = te.getCustomInventoryName().shallowCopy();
}
}
}
diff --git a/src/main/java/appeng/me/helpers/AENetworkProxy.java b/src/main/java/appeng/me/helpers/AENetworkProxy.java
index 7905ca0db..c819fb11e 100644
--- a/src/main/java/appeng/me/helpers/AENetworkProxy.java
+++ b/src/main/java/appeng/me/helpers/AENetworkProxy.java
@@ -24,6 +24,7 @@ import java.util.EnumSet;
import appeng.core.Api;
import appeng.core.worlddata.WorldData;
+import appeng.me.cache.P2PCache;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.PlayerEntity;
@@ -108,13 +109,13 @@ public class AENetworkProxy implements IGridBlock
}
}
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
this.isReady = false;
- this.invalidate();
+ this.remove();
}
- public void invalidate()
+ public void remove()
{
this.isReady = false;
if( this.node != null )
@@ -240,23 +241,23 @@ public class AENetworkProxy implements IGridBlock
return pg;
}
-// FIXME public P2PCache getP2P() throws GridAccessException
-// FIXME {
-// FIXME final IGrid grid = this.getGrid();
-// FIXME if( grid == null )
-// FIXME {
-// FIXME throw new GridAccessException();
-// FIXME }
-// FIXME
-// FIXME final P2PCache pg = grid.getCache( P2PCache.class );
-// FIXME
-// FIXME if( pg == null )
-// FIXME {
-// FIXME throw new GridAccessException();
-// FIXME }
-// FIXME
-// FIXME return pg;
-// FIXME }
+ public P2PCache getP2P() throws GridAccessException
+ {
+ final IGrid grid = this.getGrid();
+ if( grid == null )
+ {
+ throw new GridAccessException();
+ }
+
+ final P2PCache pg = grid.getCache( P2PCache.class );
+
+ if( pg == null )
+ {
+ throw new GridAccessException();
+ }
+
+ return pg;
+ }
public ISecurityGrid getSecurity() throws GridAccessException
{
diff --git a/src/main/java/appeng/parts/AEBasePart.java b/src/main/java/appeng/parts/AEBasePart.java
index 27236d10d..d8eed6be1 100644
--- a/src/main/java/appeng/parts/AEBasePart.java
+++ b/src/main/java/appeng/parts/AEBasePart.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Optional;
import java.util.Random;
+import appeng.core.Api;
import com.google.common.base.Preconditions;
import net.minecraft.crash.CrashReportCategory;
@@ -40,6 +41,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -185,7 +187,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
- public String getCustomInventoryName()
+ public ITextComponent getCustomInventoryName()
{
return this.getItemStack().getDisplayName();
}
@@ -198,7 +200,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
public void addEntityCrashInfo( final CrashReportCategory crashreportcategory )
{
- crashreportcategory.addCrashSection( "Part Side", this.getSide() );
+ crashreportcategory.addDetail( "Part Side", this.getSide() );
}
@Override
@@ -207,7 +209,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
if( type == PartItemStack.NETWORK )
{
final ItemStack copy = this.is.copy();
- copy.setTagCompound( null );
+ copy.setTag( null );
return copy;
}
return this.is;
@@ -282,7 +284,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public void removeFromWorld()
{
- this.proxy.invalidate();
+ this.proxy.remove();
}
@Override
@@ -368,7 +370,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
if( this instanceof IPriorityHost )
{
final IPriorityHost pHost = (IPriorityHost) this;
- pHost.setPriority( compound.getInteger( "priority" ) );
+ pHost.setPriority( compound.getInt( "priority" ) );
}
final IItemHandler inv = this.getInventoryByName( "config" );
@@ -404,7 +406,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
if( this instanceof IPriorityHost )
{
final IPriorityHost pHost = (IPriorityHost) this;
- output.setInteger( "priority", pHost.getPriority() );
+ output.putInt( "priority", pHost.getPriority() );
}
final IItemHandler inv = this.getInventoryByName( "config" );
diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java
index 5ff5be58f..b63c8e7ac 100644
--- a/src/main/java/appeng/parts/CableBusContainer.java
+++ b/src/main/java/appeng/parts/CableBusContainer.java
@@ -1285,9 +1285,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
final ItemStack textureItem = facade.getTextureItem();
final BlockState blockState = facade.getBlockState();
- if( blockState != null && textureItem != null )
+ World world = getTile().getWorld();
+ if( blockState != null && textureItem != null && world != null )
{
- return new FacadeRenderState( blockState, !facade.getBlockState().isOpaqueCube() );
+ return new FacadeRenderState( blockState, !facade.getBlockState().isOpaqueCube(world, getTile().getPos()) );
}
}
diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java
index b6b85a100..db3227f4a 100644
--- a/src/main/java/appeng/parts/PartPlacement.java
+++ b/src/main/java/appeng/parts/PartPlacement.java
@@ -19,43 +19,12 @@
package appeng.parts;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockState;
-import net.minecraft.block.SoundType;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.BlockItem;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ActionResult;
-import net.minecraft.util.ActionResultType;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
-import net.minecraft.util.SoundCategory;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.RayTraceResult;
-import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.World;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.TickEvent;
-import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
-import net.minecraftforge.event.entity.player.PlayerInteractEvent;
-import net.minecraftforge.eventbus.api.SubscribeEvent;
-
-import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IItems;
-import appeng.api.parts.IFacadePart;
-import appeng.api.parts.IPartHost;
-import appeng.api.parts.IPartItem;
-import appeng.api.parts.PartItemStack;
-import appeng.api.parts.SelectedPart;
+import appeng.api.parts.*;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
+import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
@@ -63,6 +32,25 @@ import appeng.core.sync.packets.PacketPartPlacement;
import appeng.facade.IFacadeItem;
import appeng.util.LookDirection;
import appeng.util.Platform;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.block.SoundType;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.*;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraft.util.math.*;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.TickEvent;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
public class PartPlacement
@@ -79,6 +67,14 @@ public class PartPlacement
return ActionResultType.FAIL;
}
+ // FIXME: This was changed alot.
+ final LookDirection dir = Platform.getPlayerRay( player );
+ RayTraceContext rtc = new RayTraceContext(dir.getA(), dir.getB(), RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player);
+ final BlockRayTraceResult mop = world.rayTraceBlocks( rtc );
+ BlockItemUseContext useContext = new BlockItemUseContext(new ItemUseContext(
+ player, hand, mop
+ ));
+
if( !held.isEmpty() && Platform.isWrench( player, held, pos ) && player.isCrouching() )
{
if( !Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
@@ -86,7 +82,6 @@ public class PartPlacement
return ActionResultType.FAIL;
}
- final Block block = world.getBlockState( pos ).getBlock();
final TileEntity tile = world.getTileEntity( pos );
IPartHost host = null;
@@ -99,14 +94,11 @@ public class PartPlacement
{
if( !world.isRemote )
{
- final LookDirection dir = Platform.getPlayerRay( player );
- final RayTraceResult mop = block.getRayTraceResult( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB(), mop );
-
- if( mop != null )
+ if( mop.getType() == RayTraceResult.Type.BLOCK )
{
final List is = new ArrayList<>();
final SelectedPart sp = selectPart( player, host,
- mop.getHitVec().addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
+ mop.getHitVec().add( -mop.getPos().getX(), -mop.getPos().getY(), -mop.getPos().getZ() ) );
if( sp.part != null )
{
@@ -163,7 +155,7 @@ public class PartPlacement
{
if( host.getPart( AEPartLocation.INTERNAL ) == null )
{
- return ActionResult.resultFail( null );
+ return ActionResultType.FAIL;
}
if( host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@@ -182,7 +174,7 @@ public class PartPlacement
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) );
}
}
- return ActionResult.resultConsume( null );
+ return ActionResultType.CONSUME;
}
}
}
@@ -190,34 +182,30 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
- return ActionResult.resultSuccess( null );
+ return ActionResultType.SUCCESS;
}
}
- return ActionResult.resultFail( null );
+ return ActionResultType.FAIL;
}
}
if( held.isEmpty() )
{
- final Block block = world.getBlockState( pos ).getBlock();
- if( host != null && player.isCrouching() && block != null )
+ if( host != null && player.isCrouching() && world.isAirBlock(pos) )
{
- final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
- final RayTraceResult mop = block.getRayTraceResult( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB(), mop );
-
- if( mop != null )
+ if( mop.getType() == RayTraceResult.Type.BLOCK )
{
- mop.set = mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() );
- final SelectedPart sPart = selectPart( player, host, mop.hitVec );
+ Vec3d hitVec = mop.getHitVec().add(-mop.getPos().getX(), -mop.getPos().getY(), -mop.getPos().getZ());
+ final SelectedPart sPart = selectPart( player, host, hitVec );
if( sPart != null && sPart.part != null )
{
- if( sPart.part.onShiftActivate( player, hand, mop.hitVec ) )
+ if( sPart.part.onShiftActivate( player, hand, hitVec ) )
{
if( world.isRemote )
{
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
- return ActionResult.resultSuccess( null );
+ return ActionResultType.SUCCESS;
}
}
}
@@ -226,7 +214,7 @@ public class PartPlacement
if( held.isEmpty() || !( held.getItem() instanceof IPartItem ) )
{
- return ActionResult.resultPass( null );
+ return ActionResultType.PASS;
}
BlockPos te_pos = pos;
@@ -236,8 +224,9 @@ public class PartPlacement
{
Direction offset = null;
- final Block blkID = world.getBlockState( pos ).getBlock();
- if( blkID != null && !blkID.isReplaceable( world, pos ) )
+ BlockState blockState = world.getBlockState(pos);
+ // FIXME isReplacable on the block state allows for more control, but requires an item use context
+ if( !blockState.isAir(world, pos) && !blockState.isReplaceable(useContext) )
{
offset = side;
if( Platform.isServer() )
@@ -260,11 +249,15 @@ public class PartPlacement
final boolean hostIsNotPresent = host == null;
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartBlockItem.isPresent();
- final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_pos );
+ BlockState multiPartBlockState = maybeMultiPartBlock.get().getDefaultState();
+ final boolean canMultiPartBePlaced = multiPartBlockState.isValidPosition(world, te_pos);
+ // We cannot override the item stack of normal use context, so we use this hack
+ BlockItemUseContext mpUseCtx = new BlockItemUseContext(new DirectionalPlaceContext(world, te_pos, side, maybeMultiPartStack.get(), side));
+
+ // FIXME: This is super-fishy and all needs to be re-checked. what does this even do???
if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartBlockItem.get()
- .placeBlockAt( maybeMultiPartStack.get(), player,
- world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) )
+ .tryPlace( mpUseCtx ) == ActionResultType.SUCCESS )
{
if( !world.isRemote )
{
@@ -281,18 +274,18 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
- return ActionResult.resultSuccess( null );
+ return ActionResultType.SUCCESS;
}
}
else if( host != null && !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
- return ActionResult.resultFail( null );
+ return ActionResultType.FAIL;
}
}
if( host == null )
{
- return ActionResult.resultPass( null );
+ return ActionResultType.PASS;
}
if( !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@@ -301,33 +294,30 @@ public class PartPlacement
{
te_pos = pos.offset( side );
- final Block blkID = world.getBlockState( te_pos ).getBlock();
+ final BlockState blkState = world.getBlockState( te_pos );
- if( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null )
+ // FIXME: this is always true (host was de-referenced above)
+ if( blkState.isAir(world, te_pos) || blkState.isReplaceable( useContext ) || host != null )
{
return place( held, te_pos, side.getOpposite(), player, hand, world,
pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}
}
- return ActionResult.resultPass( null );
+ return ActionResultType.PASS;
}
if( !world.isRemote )
{
- final BlockState state = world.getBlockState( pos );
- final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
- final RayTraceResult mop = state.getBlock().collisionRayTrace( state, world, pos, dir.getA(), dir.getB() );
-
- if( mop != null )
+ if( mop.getType() != RayTraceResult.Type.MISS )
{
final SelectedPart sp = selectPart( player, host,
- mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
+ mop.getHitVec().add( -mop.getPos().getX(), -mop.getPos().getY(), -mop.getPos().getZ() ) );
if( sp.part != null )
{
- if( !player.isCrouching() && sp.part.onActivate( player, hand, mop.hitVec ) )
+ if( !player.isCrouching() && sp.part.onActivate( player, hand, mop.getHitVec() ) )
{
- return ActionResult.resultFail( null );
+ return ActionResultType.FAIL;
}
}
}
@@ -335,7 +325,7 @@ public class PartPlacement
final DimensionalCoord dc = host.getLocation();
if( !Platform.hasPermissions( dc, player ) )
{
- return ActionResult.resultFail( null );
+ return ActionResultType.FAIL;
}
final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player, hand );
@@ -343,7 +333,8 @@ public class PartPlacement
{
multiPart.maybeBlock().ifPresent( multiPartBlock ->
{
- final SoundType ss = multiPartBlock.getSoundType( state, world, pos, player );
+ BlockState blockState = world.getBlockState(pos);
+ final SoundType ss = multiPartBlock.getSoundType( blockState, world, pos, player );
world.playSound( null, pos, ss.getPlaceSound(), SoundCategory.BLOCKS, ( ss.getVolume() + 1.0F ) / 2.0F, ss.getPitch() * 0.8F );
} );
@@ -363,7 +354,7 @@ public class PartPlacement
{
player.swingArm( hand );
}
- return ActionResult.resultSuccess( null );
+ return ActionResultType.SUCCESS;
}
private static float getEyeOffset( final PlayerEntity p )
@@ -420,10 +411,12 @@ public class PartPlacement
final double d0 = mc.playerController.getBlockReachDistance();
final Vec3d vec3 = mc.getRenderViewEntity().getEyePosition( f );
- if( mop != null && mop.getHitVec().distanceTo( vec3 ) < d0 )
+ if( mop instanceof BlockRayTraceResult && mop.getHitVec().distanceTo( vec3 ) < d0 )
{
+ BlockRayTraceResult brtr = (BlockRayTraceResult) mop;
+
final World w = event.getEntity().world;
- final TileEntity te = w.getTileEntity( mop.getBlockPos() );
+ final TileEntity te = w.getTileEntity( brtr.getPos() );
if( te instanceof IPartHost && this.wasCanceled )
{
event.setCanceled( true );
@@ -454,7 +447,7 @@ public class PartPlacement
final ItemStack held = event.getPlayer().getHeldItem( event.getHand() );
if( place( held, event.getPos(), event.getFace(), event.getPlayer(), event.getHand(), event.getPlayer().world,
- PlaceType.INTERACT_FIRST_PASS, 0 ) == ActionResult.resultSuccess( null ) )
+ PlaceType.INTERACT_FIRST_PASS, 0 ) == ActionResultType.SUCCESS )
{
event.setCanceled( true );
this.wasCanceled = true;
diff --git a/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java b/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java
index 205c6a7f0..f8a60480e 100644
--- a/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java
+++ b/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java
@@ -191,7 +191,7 @@ public abstract class PartAbstractFormationPlane> extends
final BlockPos tePos = te.getPos().offset( side.getFacing() );
- this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos );
+ this.blocked = !w.getBlockState( tePos ).getMaterial().isReplaceable();
}
}
diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java
index 81b5267ba..e92837f79 100644
--- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java
+++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java
@@ -19,6 +19,7 @@
package appeng.parts.automation;
+import java.util.Collections;
import java.util.List;
import com.google.common.collect.Lists;
@@ -29,6 +30,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
+import net.minecraft.item.Items;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
@@ -69,6 +71,11 @@ import appeng.parts.PartBasicState;
import appeng.util.IWorldCallable;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
+import net.minecraft.world.storage.loot.LootContext;
+import net.minecraft.world.storage.loot.LootParameters;
+import net.minecraftforge.common.ToolType;
+import net.minecraftforge.common.util.FakePlayer;
+import net.minecraftforge.common.util.FakePlayerFactory;
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, IWorldCallable
@@ -478,8 +485,23 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
protected List obtainBlockDrops( final ServerWorld w, final BlockPos pos )
{
- final ItemStack[] out = Platform.getBlockDrops( w, pos );
- return Lists.newArrayList( out );
+ final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
+ final BlockState state = w.getBlockState( pos );
+ ItemStack harvestTool = createHarvestTool(state);
+
+ // In case the block does NOT allow us to harvest it without a tool, or the proper tool,
+ // do not return anything.
+ if (harvestTool == null && !state.getMaterial().isToolNotRequired()) {
+ return Collections.emptyList();
+ }
+
+ LootContext.Builder lootContext = new LootContext.Builder(w)
+ .withRandom(w.rand)
+ .withParameter(LootParameters.POSITION, pos)
+ .withNullableParameter(LootParameters.TOOL, harvestTool)
+ .withNullableParameter(LootParameters.THIS_ENTITY, fakePlayer)
+ .withNullableParameter(LootParameters.BLOCK_ENTITY, w.getTileEntity(pos));
+ return state.getDrops(lootContext);
}
/**
@@ -569,4 +591,24 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
return MODELS.getModel( this.getConnections(), this.isPowered(), this.isActive() );
}
+
+ /**
+ * Creates the fake (and temporary) tool that will be used to calculate the loot tables of
+ * a block this plane wants to break.
+ * @param state The state of the block about to be broken.
+ */
+ protected ItemStack createHarvestTool(BlockState state) {
+ // Try to use the right tool...
+ ToolType harvestToolType = state.getBlock().getHarvestTool(state);
+ if (harvestToolType == ToolType.AXE) {
+ return new ItemStack(Items.DIAMOND_AXE, 1);
+ } else if (harvestToolType == ToolType.SHOVEL) {
+ return new ItemStack(Items.DIAMOND_SHOVEL, 1);
+ } else if (harvestToolType == ToolType.PICKAXE) {
+ return new ItemStack(Items.DIAMOND_PICKAXE, 1);
+ } else {
+ return null;
+ }
+ }
+
}
diff --git a/src/main/java/appeng/parts/automation/PartExportBus.java b/src/main/java/appeng/parts/automation/PartExportBus.java
index 6f57d252c..167c45397 100644
--- a/src/main/java/appeng/parts/automation/PartExportBus.java
+++ b/src/main/java/appeng/parts/automation/PartExportBus.java
@@ -57,7 +57,7 @@ import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.MultiCraftingTracker;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
@@ -220,7 +220,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS );
}
return true;
}
diff --git a/src/main/java/appeng/parts/automation/PartFormationPlane.java b/src/main/java/appeng/parts/automation/PartFormationPlane.java
index 5654ff120..aaf2b8b69 100644
--- a/src/main/java/appeng/parts/automation/PartFormationPlane.java
+++ b/src/main/java/appeng/parts/automation/PartFormationPlane.java
@@ -24,30 +24,23 @@ import java.util.Collections;
import java.util.List;
import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.block.Blocks;
-import net.minecraft.item.Item;
-import net.minecraft.item.BlockItem;
-import net.minecraft.item.BlockItemSpecial;
-import net.minecraft.item.ItemFirework;
-import net.minecraft.item.ItemSkull;
-import net.minecraft.item.ItemStack;
+import net.minecraft.item.*;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.EnumActionResult;
+import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
-import net.minecraft.world.WorldServer;
+import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.items.IItemHandler;
-import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -70,7 +63,7 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.AEPartLocation;
import appeng.core.AEConfig;
import appeng.core.Api;
-import appeng.core.sync.GuiBridge;
+
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.storage.MEInventoryHandler;
@@ -80,6 +73,8 @@ import appeng.util.inv.InvOperation;
import appeng.util.prioritylist.FuzzyPriorityList;
import appeng.util.prioritylist.PrecisePriorityList;
+import javax.annotation.Nullable;
+
public class PartFormationPlane extends PartAbstractFormationPlane
{
@@ -200,7 +195,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_FORMATION_PLANE );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_FORMATION_PLANE );
}
return true;
}
@@ -237,14 +232,13 @@ public class PartFormationPlane extends PartAbstractFormationPlane
final World w = te.getWorld();
final AEPartLocation side = this.getSide();
- final BlockPos tePos = te.getPos().offset( side.getFacing() );
+ final BlockPos placePos = te.getPos().offset( side.getFacing() );
- if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
+ if( w.getBlockState( placePos ).getMaterial().isReplaceable() )
{
- if( placeBlock == YesNo.YES && ( i instanceof BlockItem || i instanceof BlockItemSpecial || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item
- .getItemFromBlock( Blocks.REEDS ) ) )
+ if( placeBlock == YesNo.YES && ( i instanceof BlockItem || i instanceof IPlantable || i instanceof FireworkStarItem || i instanceof FireworkRocketItem || i instanceof IPartItem ) )
{
- final PlayerEntity player = Platform.getPlayer( (WorldServer) w );
+ final PlayerEntity player = Platform.getPlayer( (ServerWorld) w );
Platform.configurePlayer( player, side, this.getTile() );
Hand hand = player.getActiveHand();
player.setHeldItem( hand, is );
@@ -253,38 +247,44 @@ public class PartFormationPlane extends PartAbstractFormationPlane
worked = true;
if( type == Actionable.MODULATE )
{
- if( i instanceof IPlantable || i instanceof ItemSkull || i == Item.getItemFromBlock( Blocks.REEDS ) )
+ // The side the plane is attached to will be considered the look direction
+ // in terms of placing an item
+ Direction lookDirection = side.getFacing();
+
+ // FIXME No idea what any of this is _supposed_ to do, comment badly needed
+ if ( i instanceof IPlantable || i instanceof WallOrFloorItem )
{
boolean Worked = false;
+ // Up or Down, Attempt 1??
if( side.xOffset == 0 && side.zOffset == 0 )
{
- Worked = i.onItemUse( player, w, tePos.offset( side.getFacing() ), hand, side.getFacing().getOpposite(), side.xOffset,
- side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
+ Worked = i.onItemUse( new DirectionalPlaceContext(w, placePos.offset( side.getFacing() ), lookDirection, is, side.getFacing()) ) == ActionResultType.SUCCESS;
}
+ // Up or Down, Attempt 2??
if( !Worked && side.xOffset == 0 && side.zOffset == 0 )
{
- Worked = i.onItemUse( player, w, tePos.offset( side.getFacing().getOpposite() ), hand, side.getFacing(), side.xOffset,
- side.yOffset, side.zOffset ) == EnumActionResult.SUCCESS;
+ Worked = i.onItemUse( new DirectionalPlaceContext(w, placePos.offset( side.getFacing().getOpposite() ), lookDirection, is, side.getFacing().getOpposite()) )
+ == ActionResultType.SUCCESS;
}
+ // Horizontal, attempt 1??
if( !Worked && side.yOffset == 0 )
{
- Worked = i.onItemUse( player, w, tePos.offset( Direction.DOWN ), hand, Direction.UP, side.xOffset, side.yOffset,
- side.zOffset ) == EnumActionResult.SUCCESS;
+ Worked = i.onItemUse( new DirectionalPlaceContext(w, placePos.offset( Direction.DOWN ), lookDirection, is, Direction.DOWN) ) == ActionResultType.SUCCESS;
}
if( !Worked )
{
- i.onItemUse( player, w, tePos, hand, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
+ i.onItemUse( new DirectionalPlaceContext(w, placePos, lookDirection, is, lookDirection.getOpposite()) );
}
maxStorage -= is.getCount();
}
else
{
- i.onItemUse( player, w, tePos, hand, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
+ i.onItemUse( new DirectionalPlaceContext(w, placePos, lookDirection, is, lookDirection.getOpposite()) );
maxStorage -= is.getCount();
}
}
@@ -300,7 +300,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane
{
worked = true;
- final int sum = this.countEntitesAround( w, tePos );
+ final int sum = this.countEntitesAround( w, placePos );
if( sum < AEConfig.instance().getFormationPlaneEntityLimit() )
{
@@ -344,7 +344,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane
}
}
- this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos );
+ this.blocked = !w.getBlockState( placePos ).getMaterial().isReplaceable();
if( worked )
{
@@ -378,11 +378,11 @@ public class PartFormationPlane extends PartAbstractFormationPlane
return Api.INSTANCE.definitions().parts().formationPlane().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_FORMATION_PLANE;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_FORMATION_PLANE;
+// FIXME }
private int countEntitesAround( World world, BlockPos pos )
{
@@ -391,4 +391,11 @@ public class PartFormationPlane extends PartAbstractFormationPlane
return list.size();
}
+
+ private class ForcedItemUseContext extends ItemUseContext {
+ protected ForcedItemUseContext(World worldIn, @Nullable PlayerEntity player, Hand handIn, ItemStack heldItem, BlockRayTraceResult rayTraceResultIn) {
+ super(worldIn, player, handIn, heldItem, rayTraceResultIn);
+ }
+ }
+
}
diff --git a/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java
index 44af72097..adaf37381 100644
--- a/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java
+++ b/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java
@@ -19,25 +19,21 @@
package appeng.parts.automation;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.block.BlockState;
-import net.minecraft.item.Items;
-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.ServerWorld;
-import net.minecraft.world.server.ServerWorld;
-import net.minecraftforge.common.util.FakePlayer;
-import net.minecraftforge.common.util.FakePlayerFactory;
-
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AEPartLocation;
import appeng.items.parts.PartModels;
+import com.google.common.collect.ImmutableMap;
+import net.minecraft.block.BlockState;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.enchantment.Enchantments;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.server.ServerWorld;
+
+import java.util.List;
public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
@@ -78,32 +74,17 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
- protected List obtainBlockDrops(final ServerWorld w, final BlockPos pos )
- {
- final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
- final BlockState state = w.getBlockState( pos );
+ protected ItemStack createHarvestTool(BlockState state) {
+ ItemStack harvestTool = super.createHarvestTool(state);
- if( state.getBlock().canSilkHarvest( w, pos, state, fakePlayer ) )
- {
- final List out = new ArrayList<>( 1 );
- final Item item = Item.getItemFromBlock( state.getBlock() );
+ // For silk touch purposes, enchant the fake tool
+ if (harvestTool != null) {
+ EnchantmentHelper.setEnchantments(ImmutableMap.of(
+ Enchantments.SILK_TOUCH, 1
+ ), harvestTool);
+ }
- if( item != Items.AIR )
- {
- int meta = 0;
- if( item.getHasSubtypes() )
- {
- meta = state.getBlock().getMetaFromState( state );
- }
- final ItemStack itemstack = new ItemStack( item, 1, meta );
- out.add( itemstack );
- }
- return out;
- }
- else
- {
- return super.obtainBlockDrops( w, pos );
- }
+ return harvestTool;
}
@Override
diff --git a/src/main/java/appeng/parts/automation/PartImportBus.java b/src/main/java/appeng/parts/automation/PartImportBus.java
index 811ac698f..50a701204 100644
--- a/src/main/java/appeng/parts/automation/PartImportBus.java
+++ b/src/main/java/appeng/parts/automation/PartImportBus.java
@@ -26,7 +26,6 @@ import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
-import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode;
@@ -47,7 +46,6 @@ import appeng.api.util.AECableType;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
-import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
@@ -133,7 +131,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS );
}
return true;
}
diff --git a/src/main/java/appeng/parts/automation/PartLevelEmitter.java b/src/main/java/appeng/parts/automation/PartLevelEmitter.java
index 28ebcea1e..ad8c46656 100644
--- a/src/main/java/appeng/parts/automation/PartLevelEmitter.java
+++ b/src/main/java/appeng/parts/automation/PartLevelEmitter.java
@@ -72,7 +72,7 @@ import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
@@ -461,7 +461,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_LEVEL_EMITTER );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_LEVEL_EMITTER );
}
return true;
}
diff --git a/src/main/java/appeng/parts/misc/PartInterface.java b/src/main/java/appeng/parts/misc/PartInterface.java
index 698a92b06..f9bbba72f 100644
--- a/src/main/java/appeng/parts/misc/PartInterface.java
+++ b/src/main/java/appeng/parts/misc/PartInterface.java
@@ -34,6 +34,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
@@ -59,7 +60,7 @@ import appeng.api.util.AECableType;
import appeng.api.util.IConfigManager;
import appeng.core.Api;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
@@ -176,7 +177,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
{
if( Platform.isServer() )
{
- Platform.openGUI( p, this.getTileEntity(), this.getSide(), GuiBridge.GUI_INTERFACE );
+ // FIXME Platform.openGUI( p, this.getTileEntity(), this.getSide(), GuiBridge.GUI_INTERFACE );
}
return true;
}
@@ -295,13 +296,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
- public boolean hasCapability( Capability> capabilityClass )
- {
- return this.duality.hasCapability( capabilityClass, this.getSide().getFacing() );
- }
-
- @Override
- public T getCapability( Capability capabilityClass )
+ public LazyOptional getCapability(Capability capabilityClass )
{
return this.duality.getCapability( capabilityClass, this.getSide().getFacing() );
}
@@ -312,9 +307,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
return Api.INSTANCE.definitions().parts().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_INTERFACE;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_INTERFACE;
+// FIXME }
}
diff --git a/src/main/java/appeng/parts/misc/PartStorageBus.java b/src/main/java/appeng/parts/misc/PartStorageBus.java
index 91cb89ef3..6760e8c79 100644
--- a/src/main/java/appeng/parts/misc/PartStorageBus.java
+++ b/src/main/java/appeng/parts/misc/PartStorageBus.java
@@ -76,7 +76,7 @@ import appeng.capabilities.Capabilities;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
import appeng.helpers.Reflected;
@@ -316,7 +316,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS );
}
return true;
}
@@ -646,9 +646,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return Api.INSTANCE.definitions().parts().storageBus().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_STORAGEBUS;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_STORAGEBUS;
+// FIXME }
}
diff --git a/src/main/java/appeng/parts/misc/PartToggleBus.java b/src/main/java/appeng/parts/misc/PartToggleBus.java
index f43f5de3f..e1e52c1a9 100644
--- a/src/main/java/appeng/parts/misc/PartToggleBus.java
+++ b/src/main/java/appeng/parts/misc/PartToggleBus.java
@@ -30,7 +30,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
-import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnectionException;
import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridNode;
@@ -140,7 +139,7 @@ public class PartToggleBus extends PartBasicState
public void removeFromWorld()
{
super.removeFromWorld();
- this.getOuterProxy().invalidate();
+ this.getOuterProxy().remove();
}
@Override
diff --git a/src/main/java/appeng/parts/networking/PartQuartzFiber.java b/src/main/java/appeng/parts/networking/PartQuartzFiber.java
index 46a0965e3..bcc2d11ee 100644
--- a/src/main/java/appeng/parts/networking/PartQuartzFiber.java
+++ b/src/main/java/appeng/parts/networking/PartQuartzFiber.java
@@ -95,7 +95,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
public void removeFromWorld()
{
super.removeFromWorld();
- this.outerProxy.invalidate();
+ this.outerProxy.remove();
}
@Override
diff --git a/src/main/java/appeng/parts/p2p/PartP2PFEPower.java b/src/main/java/appeng/parts/p2p/PartP2PFEPower.java
index af0cc3a01..8579ea07c 100644
--- a/src/main/java/appeng/parts/p2p/PartP2PFEPower.java
+++ b/src/main/java/appeng/parts/p2p/PartP2PFEPower.java
@@ -82,27 +82,18 @@ public class PartP2PFEPower extends PartP2PTunnel
return energyStorageOpt.orElse( NULL_ENERGY_STORAGE );
}
- @Override
- public boolean hasCapability( @Nonnull Capability> capability )
- {
- if( capability == Capabilities.FORGE_ENERGY )
- {
- return true;
- }
- return super.hasCapability( capability );
- }
-
+ @SuppressWarnings("unchecked")
@Nullable
@Override
- public T getCapability( @Nonnull Capability capability )
+ public LazyOptional getCapability( @Nonnull Capability capability )
{
if( capability == Capabilities.FORGE_ENERGY )
{
if( this.isOutput() )
{
- return (T) this.outputHandler;
+ return (LazyOptional) LazyOptional.of(() -> this.outputHandler);
}
- return (T) this.inputHandler;
+ return (LazyOptional) LazyOptional.of(() ->this.inputHandler);
}
return super.getCapability( capability );
}
diff --git a/src/main/java/appeng/parts/p2p/PartP2PFluids.java b/src/main/java/appeng/parts/p2p/PartP2PFluids.java
index 468e5651b..3938d6013 100644
--- a/src/main/java/appeng/parts/p2p/PartP2PFluids.java
+++ b/src/main/java/appeng/parts/p2p/PartP2PFluids.java
@@ -31,6 +31,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.FluidTankProperties;
@@ -91,23 +92,13 @@ public class PartP2PFluids extends PartP2PTunnel implements IFlui
}
}
+ @SuppressWarnings("unchecked")
@Override
- public boolean hasCapability( Capability> capabilityClass )
+ public LazyOptional getCapability(Capability capabilityClass )
{
if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
- return true;
- }
-
- return super.hasCapability( capabilityClass );
- }
-
- @Override
- public T getCapability( Capability capabilityClass )
- {
- if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
- {
- return (T) this;
+ return (LazyOptional) LazyOptional.of(() ->this);
}
return super.getCapability( capabilityClass );
diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java
index 71ac80718..37d826c26 100644
--- a/src/main/java/appeng/parts/p2p/PartP2PItems.java
+++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java
@@ -28,6 +28,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
@@ -230,24 +231,13 @@ public class PartP2PItems extends PartP2PTunnel implements IItemHa
}
}
- @Override
- public boolean hasCapability( Capability> capabilityClass )
- {
- if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
- {
- return true;
- }
-
- return super.hasCapability( capabilityClass );
- }
-
@SuppressWarnings( "unchecked" )
@Override
- public T getCapability( Capability capabilityClass )
+ public LazyOptional getCapability(Capability capabilityClass )
{
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
{
- return (T) this;
+ return (LazyOptional) LazyOptional.of(() ->this);
}
return super.getCapability( capabilityClass );
diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java
index d9fc5d812..ef6b83e7d 100644
--- a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java
+++ b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java
@@ -30,7 +30,6 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
-import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnectionException;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridNode;
@@ -114,7 +113,7 @@ public class PartP2PTunnelME extends PartP2PTunnel implements I
public void removeFromWorld()
{
super.removeFromWorld();
- this.outerProxy.invalidate();
+ this.outerProxy.remove();
}
@Override
diff --git a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java
index 148d939f6..1e1d7860d 100644
--- a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java
+++ b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java
@@ -21,6 +21,8 @@ package appeng.parts.reporting;
import java.io.IOException;
+import com.mojang.blaze3d.matrix.MatrixStack;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -250,7 +252,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
@Override
@OnlyIn( Dist.CLIENT )
- public void renderDynamic( double x, double y, double z, float partialTicks, int destroyStage )
+ public void renderDynamic(float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn)
{
if( ( this.getClientFlags() & ( PartPanel.POWERED_FLAG | PartPanel.CHANNEL_FLAG ) ) != ( PartPanel.POWERED_FLAG | PartPanel.CHANNEL_FLAG ) )
@@ -265,16 +267,16 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
return;
}
- GlStateManager.pushMatrix();
- GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
+ matrixStack.push();
+ matrixStack.translate( 0.5, 0.5, 0.5 );
Direction facing = this.getSide().getFacing();
- TesrRenderHelper.moveToFace( facing );
- TesrRenderHelper.rotateToFace( facing, this.getSpin() );
- TesrRenderHelper.renderItem2dWithAmount( ais, 0.8f, 0.17f );
+ TesrRenderHelper.moveToFace( matrixStack, facing );
+ TesrRenderHelper.rotateToFace( matrixStack, facing, this.getSpin() );
+ TesrRenderHelper.renderItem2dWithAmount(matrixStack, buffers, ais, 0.8f, 0.17f );
- GlStateManager.popMatrix();
+ matrixStack.pop();
}
diff --git a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java
index c6eaa1463..f7fff0794 100644
--- a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java
+++ b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java
@@ -44,6 +44,7 @@ import appeng.api.util.AEPartLocation;
import appeng.me.GridAccessException;
import appeng.parts.AEBasePart;
import appeng.util.Platform;
+import net.minecraft.world.World;
/**
@@ -134,7 +135,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
- data.setByte( "spin", this.getSpin() );
+ data.putByte( "spin", this.getSpin() );
}
@Override
@@ -255,7 +256,9 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
if( this.opacity < 0 )
{
final TileEntity te = this.getTile();
- this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.getSide().getFacing() ) );
+ World world = te.getWorld();
+ BlockPos pos = te.getPos().offset(this.getSide().getFacing());
+ this.opacity = 255 - world.getBlockState(pos).getOpacity(world, pos);
}
return (int) ( emit * ( this.opacity / 255.0f ) );
diff --git a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java
index 34ef0bedf..45f7455e8 100644
--- a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java
+++ b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java
@@ -38,7 +38,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.IConfigManager;
-import appeng.core.sync.GuiBridge;
+
import appeng.me.GridAccessException;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.ConfigManager;
@@ -117,16 +117,16 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), this.getGui( player ) );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), this.getGui( player ) );
}
}
return true;
}
- public GuiBridge getGui( final PlayerEntity player )
- {
- return GuiBridge.GUI_ME;
- }
+// FIXME public GuiBridge getGui( final PlayerEntity player )
+// FIXME {
+// FIXME return GuiBridge.GUI_ME;
+// FIXME }
@Override
public > IMEMonitor getInventory( IStorageChannel channel )
diff --git a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java
index d2f70c638..c365ff3d6 100644
--- a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java
+++ b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java
@@ -22,6 +22,7 @@ package appeng.parts.reporting;
import java.util.Collections;
import java.util.List;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
diff --git a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java
index 37fa6ebd5..cbef544cf 100644
--- a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java
+++ b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java
@@ -29,7 +29,7 @@ import net.minecraftforge.items.IItemHandler;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
@@ -84,25 +84,25 @@ public class PartCraftingTerminal extends AbstractPartTerminal
this.craftingGrid.writeToNBT( data, "craftingGrid" );
}
- @Override
- public GuiBridge getGui( final PlayerEntity p )
- {
- 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();
- y = this.getTile().getPos().getY();
- z = this.getTile().getPos().getZ();
- }
-
- if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
- {
- return GuiBridge.GUI_CRAFTING_TERMINAL;
- }
- return GuiBridge.GUI_ME;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGui( final PlayerEntity p )
+// FIXME {
+// FIXME int x = (int) p.getPosX();
+// FIXME int y = (int) p.getPosY();
+// FIXME int z = (int) p.getPosZ();
+// FIXME if( this.getHost().getTile() != null )
+// FIXME {
+// FIXME x = this.getTile().getPos().getX();
+// FIXME y = this.getTile().getPos().getY();
+// FIXME z = this.getTile().getPos().getZ();
+// FIXME }
+// FIXME
+// FIXME if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
+// FIXME {
+// FIXME return GuiBridge.GUI_CRAFTING_TERMINAL;
+// FIXME }
+// FIXME return GuiBridge.GUI_ME;
+// FIXME }
@Override
public IItemHandler getInventoryByName( final String name )
diff --git a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java
index 810a2878e..43e356b77 100644
--- a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java
+++ b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java
@@ -27,7 +27,7 @@ import net.minecraft.util.math.Vec3d;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
import appeng.util.Platform;
@@ -57,7 +57,7 @@ public class PartInterfaceTerminal extends AbstractPartDisplay
{
if( Platform.isServer() )
{
- Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_INTERFACE_TERMINAL );
+ // FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_INTERFACE_TERMINAL );
}
}
return true;
diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java
index 91ad5391b..b71f25e14 100644
--- a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java
+++ b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java
@@ -32,7 +32,7 @@ import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.parts.IPartModel;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AppEng;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
@@ -99,25 +99,25 @@ public class PartPatternTerminal extends AbstractPartTerminal
this.crafting.writeToNBT( data, "craftingGrid" );
}
- @Override
- public GuiBridge getGui( final PlayerEntity p )
- {
- 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();
- y = this.getTile().getPos().getY();
- z = this.getTile().getPos().getZ();
- }
-
- if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
- {
- return GuiBridge.GUI_PATTERN_TERMINAL;
- }
- return GuiBridge.GUI_ME;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGui( final PlayerEntity p )
+// FIXME {
+// FIXME int x = (int) p.getPosX();
+// FIXME int y = (int) p.getPosY();
+// FIXME int z = (int) p.getPosZ();
+// FIXME if( this.getHost().getTile() != null )
+// FIXME {
+// FIXME x = this.getTile().getPos().getX();
+// FIXME y = this.getTile().getPos().getY();
+// FIXME z = this.getTile().getPos().getZ();
+// FIXME }
+// FIXME
+// FIXME if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
+// FIXME {
+// FIXME return GuiBridge.GUI_PATTERN_TERMINAL;
+// FIXME }
+// FIXME return GuiBridge.GUI_ME;
+// FIXME }
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
diff --git a/src/main/java/appeng/spatial/DefaultSpatialHandler.java b/src/main/java/appeng/spatial/DefaultSpatialHandler.java
index 77b65a541..4ae60937f 100644
--- a/src/main/java/appeng/spatial/DefaultSpatialHandler.java
+++ b/src/main/java/appeng/spatial/DefaultSpatialHandler.java
@@ -47,13 +47,12 @@ public class DefaultSpatialHandler implements IMovableHandler
@Override
public void moveTile( final TileEntity te, final World w, final BlockPos newPosition )
{
- te.setWorld( w );
- te.setPos( newPosition );
+ te.setWorldAndPos( w, newPosition );
- final Chunk c = w.getChunkFromBlockCoords( newPosition );
+ final Chunk c = w.getChunkAt( newPosition );
c.addTileEntity( newPosition, te );
- if( c.isLoaded() )
+ if( w.getChunkProvider().isChunkLoaded(c.getPos()) )
{
final BlockState state = w.getBlockState( newPosition );
w.addTileEntity( te );
diff --git a/src/main/java/appeng/spatial/StorageHelper.java b/src/main/java/appeng/spatial/StorageHelper.java
index 46cb06956..6714c0aff 100644
--- a/src/main/java/appeng/spatial/StorageHelper.java
+++ b/src/main/java/appeng/spatial/StorageHelper.java
@@ -22,6 +22,7 @@ package appeng.spatial;
import java.util.ArrayList;
import java.util.List;
+import appeng.core.Api;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
@@ -30,7 +31,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
-import net.minecraft.world.WorldServer;
+import net.minecraft.world.ServerWorld;
+import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.ITeleporter;
import appeng.api.AEApi;
@@ -63,13 +65,13 @@ public class StorageHelper
*/
private Entity teleportEntity( Entity entity, final TelDestination link )
{
- final WorldServer oldWorld;
- final WorldServer newWorld;
+ final ServerWorld oldWorld;
+ final ServerWorld newWorld;
try
{
- oldWorld = (WorldServer) entity.world;
- newWorld = (WorldServer) link.dim;
+ oldWorld = (ServerWorld) entity.world;
+ newWorld = (ServerWorld) link.dim;
}
catch( final Throwable e )
{
@@ -116,7 +118,7 @@ public class StorageHelper
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger( (ServerPlayerEntity) entity );
}
- entity.changeDimension( link.dim.provider.getDimension(), new METeleporter( link ) );
+ entity.changeDimension( link.dim.getDimension().getType(), new METeleporter( link ) );
if( !passangersOnOtherSide.isEmpty() )
{
diff --git a/src/main/java/appeng/spatial/StorageWorldProvider.java b/src/main/java/appeng/spatial/StorageWorldProvider.java
index 446ac4068..ca2645571 100644
--- a/src/main/java/appeng/spatial/StorageWorldProvider.java
+++ b/src/main/java/appeng/spatial/StorageWorldProvider.java
@@ -22,9 +22,7 @@ package appeng.spatial;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.DimensionType;
import net.minecraft.world.biome.Biome;
-import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.gen.ChunkGenerator;
diff --git a/src/main/java/appeng/tile/AEBaseInvTile.java b/src/main/java/appeng/tile/AEBaseInvTile.java
index dcd169acf..4672c95d3 100644
--- a/src/main/java/appeng/tile/AEBaseInvTile.java
+++ b/src/main/java/appeng/tile/AEBaseInvTile.java
@@ -111,6 +111,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
return this.getInternalInventory();
}
+ @SuppressWarnings("unchecked")
@Nonnull
@Override
public LazyOptional getCapability(@Nonnull Capability capability, Direction facing) {
diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java
index ca1e91288..c9a297235 100644
--- a/src/main/java/appeng/tile/AEBaseTile.java
+++ b/src/main/java/appeng/tile/AEBaseTile.java
@@ -40,6 +40,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.text.ITextComponent;
+import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
@@ -415,7 +417,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this.hasCustomInventoryName() )
{
final CompoundNBT dsp = new CompoundNBT();
- dsp.putString( "Name", this.getCustomInventoryName() );
+ dsp.putString( "Name", this.customName );
output.put( "display", dsp );
}
@@ -448,15 +450,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Override
- public String getCustomInventoryName()
+ public ITextComponent getCustomInventoryName()
{
- return this.hasCustomInventoryName() ? this.customName : this.getClass().getSimpleName();
+ return new StringTextComponent(this.hasCustomInventoryName() ? this.customName : this.getClass().getSimpleName());
}
@Override
public boolean hasCustomInventoryName()
{
- return this.customName != null && this.customName.length() > 0;
+ return this.customName != null && !this.customName.isEmpty();
}
public void securityBreak()
@@ -468,7 +470,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
/**
* Checks if this tile entity is remote (we are running on the logical client side).
*/
- protected boolean isRemote() {
+ public boolean isRemote() {
World world = getWorld();
return world == null || world.isRemote();
}
diff --git a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java
index c9cd9143f..3b24de613 100644
--- a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java
+++ b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java
@@ -22,10 +22,13 @@ package appeng.tile.crafting;
import java.io.IOException;
import java.util.Optional;
+import appeng.block.AEBaseTileBlock;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -34,11 +37,18 @@ import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEColor;
import appeng.util.item.AEItemStack;
+import net.minecraftforge.client.model.data.IModelData;
+import net.minecraftforge.client.model.data.ModelDataMap;
+import net.minecraftforge.client.model.data.ModelProperty;
+
+import javax.annotation.Nonnull;
public class TileCraftingMonitorTile extends TileCraftingTile implements IColorableTile
{
+ public static final ModelProperty COLOR = new ModelProperty<>();
+
@OnlyIn( Dist.CLIENT )
private Integer dspList;
@@ -48,6 +58,10 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.TRANSPARENT;
+ public TileCraftingMonitorTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
protected boolean readFromStream( final PacketBuffer data ) throws IOException
{
@@ -88,9 +102,9 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
if( data.contains("paintedColor") )
{
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
@@ -98,10 +112,10 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
- data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
+ super.write( data );
+ data.putByte( "paintedColor", (byte) this.paintedColor.ordinal() );
return data;
}
@@ -186,4 +200,15 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
return is.orElseGet( () -> super.getItemFromTile( obj ) );
}
+
+ @Nonnull
+ @Override
+ public IModelData getModelData() {
+ return new ModelDataMap.Builder()
+ .withInitial(AEBaseTileBlock.FORWARD, getForward())
+ .withInitial(AEBaseTileBlock.UP, getUp())
+ .withInitial(COLOR, getColor())
+ .build();
+ }
+
}
diff --git a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java
index 54e429890..27a514700 100644
--- a/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java
+++ b/src/main/java/appeng/tile/crafting/TileCraftingStorageTile.java
@@ -21,17 +21,22 @@ package appeng.tile.crafting;
import java.util.Optional;
+import appeng.core.Api;
import net.minecraft.item.ItemStack;
-import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
-import appeng.block.crafting.BlockCraftingUnit;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
+import net.minecraft.tileentity.TileEntityType;
public class TileCraftingStorageTile extends TileCraftingTile
{
private static final int KILO_SCALAR = 1024;
+ public TileCraftingStorageTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
protected ItemStack getItemFromTile( final Object obj )
{
@@ -77,12 +82,12 @@ public class TileCraftingStorageTile extends TileCraftingTile
@Override
public int getStorageBytes()
{
- if( this.world == null || this.notLoaded() || this.isInvalid() )
+ if( this.world == null || this.notLoaded() || this.isRemoved() )
{
return 0;
}
- final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock();
+ final AbstractCraftingUnitBlock unit = (AbstractCraftingUnitBlock) this.world.getBlockState( this.pos ).getBlock();
switch( unit.type )
{
default:
diff --git a/src/main/java/appeng/tile/crafting/TileCraftingTile.java b/src/main/java/appeng/tile/crafting/TileCraftingTile.java
index eab366117..e0a7134dc 100644
--- a/src/main/java/appeng/tile/crafting/TileCraftingTile.java
+++ b/src/main/java/appeng/tile/crafting/TileCraftingTile.java
@@ -25,13 +25,15 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Optional;
+import appeng.client.render.crafting.CraftingCubeState;
+import appeng.core.Api;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
-import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.networking.GridFlags;
@@ -44,8 +46,8 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEPartLocation;
import appeng.api.util.WorldCoord;
-import appeng.block.crafting.BlockCraftingUnit;
-import appeng.block.crafting.BlockCraftingUnit.CraftingUnitType;
+import appeng.block.crafting.AbstractCraftingUnitBlock;
+import appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.implementations.CraftingCPUCalculator;
@@ -54,18 +56,28 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.AENetworkProxyMultiblock;
import appeng.tile.grid.AENetworkTile;
import appeng.util.Platform;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockReader;
+import net.minecraftforge.client.model.data.EmptyModelData;
+import net.minecraftforge.client.model.data.IModelData;
+import net.minecraftforge.client.model.data.ModelDataMap;
+import net.minecraftforge.client.model.data.ModelProperty;
+
+import javax.annotation.Nonnull;
public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState
{
+ public static final ModelProperty STATE = new ModelProperty<>();
+
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
private CompoundNBT previousState = null;
private boolean isCoreBlock = false;
private CraftingCPUCluster cluster;
- public TileCraftingTile()
- {
+ public TileCraftingTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
}
@@ -79,7 +91,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
@Override
protected ItemStack getItemFromTile( final Object obj )
{
- Optional is = Optional.empty();
+ Optional is;
if( ( (TileCraftingTile) obj ).isAccelerator() )
{
@@ -117,7 +129,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
return false;
}
- final BlockCraftingUnit unit = (BlockCraftingUnit) this.world.getBlockState( this.pos ).getBlock();
+ final AbstractCraftingUnitBlock unit = (AbstractCraftingUnitBlock) this.world.getBlockState( this.pos ).getBlock();
return unit.type == CraftingUnitType.ACCELERATOR;
}
@@ -147,7 +159,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
public void updateMeta( final boolean updateFormed )
{
- if( this.world == null || this.notLoaded() || this.isInvalid() )
+ if( this.world == null || this.notLoaded() || this.isRemoved() )
{
return;
}
@@ -163,9 +175,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
final BlockState current = this.world.getBlockState( this.pos );
// The tile might try to update while being destroyed
- if( current.getBlock() instanceof BlockCraftingUnit )
+ if( current.getBlock() instanceof AbstractCraftingUnitBlock)
{
- final BlockState newState = current.with( BlockCraftingUnit.POWERED, power ).with( BlockCraftingUnit.FORMED, formed );
+ final BlockState newState = current.with( AbstractCraftingUnitBlock.POWERED, power ).with( AbstractCraftingUnitBlock.FORMED, formed );
if( current != newState )
{
@@ -192,15 +204,15 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
- return this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
+ return this.world.getBlockState( this.pos ).get( AbstractCraftingUnitBlock.FORMED );
}
return this.cluster != null;
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
data.putBoolean("core", this.isCoreBlock());
if( this.isCoreBlock() && this.cluster != null )
{
@@ -210,9 +222,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.setCoreBlock( data.getBoolean( "core" ) );
if( this.isCoreBlock() )
{
@@ -347,7 +359,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
- return this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
+ return this.world.getBlockState( this.pos ).get( AbstractCraftingUnitBlock.POWERED );
}
return this.getProxy().isActive();
}
@@ -381,4 +393,34 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
this.previousState = previousState;
}
+
+ // FIXME: REMOVE AND MOVE TO IDynamicBakedModel!
+ @Nonnull
+ @Override
+ public IModelData getModelData() {
+ if (world == null) {
+ return EmptyModelData.INSTANCE;
+ }
+
+ EnumSet connections = EnumSet.noneOf( Direction.class );
+
+ for( Direction facing : Direction.values() )
+ {
+ if( this.isConnected( world, pos, facing ) )
+ {
+ connections.add( facing );
+ }
+ }
+
+ return new ModelDataMap.Builder()
+ .withInitial(STATE, new CraftingCubeState( connections ))
+ .build();
+ }
+
+ private boolean isConnected( IBlockReader world, BlockPos pos, Direction side )
+ {
+ BlockPos adjacentPos = pos.offset( side );
+ return world.getBlockState( adjacentPos ).getBlock() instanceof AbstractCraftingUnitBlock;
+ }
+
}
diff --git a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java
index 7b10e3ad8..abbad7f4a 100644
--- a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java
+++ b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java
@@ -22,17 +22,19 @@ package appeng.tile.crafting;
import java.io.IOException;
import java.util.List;
+import appeng.core.Api;
+import appeng.core.sync.network.TargetPoint;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
-import net.minecraft.world.WorldServer;
-import net.minecraftforge.fml.common.FMLCommonHandler;
-import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
+import net.minecraft.world.server.ServerWorld;
+import net.minecraftforge.fml.hooks.BasicEventHooks;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
@@ -95,8 +97,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
private boolean forcePlan = false;
private boolean reboot = true;
- public TileMolecularAssembler()
- {
+ public TileMolecularAssembler(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
final ITileDefinition assembler = Api.INSTANCE.definitions().blocks().molecularAssembler();
this.settings = new ConfigManager( this );
@@ -221,8 +223,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
final CompoundNBT compound = new CompoundNBT();
pattern.write(compound);
- data.setTag( "myPlan", compound );
- data.setInteger( "pushDirection", this.pushDirection.ordinal() );
+ data.put( "myPlan", compound );
+ data.putInt( "pushDirection", this.pushDirection.ordinal() );
}
}
@@ -237,7 +239,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
super.read( data );
if( data.contains("myPlan") )
{
- final ItemStack myPat = new ItemStack( data.getCompoundTag( "myPlan" ) );
+ final ItemStack myPat = ItemStack.read( data.getCompound( "myPlan" ) );
if( !myPat.isEmpty() && myPat.getItem() instanceof ItemEncodedPattern )
{
@@ -248,7 +250,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{
this.forcePlan = true;
this.myPlan = ph;
- this.pushDirection = AEPartLocation.fromOrdinal( data.getInteger( "pushDirection" ) );
+ this.pushDirection = AEPartLocation.fromOrdinal( data.getInt( "pushDirection" ) );
}
}
}
@@ -456,7 +458,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
final ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorld() );
if( !output.isEmpty() )
{
- FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ), output, this.craftingInv );
+ BasicEventHooks.firePlayerCraftingEvent( Platform.getPlayer( (ServerWorld) this.getWorld() ), output, this.craftingInv );
this.pushOut( output.copy() );
@@ -476,7 +478,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try
{
- final TargetPoint where = new TargetPoint( this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 );
+ final TargetPoint where = new TargetPoint( this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32, this.world.getDimension().getType() );
final IAEItemStack item = AEItemStack.fromItemStack( output );
NetworkHandler.instance().sendToAllAround( new PacketAssemblerAnimation( this.pos, (byte) speed, item ), where );
}
diff --git a/src/main/java/appeng/tile/grid/AENetworkInvTile.java b/src/main/java/appeng/tile/grid/AENetworkInvTile.java
index 686d2c78b..0aa3e6a2f 100644
--- a/src/main/java/appeng/tile/grid/AENetworkInvTile.java
+++ b/src/main/java/appeng/tile/grid/AENetworkInvTile.java
@@ -27,6 +27,7 @@ import appeng.api.util.AEPartLocation;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseInvTile;
+import net.minecraft.tileentity.TileEntityType;
public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionHost, IGridProxyable
@@ -34,6 +35,10 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
+ public AENetworkInvTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
public void read(final CompoundNBT data )
{
@@ -68,10 +73,10 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
}
@Override
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
- super.onChunkUnload();
- this.getProxy().onChunkUnload();
+ super.onChunkUnloaded();
+ this.getProxy().onChunkUnloaded();
}
@Override
@@ -82,10 +87,10 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
}
@Override
- public void invalidate()
+ public void remove()
{
- super.invalidate();
- this.getProxy().invalidate();
+ super.remove();
+ this.getProxy().remove();
}
@Override
diff --git a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java
index 495419ba2..e3758f433 100644
--- a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java
+++ b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java
@@ -29,6 +29,7 @@ import appeng.api.util.DimensionalCoord;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.powersink.AEBasePoweredTile;
+import net.minecraft.tileentity.TileEntityType;
public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IActionHost, IGridProxyable
@@ -36,6 +37,10 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
+ public AENetworkPowerTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
public void read(final CompoundNBT data )
{
@@ -89,17 +94,17 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
}
@Override
- public void invalidate()
+ public void remove()
{
- super.invalidate();
- this.getProxy().invalidate();
+ super.remove();
+ this.getProxy().remove();
}
@Override
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
- super.onChunkUnload();
- this.getProxy().onChunkUnload();
+ super.onChunkUnloaded();
+ this.getProxy().onChunkUnloaded();
}
@Override
diff --git a/src/main/java/appeng/tile/grid/AENetworkTile.java b/src/main/java/appeng/tile/grid/AENetworkTile.java
index 6c9e65e42..02795c4ce 100644
--- a/src/main/java/appeng/tile/grid/AENetworkTile.java
+++ b/src/main/java/appeng/tile/grid/AENetworkTile.java
@@ -29,6 +29,7 @@ import appeng.api.util.DimensionalCoord;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
+import net.minecraft.tileentity.TileEntityType;
public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxyable
@@ -36,17 +37,21 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
private final AENetworkProxy gridProxy = this.createProxy();
+ public AENetworkTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.getProxy().readFromNBT( data );
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
this.getProxy().writeToNBT( data );
return data;
}
@@ -69,10 +74,10 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
}
@Override
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
- super.onChunkUnload();
- this.getProxy().onChunkUnload();
+ super.onChunkUnloaded();
+ this.getProxy().onChunkUnloaded();
}
@Override
@@ -83,10 +88,10 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
}
@Override
- public void invalidate()
+ public void remove()
{
- super.invalidate();
- this.getProxy().invalidate();
+ super.remove();
+ this.getProxy().remove();
}
@Override
diff --git a/src/main/java/appeng/tile/misc/TileCellWorkbench.java b/src/main/java/appeng/tile/misc/TileCellWorkbench.java
index c9784ba15..f9c6fde8c 100644
--- a/src/main/java/appeng/tile/misc/TileCellWorkbench.java
+++ b/src/main/java/appeng/tile/misc/TileCellWorkbench.java
@@ -23,6 +23,7 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
@@ -54,8 +55,8 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
private IItemHandler cacheConfig = null;
private boolean locked = false;
- public TileCellWorkbench()
- {
+ public TileCellWorkbench(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
this.cell.setEnableClientEvents( true );
}
@@ -103,9 +104,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
this.cell.writeToNBT( data, "cell" );
this.config.writeToNBT( data, "config" );
this.manager.writeToNBT( data );
@@ -113,9 +114,9 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.cell.readFromNBT( data, "cell" );
this.config.readFromNBT( data, "config" );
this.manager.readFromNBT( data );
diff --git a/src/main/java/appeng/tile/misc/TileCharger.java b/src/main/java/appeng/tile/misc/TileCharger.java
index 450314ce8..a4b07043a 100644
--- a/src/main/java/appeng/tile/misc/TileCharger.java
+++ b/src/main/java/appeng/tile/misc/TileCharger.java
@@ -24,9 +24,11 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.items.IItemHandler;
@@ -63,8 +65,8 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1, 1, new ChargerInvFilter() );
- public TileCharger()
- {
+ public TileCharger(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
this.getProxy().setFlags();
this.setInternalMaxPower( POWER_MAXIMUM_AMOUNT );
diff --git a/src/main/java/appeng/tile/misc/TileCondenser.java b/src/main/java/appeng/tile/misc/TileCondenser.java
index debf1c1a9..2fae42de4 100644
--- a/src/main/java/appeng/tile/misc/TileCondenser.java
+++ b/src/main/java/appeng/tile/misc/TileCondenser.java
@@ -19,18 +19,22 @@
package appeng.tile.misc;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import appeng.core.Api;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraft.fluid.Fluid;
+import net.minecraftforge.common.util.LazyOptional;
+import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
-import net.minecraftforge.fluids.capability.FluidTankProperties;
import net.minecraftforge.fluids.capability.IFluidHandler;
-import net.minecraftforge.fluids.capability.IFluidTankProperties;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -60,6 +64,8 @@ import appeng.util.inv.WrapperChainedItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.filter.AEItemFilters;
+import java.util.function.Predicate;
+
public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, IConfigurableObject
{
@@ -79,8 +85,8 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
private double storedPower = 0;
- public TileCondenser()
- {
+ public TileCondenser(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.cm.registerSetting( Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH );
}
@@ -219,35 +225,21 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
this.storedPower = storedPower;
}
- @Override
- public boolean hasCapability( Capability> capability, Direction facing )
- {
- if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
- {
- return true;
- }
- else if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
- {
- return true;
- }
- return super.hasCapability( capability, facing );
- }
-
@SuppressWarnings( "unchecked" )
@Override
- public T getCapability( Capability capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
{
- return (T) this.externalInv;
+ return (LazyOptional) LazyOptional.of(() -> this.externalInv);
}
else if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY )
{
- return (T) this.fluidHandler;
+ return (LazyOptional) LazyOptional.of(() -> this.fluidHandler);
}
else if( capability == Capabilities.STORAGE_MONITORABLE_ACCESSOR )
{
- return (T) this.meHandler;
+ return (LazyOptional) LazyOptional.of(() -> this.meHandler);
}
return super.getCapability( capability, facing );
}
@@ -262,6 +254,11 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
return 1;
}
+ @Override
+ public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
+ return slot == 0;
+ }
+
@Override
public ItemStack getStackInSlot( int slot )
{
@@ -296,45 +293,76 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
}
}
- private static final IFluidTankProperties[] EMPTY = { new FluidTankProperties( null, FluidAttributes.BUCKET_VOLUME, true, false ) };
-
/**
* A fluid handler that exposes a 1 bucket tank that can only be filled, and - when filled - will add power
* to this condenser.
*/
- private class FluidHandler implements IFluidHandler
+ private class FluidHandler implements IFluidTank, IFluidHandler
{
+ @Nonnull
@Override
- public IFluidTankProperties[] getTankProperties()
- {
- return EMPTY;
+ public FluidStack getFluid() {
+ return FluidStack.EMPTY;
}
@Override
- public int fill( FluidStack resource, boolean doFill )
- {
- if( doFill )
+ public int getFluidAmount() {
+ return 0;
+ }
+
+ @Override
+ public int getCapacity() {
+ return FluidAttributes.BUCKET_VOLUME;
+ }
+
+ @Override
+ public boolean isFluidValid(FluidStack stack) {
+ return stack != FluidStack.EMPTY;
+ }
+
+ @Override
+ public int fill(FluidStack resource, FluidAction action) {
+ if( action == FluidAction.EXECUTE )
{
final IStorageChannel chan = Api.INSTANCE.storage().getStorageChannel( IFluidStorageChannel.class );
- TileCondenser.this.addPower( ( resource == null ? 0.0 : (double) resource.amount ) / chan.transferFactor() );
+ TileCondenser.this.addPower( ( resource == null ? 0.0 : (double) resource.getAmount() ) / chan.transferFactor() );
}
- return resource == null ? 0 : resource.amount;
+ return resource == null ? 0 : resource.getAmount();
}
- @Nullable
+ @Nonnull
@Override
- public FluidStack drain( FluidStack resource, boolean doDrain )
- {
- return null;
+ public FluidStack drain(int maxDrain, FluidAction action) {
+ return FluidStack.EMPTY;
}
- @Nullable
+ @Nonnull
@Override
- public FluidStack drain( int maxDrain, boolean doDrain )
- {
- return null;
+ public FluidStack drain(FluidStack resource, FluidAction action) {
+ return FluidStack.EMPTY;
+ }
+
+ @Override
+ public int getTanks() {
+ return 1;
+ }
+
+ @Nonnull
+ @Override
+ public FluidStack getFluidInTank(int tank) {
+ return FluidStack.EMPTY;
+ }
+
+ @Override
+ public int getTankCapacity(int tank) {
+ return tank == 0 ? getCapacity() : 0;
+ }
+
+ @Override
+ public boolean isFluidValid(int tank, @Nonnull FluidStack stack) {
+ return tank == 0 && isFluidValid(stack);
}
}
diff --git a/src/main/java/appeng/tile/misc/TileInscriber.java b/src/main/java/appeng/tile/misc/TileInscriber.java
index 7bbae1145..34898cfdb 100644
--- a/src/main/java/appeng/tile/misc/TileInscriber.java
+++ b/src/main/java/appeng/tile/misc/TileInscriber.java
@@ -26,11 +26,13 @@ import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import appeng.core.Api;
import com.google.common.collect.Lists;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -100,8 +102,9 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
private final IItemHandlerModifiable inv = new WrapperChainedItemHandler( this.topItemHandler, this.bottomItemHandler, this.sideItemHandler );
- public TileInscriber()
- {
+ public TileInscriber(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
this.setInternalMaxPower( 1600 );
this.getProxy().setIdlePowerUsage( 0 );
@@ -542,18 +545,15 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
final ItemStack startingItem = input.copy();
final ItemStack renamedItem = input.copy();
- final CompoundNBT tag = renamedItem.getOrCreateTag();
- final CompoundNBT display = tag.getCompoundTag( "display" );
- tag.setTag( "display", display );
-
- if( name.length() > 0 )
+ final CompoundNBT display = renamedItem.getOrCreateChildTag( "display" );
+ if( !name.isEmpty() )
{
display.putString("Name", name);
}
else
{
- display.removeTag( "Name" );
+ display.remove( "Name" );
}
final List inputs = Lists.newArrayList( startingItem );
diff --git a/src/main/java/appeng/tile/misc/TileInterface.java b/src/main/java/appeng/tile/misc/TileInterface.java
index 0bcb8e3b1..61812c627 100644
--- a/src/main/java/appeng/tile/misc/TileInterface.java
+++ b/src/main/java/appeng/tile/misc/TileInterface.java
@@ -25,6 +25,7 @@ import java.util.List;
import javax.annotation.Nullable;
+import appeng.core.Api;
import com.google.common.collect.ImmutableSet;
import net.minecraft.inventory.CraftingInventory;
@@ -32,10 +33,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
@@ -55,7 +58,7 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
-import appeng.core.sync.GuiBridge;
+
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
@@ -73,6 +76,10 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
// Indicates that this interface has no specific direction set
private boolean omniDirectional = true;
+ public TileInterface(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@MENetworkEventSubscribe
public void stateChange( final MENetworkChannelsChanged c )
{
@@ -337,16 +344,10 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
}
@Override
- public boolean hasCapability( Capability> capability, @Nullable Direction facing )
+ public LazyOptional getCapability(Capability capability, @Nullable Direction facing )
{
- return this.duality.hasCapability( capability, facing ) || super.hasCapability( capability, facing );
- }
-
- @Override
- public T getCapability( Capability capability, @Nullable Direction facing )
- {
- T result = this.duality.getCapability( capability, facing );
- if( result != null )
+ LazyOptional result = this.duality.getCapability( capability, facing );
+ if( result.isPresent() )
{
return result;
}
@@ -359,9 +360,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
return Api.INSTANCE.definitions().blocks().iface().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
- @Override
- public GuiBridge getGuiBridge()
- {
- return GuiBridge.GUI_INTERFACE;
- }
+// FIXME @Override
+// FIXME public GuiBridge getGuiBridge()
+// FIXME {
+// FIXME return GuiBridge.GUI_INTERFACE;
+// FIXME }
}
diff --git a/src/main/java/appeng/tile/misc/TileLightDetector.java b/src/main/java/appeng/tile/misc/TileLightDetector.java
index e17525a5e..8e3005860 100644
--- a/src/main/java/appeng/tile/misc/TileLightDetector.java
+++ b/src/main/java/appeng/tile/misc/TileLightDetector.java
@@ -23,6 +23,7 @@ package appeng.tile.misc;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
import net.minecraft.tileentity.ITickableTileEntity;
+import net.minecraft.tileentity.TileEntityType;
public class TileLightDetector extends AEBaseTile implements ITickableTileEntity
@@ -31,6 +32,10 @@ public class TileLightDetector extends AEBaseTile implements ITickableTileEntity
private int lastCheck = 30;
private int lastLight = 0;
+ public TileLightDetector(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
public boolean isReady()
{
return this.lastLight > 0;
diff --git a/src/main/java/appeng/tile/misc/TilePaint.java b/src/main/java/appeng/tile/misc/TilePaint.java
index 3fff6fd6f..d9761de52 100644
--- a/src/main/java/appeng/tile/misc/TilePaint.java
+++ b/src/main/java/appeng/tile/misc/TilePaint.java
@@ -32,6 +32,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -51,6 +52,10 @@ public class TilePaint extends AEBaseTile
private int isLit = 0;
private List dots = null;
+ public TilePaint(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
public boolean canBeRotated()
{
diff --git a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java
index 0d68abb88..7d81f6d31 100644
--- a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java
+++ b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.EnumSet;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import appeng.api.implementations.IPowerChannelState;
@@ -41,8 +42,8 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
private boolean hasPower = false;
- public TileQuartzGrowthAccelerator()
- {
+ public TileQuartzGrowthAccelerator(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
this.getProxy().setFlags();
this.getProxy().setIdlePowerUsage( 8 );
diff --git a/src/main/java/appeng/tile/misc/TileSecurityStation.java b/src/main/java/appeng/tile/misc/TileSecurityStation.java
index 042481499..9f781b4eb 100644
--- a/src/main/java/appeng/tile/misc/TileSecurityStation.java
+++ b/src/main/java/appeng/tile/misc/TileSecurityStation.java
@@ -24,12 +24,14 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
+import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.INBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -92,8 +94,8 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
private AEColor paintedColor = AEColor.TRANSPARENT;
private boolean isActive = false;
- public TileSecurityStation()
- {
+ public TileSecurityStation(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setIdlePowerUsage( 2.0 );
difference++;
@@ -156,11 +158,11 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
this.cm.writeToNBT( data );
- data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() );
+ data.putByte( "paintedColor", (byte) this.paintedColor.ordinal() );
data.putLong( "securityKey", this.securityKey );
this.getConfigSlot().writeToNBT( data, "config" );
@@ -172,18 +174,18 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
{
final CompoundNBT it = new CompoundNBT();
ais.createItemStack().write(it);
- storedItems.setTag( String.valueOf( offset ), it );
+ storedItems.put( String.valueOf( offset ), it );
offset++;
}
- data.setTag( "storedItems", storedItems );
+ data.put( "storedItems", storedItems );
return data;
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.cm.readFromNBT( data );
if( data.contains("paintedColor") )
{
@@ -193,10 +195,10 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
this.securityKey = data.getLong( "securityKey" );
this.getConfigSlot().readFromNBT( data, "config" );
- final CompoundNBT storedItems = data.getCompoundTag( "storedItems" );
- for( final Object key : storedItems.getKeySet() )
+ final CompoundNBT storedItems = data.getCompound( "storedItems" );
+ for( final Object key : storedItems.keySet() )
{
- final NBTBase obj = storedItems.getTag( (String) key );
+ final INBT obj = storedItems.get( (String) key );
if( obj instanceof CompoundNBT )
{
this.inventory.getStoredItems().add( AEItemStack.fromItemStack( ItemStack.read((CompoundNBT) obj) ) );
@@ -236,9 +238,9 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
}
@Override
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
- super.onChunkUnload();
+ super.onChunkUnloaded();
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.UNREGISTER ) );
this.isActive = false;
}
@@ -255,9 +257,9 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
}
@Override
- public void invalidate()
+ public void remove()
{
- super.invalidate();
+ super.remove();
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.UNREGISTER ) );
this.isActive = false;
}
diff --git a/src/main/java/appeng/tile/misc/TileVibrationChamber.java b/src/main/java/appeng/tile/misc/TileVibrationChamber.java
index ed85d2a04..fca49bd9b 100644
--- a/src/main/java/appeng/tile/misc/TileVibrationChamber.java
+++ b/src/main/java/appeng/tile/misc/TileVibrationChamber.java
@@ -27,8 +27,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
-import net.minecraft.tileentity.TileEntityFurnace;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
+import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Actionable;
@@ -66,8 +67,8 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
// client side..
public boolean isOn;
- public TileVibrationChamber()
- {
+ public TileVibrationChamber(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0 );
this.getProxy().setFlags();
}
@@ -102,7 +103,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
super.write( data );
data.putDouble("burnTime", this.getBurnTime());
data.putDouble("maxBurnTime", this.getMaxBurnTime());
- data.setInteger( "burnSpeed", this.getBurnSpeed() );
+ data.putInt( "burnSpeed", this.getBurnSpeed() );
return data;
}
@@ -112,7 +113,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
super.read( data );
this.setBurnTime( data.getDouble( "burnTime" ) );
this.setMaxBurnTime( data.getDouble( "maxBurnTime" ) );
- this.setBurnSpeed( data.getInteger( "burnSpeed" ) );
+ this.setBurnSpeed( data.getInt( "burnSpeed" ) );
}
@Override
@@ -151,7 +152,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
final ItemStack is = this.inv.getStackInSlot( 0 );
if( !is.isEmpty() )
{
- final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
+ final int newBurnTime = ForgeHooks.getBurnTime( is );
if( newBurnTime > 0 && is.getCount() > 0 )
{
return true;
@@ -238,7 +239,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
final ItemStack is = this.inv.getStackInSlot( 0 );
if( !is.isEmpty() )
{
- final int newBurnTime = TileEntityFurnace.getItemBurnTime( is );
+ final int newBurnTime = ForgeHooks.getBurnTime( is );
if( newBurnTime > 0 && is.getCount() > 0 )
{
this.setBurnTime( this.getBurnTime() + newBurnTime );
@@ -319,13 +320,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
@Override
public boolean allowExtract( IItemHandler inv, int slot, int amount )
{
- return !TileEntityFurnace.isItemFuel( inv.getStackInSlot( slot ) );
+ return ForgeHooks.getBurnTime( inv.getStackInSlot( slot ) ) == 0;
}
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
- return TileEntityFurnace.isItemFuel( stack );
+ return ForgeHooks.getBurnTime( stack ) != 0;
}
}
}
diff --git a/src/main/java/appeng/tile/networking/CableBusTESR.java b/src/main/java/appeng/tile/networking/CableBusTESR.java
index 34a672a36..b73a3f71d 100644
--- a/src/main/java/appeng/tile/networking/CableBusTESR.java
+++ b/src/main/java/appeng/tile/networking/CableBusTESR.java
@@ -19,33 +19,31 @@
package appeng.tile.networking;
+import com.mojang.blaze3d.matrix.MatrixStack;
+import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import appeng.api.parts.IPart;
import appeng.tile.AEBaseTile;
-public class CableBusTESR extends TileEntityRenderer
+public class CableBusTESR extends TileEntityRenderer
{
+ public CableBusTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
+ super(rendererDispatcherIn);
+ }
+
@Override
- public void render( AEBaseTile te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ )
- {
-
- if( !( te instanceof TileCableBusTESR ) )
- {
- return;
- }
-
- TileCableBusTESR realTe = (TileCableBusTESR) te;
-
+ public void render(TileCableBusTESR te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) {
for( Direction facing : Direction.values() )
{
- IPart part = realTe.getPart( facing );
+ IPart part = te.getPart( facing );
if( part != null && part.requireDynamicRender() )
{
- part.renderDynamic( x, y, z, partialTicks, destroyStage );
+ part.renderDynamic(partialTicks, ms, buffers, combinedLightIn, combinedOverlayIn);
}
}
}
diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java
index 6ca01d9b8..7264944ba 100644
--- a/src/main/java/appeng/tile/networking/TileCableBus.java
+++ b/src/main/java/appeng/tile/networking/TileCableBus.java
@@ -19,25 +19,6 @@
package appeng.tile.networking;
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompoundNBT;
-import net.minecraft.network.PacketBuffer;
-import net.minecraft.util.Direction;
-import net.minecraft.util.Hand;
-import net.minecraft.util.math.AxisAlignedBB;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.World;
-import net.minecraftforge.common.capabilities.Capability;
-
import appeng.api.networking.IGridNode;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart;
@@ -49,31 +30,52 @@ import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.helpers.AEMultiTile;
-import appeng.helpers.ICustomCollision;
import appeng.hooks.TickHandler;
import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
+import net.minecraft.util.Direction;
+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.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
-public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomCollision
+public class TileCableBus extends AEBaseTile implements AEMultiTile
{
private CableBusContainer cb = new CableBusContainer( this );
private int oldLV = -1; // on re-calculate light when it changes
+ public TileCableBus(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.getCableBus().readFromNBT( data );
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
this.getCableBus().writeToNBT( data );
return data;
}
@@ -88,7 +90,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
if( newLV != this.oldLV )
{
this.oldLV = newLV;
- this.world.checkLight( this.pos );
+ this.world.getLightManager().checkBlock( this.pos );
ret = true;
}
@@ -138,9 +140,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
- public void invalidate()
+ public void remove()
{
- super.invalidate();
+ super.remove();
this.getCableBus().removeFromWorld();
}
@@ -170,9 +172,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
- public void onChunkUnload()
+ public void onChunkUnloaded()
{
- super.onChunkUnload();
+ super.onChunkUnloaded();
this.getCableBus().removeFromWorld();
}
@@ -188,7 +190,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
if( newLV != this.oldLV )
{
this.oldLV = newLV;
- this.world.checkLight( this.pos );
+ this.world.getLightManager().checkBlock( this.pos );
}
super.markForUpdate();
@@ -290,12 +292,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
return false;
}
- @Override
- public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean visual )
- {
- return this.getCableBus().getSelectedBoundingBoxesFromPool( false, true, e, visual );
- }
-
@Override
public SelectedPart selectPart( final Vec3d pos )
{
@@ -338,15 +334,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
this.getWorld().removeBlock(this.pos, false);
}
- @Override
- public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e )
- {
- for( final AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, pos, e, false ) )
- {
- out.add( new AxisAlignedBB( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
- }
- }
-
@Override
public void notifyNeighbors()
{
@@ -379,25 +366,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
}
@Override
- public boolean hasCapability( Capability> capabilityClass, @Nullable Direction fromSide )
+ public LazyOptional getCapability(Capability capabilityClass, @Nullable Direction fromSide )
{
// Note that null will be translated to INTERNAL here
AEPartLocation partLocation = AEPartLocation.fromFacing( fromSide );
IPart part = this.getPart( partLocation );
- boolean result = part != null && part.hasCapability( capabilityClass );
-
- return result || super.hasCapability( capabilityClass, fromSide );
- }
-
- @Override
- public T getCapability( Capability capabilityClass, @Nullable Direction fromSide )
- {
- // Note that null will be translated to INTERNAL here
- AEPartLocation partLocation = AEPartLocation.fromFacing( fromSide );
-
- IPart part = this.getPart( partLocation );
- T result = part == null ? null : part.getCapability( capabilityClass );
+ LazyOptional result = part == null ? LazyOptional.empty() : part.getCapability(capabilityClass);
if( result != null )
{
diff --git a/src/main/java/appeng/tile/networking/TileCableBusTESR.java b/src/main/java/appeng/tile/networking/TileCableBusTESR.java
index b775765ec..f75ea0bdf 100644
--- a/src/main/java/appeng/tile/networking/TileCableBusTESR.java
+++ b/src/main/java/appeng/tile/networking/TileCableBusTESR.java
@@ -20,11 +20,16 @@ package appeng.tile.networking;
import appeng.block.networking.BlockCableBus;
+import net.minecraft.tileentity.TileEntityType;
public class TileCableBusTESR extends TileCableBus
{
+ public TileCableBusTESR(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
+ }
+
/**
* Changes this tile to the non-TESR version, if none of the parts require dynamic rendering.
*/
diff --git a/src/main/java/appeng/tile/networking/TileController.java b/src/main/java/appeng/tile/networking/TileController.java
index 86ad95fa3..d8d3acf8b 100644
--- a/src/main/java/appeng/tile/networking/TileController.java
+++ b/src/main/java/appeng/tile/networking/TileController.java
@@ -22,8 +22,10 @@ package appeng.tile.networking;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.ChunkPos;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
@@ -49,8 +51,8 @@ public class TileController extends AENetworkPowerTile
{
private boolean isValid = false;
- public TileController()
- {
+ public TileController(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.setInternalMaxPower( 8000 );
this.setInternalPublicPowerStorage( true );
this.getProxy().setIdlePowerUsage( 3 );
@@ -126,7 +128,7 @@ public class TileController extends AENetworkPowerTile
metaState = ControllerBlockState.offline;
}
- if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).getValue( BlockController.CONTROLLER_STATE ) != metaState )
+ if( this.checkController( this.pos ) && this.world.getBlockState( this.pos ).get( BlockController.CONTROLLER_STATE ) != metaState )
{
this.world.setBlockState( this.pos, this.world.getBlockState( this.pos ).with( BlockController.CONTROLLER_STATE, metaState ) );
}
@@ -209,7 +211,7 @@ public class TileController extends AENetworkPowerTile
*/
private boolean checkController( final BlockPos pos )
{
- if( this.world.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
+ if( this.world.getChunkProvider().isChunkLoaded( new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4)) )
{
return this.world.getTileEntity( pos ) instanceof TileController;
}
diff --git a/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java b/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java
index 8d6618f6d..d9b38fea2 100644
--- a/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java
+++ b/src/main/java/appeng/tile/networking/TileCreativeEnergyCell.java
@@ -26,13 +26,14 @@ import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.tile.grid.AENetworkTile;
+import net.minecraft.tileentity.TileEntityType;
public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerStorage
{
- public TileCreativeEnergyCell()
- {
+ public TileCreativeEnergyCell(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0 );
}
diff --git a/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java b/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java
index 7c2a8deef..37e986386 100644
--- a/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java
+++ b/src/main/java/appeng/tile/networking/TileDenseEnergyCell.java
@@ -19,11 +19,14 @@
package appeng.tile.networking;
+import net.minecraft.tileentity.TileEntityType;
+
public class TileDenseEnergyCell extends TileEnergyCell
{
- public TileDenseEnergyCell()
- {
+ public TileDenseEnergyCell(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.setInternalMaxPower( 200000 * 8 );
}
+
}
diff --git a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java
index 092444f95..33929e591 100644
--- a/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java
+++ b/src/main/java/appeng/tile/networking/TileEnergyAcceptor.java
@@ -20,6 +20,7 @@ package appeng.tile.networking;
import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
@@ -34,8 +35,9 @@ import appeng.util.inv.InvOperation;
public class TileEnergyAcceptor extends AENetworkPowerTile
{
- public TileEnergyAcceptor()
- {
+
+ public TileEnergyAcceptor(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0.0 );
this.setInternalMaxPower( 0 );
}
diff --git a/src/main/java/appeng/tile/networking/TileEnergyCell.java b/src/main/java/appeng/tile/networking/TileEnergyCell.java
index 6df0556d8..afde5fadf 100644
--- a/src/main/java/appeng/tile/networking/TileEnergyCell.java
+++ b/src/main/java/appeng/tile/networking/TileEnergyCell.java
@@ -33,6 +33,7 @@ import appeng.block.networking.BlockEnergyCell;
import appeng.me.GridAccessException;
import appeng.tile.grid.AENetworkTile;
import appeng.util.SettingsFrom;
+import net.minecraft.tileentity.TileEntityType;
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
@@ -43,8 +44,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
private byte currentMeta = -1;
- public TileEnergyCell()
- {
+ public TileEnergyCell(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.getProxy().setIdlePowerUsage( 0 );
}
@@ -58,7 +59,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
public void onReady()
{
super.onReady();
- final int value = this.world.getBlockState( this.pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
+ final int value = this.world.getBlockState( this.pos ).get( BlockEnergyCell.ENERGY_STORAGE );
this.currentMeta = (byte) value;
this.changePowerLevel();
}
@@ -84,7 +85,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
private void changePowerLevel()
{
- if( this.notLoaded() || this.isInvalid() )
+ if( this.notLoaded() || this.isRemoved() )
{
return;
}
@@ -99,17 +100,17 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
}
@Override
- public CompoundNBT writeToNBT( final CompoundNBT data )
+ public CompoundNBT write(final CompoundNBT data )
{
- super.writeToNBT( data );
+ super.write( data );
data.putDouble("internalCurrentPower", this.internalCurrentPower);
return data;
}
@Override
- public void readFromNBT( final CompoundNBT data )
+ public void read(final CompoundNBT data )
{
- super.readFromNBT( data );
+ super.read( data );
this.internalCurrentPower = data.getDouble( "internalCurrentPower" );
}
diff --git a/src/main/java/appeng/tile/networking/TileWireless.java b/src/main/java/appeng/tile/networking/TileWireless.java
index f279d403e..34c3f0cef 100644
--- a/src/main/java/appeng/tile/networking/TileWireless.java
+++ b/src/main/java/appeng/tile/networking/TileWireless.java
@@ -22,8 +22,10 @@ package appeng.tile.networking;
import java.io.IOException;
import java.util.EnumSet;
+import appeng.core.Api;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.items.IItemHandler;
@@ -56,8 +58,8 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private int clientFlags = 0;
- public TileWireless()
- {
+ public TileWireless(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.inv.setFilter( new AEItemDefinitionFilter( Api.INSTANCE.definitions().materials().wirelessBooster() ) );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) );
diff --git a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java
index 21ba9a8e1..f65737492 100644
--- a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java
+++ b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java
@@ -20,12 +20,16 @@ package appeng.tile.powersink;
import java.util.EnumSet;
+import java.util.Set;
-import javax.annotation.Nullable;
+import javax.annotation.Nonnull;
+import com.google.common.collect.ImmutableSet;
import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
import appeng.api.config.AccessRestriction;
@@ -35,8 +39,6 @@ import appeng.api.config.PowerUnits;
import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
import appeng.capabilities.Capabilities;
-import appeng.integration.Integrations;
-import appeng.integration.abstraction.IC2PowerSink;
import appeng.tile.AEBaseInvTile;
@@ -50,32 +52,31 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe
private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
// the current power buffer.
private double internalCurrentPower = 0;
- private EnumSet internalPowerSides = EnumSet.allOf( Direction.class );
+ private static final Set ALL_SIDES = ImmutableSet.copyOf(EnumSet.allOf( Direction.class ));
+ private Set internalPowerSides = ALL_SIDES;
private final IEnergyStorage forgeEnergyAdapter;
- private Object teslaEnergyAdapter;
+ // Cache the optional to not continuously re-allocate it or the supplier
+ private final LazyOptional forgeEnergyAdapterOptional;
- private IC2PowerSink ic2Sink;
+ // IC2 private IC2PowerSink ic2Sink;
- public AEBasePoweredTile()
- {
+ public AEBasePoweredTile(TileEntityType> tileEntityTypeIn) {
+ super(tileEntityTypeIn);
this.forgeEnergyAdapter = new ForgeEnergyAdapter( this );
- if( Capabilities.TESLA_CONSUMER != null )
- {
- this.teslaEnergyAdapter = new TeslaEnergyAdapter( this );
- }
- this.ic2Sink = Integrations.ic2().createPowerSink( this, this );
- this.ic2Sink.setValidFaces( this.internalPowerSides );
+ this.forgeEnergyAdapterOptional = LazyOptional.of(() -> forgeEnergyAdapter);
+ // IC2 this.ic2Sink = Integrations.ic2().createPowerSink( this, this );
+ // IC2 this.ic2Sink.setValidFaces( this.internalPowerSides );
}
- protected EnumSet