Fabric port in progress

This commit is contained in:
Sebastian Hartte
2020-06-27 23:25:38 +02:00
parent 80fbb58d4f
commit b79cd732b2
368 changed files with 2498 additions and 2698 deletions
@@ -26,16 +26,16 @@ import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.CraftingCPUContainer;
import appeng.tile.crafting.CraftingTileEntity;
import appeng.tile.crafting.CraftingBlockEntity;
public abstract class AbstractCraftingUnitBlock<T extends CraftingTileEntity> extends AEBaseTileBlock<T> {
public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> extends AEBaseTileBlock<T> {
public static final BooleanProperty FORMED = BooleanProperty.create("formed");
public static final BooleanProperty POWERED = BooleanProperty.create("powered");
@@ -57,33 +57,33 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingTileEntity> ex
@Override
public void neighborChanged(final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn,
final BlockPos fromPos, boolean isMoving) {
final CraftingTileEntity cp = this.getTileEntity(worldIn, pos);
final CraftingBlockEntity cp = this.getBlockEntity(worldIn, pos);
if (cp != null) {
cp.updateMultiBlock();
}
}
@Override
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
public void onStateReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
if (newState.getBlock() == state.getBlock()) {
return; // Just a block state change
}
final CraftingTileEntity cp = this.getTileEntity(w, pos);
final CraftingBlockEntity cp = this.getBlockEntity(w, pos);
if (cp != null) {
cp.breakCluster();
}
super.onReplaced(state, w, pos, newState, isMoving);
super.onStateReplaced(state, w, pos, newState, isMoving);
}
@Override
public ActionResult onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockRayTraceResult hit) {
final CraftingTileEntity tg = this.getTileEntity(w, pos);
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockHitResult hit) {
final CraftingBlockEntity tg = this.getBlockEntity(w, pos);
if (tg != null && !p.isCrouching() && tg.isFormed() && tg.isActive()) {
if (!w.isRemote()) {
if (tg != null && !p.isInSneakingPose() && tg.isFormed() && tg.isActive()) {
if (!w.isClient()) {
ContainerOpener.openContainer(CraftingCPUContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
@@ -91,7 +91,7 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingTileEntity> ex
return ActionResult.SUCCESS;
}
return super.onBlockActivated(state, w, pos, p, hand, hit);
return super.onUse(state, w, pos, p, hand, hit);
}
public enum CraftingUnitType {
@@ -18,10 +18,10 @@
package appeng.block.crafting;
import appeng.tile.crafting.CraftingMonitorTileEntity;
import appeng.tile.crafting.CraftingMonitorBlockEntity;
public class CraftingMonitorBlock extends AbstractCraftingUnitBlock<CraftingMonitorTileEntity> {
public CraftingMonitorBlock(Properties props) {
public class CraftingMonitorBlock extends AbstractCraftingUnitBlock<CraftingMonitorBlockEntity> {
public CraftingMonitorBlock(Settings props) {
super(props, CraftingUnitType.MONITOR);
}
}
@@ -18,11 +18,11 @@
package appeng.block.crafting;
import appeng.tile.crafting.CraftingStorageTileEntity;
import appeng.tile.crafting.CraftingStorageBlockEntity;
public class CraftingStorageBlock extends AbstractCraftingUnitBlock<CraftingStorageTileEntity> {
public class CraftingStorageBlock extends AbstractCraftingUnitBlock<CraftingStorageBlockEntity> {
public CraftingStorageBlock(Properties props, CraftingUnitType type) {
public CraftingStorageBlock(Settings props, CraftingUnitType type) {
super(props, type);
}
@@ -28,7 +28,7 @@ import appeng.core.AEConfig;
public class CraftingStorageItem extends AEBaseBlockItem {
public CraftingStorageItem(Block id, Properties props) {
public CraftingStorageItem(Block id, Settings props) {
super(id, props);
}
@@ -18,11 +18,11 @@
package appeng.block.crafting;
import appeng.tile.crafting.CraftingTileEntity;
import appeng.tile.crafting.CraftingBlockEntity;
public class CraftingUnitBlock extends AbstractCraftingUnitBlock<CraftingTileEntity> {
public class CraftingUnitBlock extends AbstractCraftingUnitBlock<CraftingBlockEntity> {
public CraftingUnitBlock(Properties props, CraftingUnitType type) {
public CraftingUnitBlock(Settings props, CraftingUnitType type) {
super(props, type);
}
@@ -25,17 +25,17 @@ import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.MolecularAssemblerContainer;
import appeng.tile.crafting.MolecularAssemblerTileEntity;
import appeng.tile.crafting.MolecularAssemblerBlockEntity;
public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerTileEntity> {
public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerBlockEntity> {
public static final BooleanProperty POWERED = BooleanProperty.create("powered");
@@ -51,23 +51,23 @@ public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerT
}
@Override
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, MolecularAssemblerTileEntity te) {
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, MolecularAssemblerBlockEntity te) {
return currentState.with(POWERED, te.isPowered());
}
@Override
public ActionResult onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockRayTraceResult hit) {
final MolecularAssemblerTileEntity tg = this.getTileEntity(w, pos);
if (tg != null && !p.isCrouching()) {
if (!tg.isRemote()) {
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockHitResult hit) {
final MolecularAssemblerBlockEntity tg = this.getBlockEntity(w, pos);
if (tg != null && !p.isInSneakingPose()) {
if (!tg.isClient()) {
ContainerOpener.openContainer(MolecularAssemblerContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace()));
}
return ActionResult.SUCCESS;
}
return super.onBlockActivated(state, w, pos, p, hand, hit);
return super.onUse(state, w, pos, p, hand, hit);
}
}