Utils ported

This commit is contained in:
Sebastian Hartte
2020-06-28 15:47:44 +02:00
parent 46955643b9
commit f5412152a4
132 changed files with 488 additions and 528 deletions
@@ -133,7 +133,7 @@ public interface IPart extends ICustomCableConnection {
/** /**
* a block around the bus's host has been changed. * a block around the bus's host has been changed.
*/ */
void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor); void onneighborUpdate(BlockView w, BlockPos pos, BlockPos neighbor);
/** /**
* @return output redstone on facing side * @return output redstone on facing side
@@ -278,13 +278,13 @@ public interface IPart extends ICustomCableConnection {
public float getCableConnectionLength(AECableType cable); public float getCableConnectionLength(AECableType cable);
/** /**
* same as Block.animateTick, for but parts. * same as Block.randomDisplayTick, for but parts.
* *
* @param world world of block * @param world world of block
* @param pos location of block * @param pos location of block
* @param r random * @param r random
*/ */
void animateTick(World world, BlockPos pos, Random r); void randomDisplayTick(World world, BlockPos pos, Random r);
/** /**
* Called when placed in the world by a player, this happens before addWorld. * Called when placed in the world by a player, this happens before addWorld.
@@ -21,8 +21,8 @@ package appeng.block.crafting;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -36,8 +36,8 @@ import appeng.container.implementations.CraftingCPUContainer;
import appeng.tile.crafting.CraftingBlockEntity; import appeng.tile.crafting.CraftingBlockEntity;
public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> 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 FORMED = BooleanProperty.of("formed");
public static final BooleanProperty POWERED = BooleanProperty.create("powered"); public static final BooleanProperty POWERED = BooleanProperty.of("powered");
public final CraftingUnitType type; public final CraftingUnitType type;
@@ -48,14 +48,14 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> e
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(POWERED); builder.add(POWERED);
builder.add(FORMED); builder.add(FORMED);
} }
@Override @Override
public void neighborChanged(final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, public void neighborUpdate(final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn,
final BlockPos fromPos, boolean isMoving) { final BlockPos fromPos, boolean isMoving) {
final CraftingBlockEntity cp = this.getBlockEntity(worldIn, pos); final CraftingBlockEntity cp = this.getBlockEntity(worldIn, pos);
if (cp != null) { if (cp != null) {
@@ -85,7 +85,7 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> e
if (tg != null && !p.isInSneakingPose() && tg.isFormed() && tg.isActive()) { if (tg != null && !p.isInSneakingPose() && tg.isFormed() && tg.isActive()) {
if (!w.isClient()) { if (!w.isClient()) {
ContainerOpener.openContainer(CraftingCPUContainer.TYPE, p, ContainerOpener.openContainer(CraftingCPUContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@@ -21,8 +21,8 @@ package appeng.block.crafting;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
@@ -37,7 +37,7 @@ import appeng.tile.crafting.MolecularAssemblerBlockEntity;
public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerBlockEntity> { public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerBlockEntity> {
public static final BooleanProperty POWERED = BooleanProperty.create("powered"); public static final BooleanProperty POWERED = BooleanProperty.of("powered");
public MolecularAssemblerBlock(Settings props) { public MolecularAssemblerBlock(Settings props) {
super(props); super(props);
@@ -45,8 +45,8 @@ public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerB
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(POWERED); builder.add(POWERED);
} }
@@ -62,7 +62,7 @@ public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerB
if (tg != null && !p.isInSneakingPose()) { if (tg != null && !p.isInSneakingPose()) {
if (!tg.isClient()) { if (!tg.isClient()) {
ContainerOpener.openContainer(MolecularAssemblerContainer.TYPE, p, ContainerOpener.openContainer(MolecularAssemblerContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -38,7 +38,7 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
@@ -122,7 +122,7 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final AEBaseBlockEntity tile = this.getBlockEntity(world, pos); final AEBaseBlockEntity tile = this.getBlockEntity(world, pos);
if (tile != null) { if (tile != null) {
@@ -135,7 +135,7 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
} }
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView w, BlockPos pos) {
return this.findCrankable(w, pos) != null; return this.findCrankable(w, pos) != null;
} }
@@ -145,7 +145,7 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
Direction up = getUp(world, pos); Direction up = getUp(world, pos);
if (up == null) { if (up == null) {
@@ -155,7 +155,7 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
final double xOff = -0.15 * up.getOffsetX(); final double xOff = -0.15 * up.getOffsetX();
final double yOff = -0.15 * up.getOffsetY(); final double yOff = -0.15 * up.getOffsetY();
final double zOff = -0.15 * up.getOffsetZ(); final double zOff = -0.15 * up.getOffsetZ();
return VoxelShapes.create( return VoxelShapes.cuboid(
new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85)); new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
} }
@@ -48,7 +48,7 @@ public class GrinderBlock extends AEBaseTileBlock<GrinderBlockEntity> {
if (tg != null && !p.isInSneakingPose()) { if (tg != null && !p.isInSneakingPose()) {
if (p instanceof ServerPlayerEntity) { if (p instanceof ServerPlayerEntity) {
ContainerOpener.openContainer(GrinderContainer.TYPE, p, ContainerOpener.openContainer(GrinderContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -38,7 +38,7 @@ import appeng.util.Platform;
public class CellWorkbenchBlock extends AEBaseTileBlock<CellWorkbenchBlockEntity> { public class CellWorkbenchBlock extends AEBaseTileBlock<CellWorkbenchBlockEntity> {
public CellWorkbenchBlock() { public CellWorkbenchBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -25,6 +25,8 @@ import javax.annotation.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.render.model.json.Transformation;
import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@@ -32,8 +34,7 @@ import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -63,9 +64,7 @@ import appeng.util.Platform;
public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> { public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
public ChargerBlock() { public ChargerBlock() {
super(defaultProps(Material.IRON).notSolid()); super(defaultProps(Material.METAL));
this.setFullSize(this.setOpaque(false));
} }
@Override @Override
@@ -92,7 +91,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
@@ -111,7 +110,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
for (int bolts = 0; bolts < 3; bolts++) { for (int bolts = 0; bolts < 3; bolts++) {
if (AppEng.proxy.shouldAddParticles(r)) { if (AppEng.proxy.shouldAddParticles(r)) {
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(), MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(),
yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0, 0.0); yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0, 0.0);
} }
} }
@@ -120,7 +119,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
final ChargerBlockEntity tile = this.getBlockEntity(w, pos); final ChargerBlockEntity tile = this.getBlockEntity(w, pos);
if (tile != null) { if (tile != null) {
@@ -166,15 +165,15 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
break; break;
} }
return VoxelShapes.create(bb.getBoundingBox()); return VoxelShapes.cuboid(bb.getBoundingBox());
} }
return VoxelShapes.create(new Box(0.0, 0, 0.0, 1.0, 1.0, 1.0)); return VoxelShapes.cuboid(new Box(0.0, 0, 0.0, 1.0, 1.0, 1.0));
} }
@Override @Override
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
ShapeContext context) { ShapeContext context) {
return VoxelShapes.create(new Box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0)); return VoxelShapes.cuboid(new Box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@@ -183,8 +182,8 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
private static Pair<ItemStack, TransformationMatrix> getRenderedItem(ChargerBlockEntity tile) { private static Pair<ItemStack, Transformation> getRenderedItem(ChargerBlockEntity tile) {
TransformationMatrix transform = new TransformationMatrix(new Vector3f(0.5f, 0.375f, 0.5f), null, null, null); Transformation transform = new Transformation(new Vector3f(), new Vector3f(0.5f, 0.375f, 0.5f), new Vector3f(1f, 1f, 1f));
return new ImmutablePair<>(tile.getInternalInventory().getInvStack(0), transform); return new ImmutablePair<>(tile.getInternalInventory().getInvStack(0), transform);
} }
@@ -39,7 +39,7 @@ import appeng.util.Platform;
public class CondenserBlock extends AEBaseTileBlock<CondenserBlockEntity> { public class CondenserBlock extends AEBaseTileBlock<CondenserBlockEntity> {
public CondenserBlock() { public CondenserBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -53,7 +53,7 @@ public class CondenserBlock extends AEBaseTileBlock<CondenserBlockEntity> {
final CondenserBlockEntity tc = this.getBlockEntity(w, pos); final CondenserBlockEntity tc = this.getBlockEntity(w, pos);
if (tc != null && !player.isInSneakingPose()) { if (tc != null && !player.isInSneakingPose()) {
ContainerOpener.openContainer(CondenserContainer.TYPE, player, ContainerOpener.openContainer(CondenserContainer.TYPE, player,
ContainerLocator.forTileEntitySide(tc, hit.getFace())); ContainerLocator.forTileEntitySide(tc, hit.getSide()));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
} }
@@ -56,7 +56,7 @@ public class InscriberBlock extends AEBaseTileBlock<InscriberBlockEntity> {
if (tg != null) { if (tg != null) {
if (!tg.isClient()) { if (!tg.isClient()) {
ContainerOpener.openContainer(InscriberContainer.TYPE, p, ContainerOpener.openContainer(InscriberContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -9,7 +9,7 @@ import appeng.bootstrap.TileEntityRenderingCustomizer;
import appeng.client.render.tesr.InscriberTESR; import appeng.client.render.tesr.InscriberTESR;
import appeng.tile.misc.InscriberBlockEntity; import appeng.tile.misc.InscriberBlockEntity;
public class InscriberRendering extends TileEntityRenderingCustomizer<InscriberBlockEntity> { public class InscriberRendering implements TileEntityRenderingCustomizer<InscriberBlockEntity> {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
@@ -25,8 +25,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@@ -44,15 +44,15 @@ import appeng.util.Platform;
public class InterfaceBlock extends AEBaseTileBlock<InterfaceBlockEntity> { public class InterfaceBlock extends AEBaseTileBlock<InterfaceBlockEntity> {
private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.create("omnidirectional"); private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.of("omnidirectional");
public InterfaceBlock() { public InterfaceBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(OMNIDIRECTIONAL); builder.add(OMNIDIRECTIONAL);
} }
@@ -72,7 +72,7 @@ public class InterfaceBlock extends AEBaseTileBlock<InterfaceBlockEntity> {
if (tg != null) { if (tg != null) {
if (Platform.isServer()) { if (Platform.isServer()) {
ContainerOpener.openContainer(InterfaceContainer.TYPE, p, ContainerOpener.openContainer(InterfaceContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -18,23 +18,18 @@
package appeng.block.misc; package appeng.block.misc;
import java.util.Random; import net.minecraft.block.*;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.block.Block; import net.minecraft.state.StateManager;
import net.minecraft.block.BlockState; import net.minecraft.state.property.Properties;
import net.minecraft.block.Material;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.util.IOrientable; import appeng.api.util.IOrientable;
@@ -46,44 +41,48 @@ import appeng.tile.misc.LightDetectorBlockEntity;
public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity> implements IOrientableBlock { public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity> implements IOrientableBlock {
// Used to alternate between two variants of the fixture on adjacent blocks // Used to alternate between two variants of the fixture on adjacent blocks
public static final BooleanProperty ODD = BooleanProperty.create("odd"); public static final BooleanProperty ODD = BooleanProperty.of("odd");
public LightDetectorBlock() { public LightDetectorBlock() {
super(defaultProps(Material.MISCELLANEOUS).notSolid()); super(defaultProps(Material.SUPPORTED));
this.setDefaultState(this.getDefaultState().with(Properties.FACING, Direction.UP).with(ODD, false));
this.setDefaultState(this.getDefaultState().with(BlockStateProperties.FACING, Direction.UP).with(ODD, false));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(BlockStateProperties.FACING); builder.add(Properties.FACING);
builder.add(ODD); builder.add(ODD);
} }
@Override @Override
public int getWeakPower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) { public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
if (w instanceof World && this.getBlockEntity(w, pos).isReady()) { if (w instanceof World && this.getBlockEntity(w, pos).isReady()) {
// FIXME: This is ... uhm... fishy // FIXME: This is ... uhm... fishy
return ((World) w).getLight(pos) - 6; return ((World) w).getLightLevel(pos) - 6;
} }
return 0; return 0;
} }
@Override @Override
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) { public boolean emitsRedstonePower(BlockState state) {
super.onNeighborChange(state, world, pos, neighbor); return true;
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
final Direction up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
// FIXME: Double check that this actually updates neighbors
return Blocks.AIR.getDefaultState();
}
final LightDetectorBlockEntity tld = this.getBlockEntity(world, pos); final LightDetectorBlockEntity tld = this.getBlockEntity(world, pos);
if (tld != null) { if (tld != null) {
tld.updateLight(); tld.updateLight();
} }
}
@Override return state;
public void animateTick(final BlockState state, final World worldIn, final BlockPos pos, final Random rand) {
// cancel out lightning
} }
@Override @Override
@@ -94,11 +93,11 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
private boolean canPlaceAt(final BlockView w, final BlockPos pos, final Direction dir) { private boolean canPlaceAt(final BlockView w, final BlockPos pos, final Direction dir) {
final BlockPos test = pos.offset(dir); final BlockPos test = pos.offset(dir);
BlockState blockstate = w.getBlockState(test); BlockState blockstate = w.getBlockState(test);
return blockstate.isSolidSide(w, test, dir.getOpposite()); return blockstate.isSideSolidFullSquare(w, test, dir.getOpposite());
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
// FIXME: We should / rather MUST use state here because at startup, this gets // FIXME: We should / rather MUST use state here because at startup, this gets
// called without a world // called without a world
@@ -108,7 +107,7 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
final double yOff = -0.3 * up.getOffsetY(); final double yOff = -0.3 * up.getOffsetY();
final double zOff = -0.3 * up.getOffsetZ(); final double zOff = -0.3 * up.getOffsetZ();
return VoxelShapes return VoxelShapes
.create(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7)); .cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
} }
@Override @Override
@@ -118,22 +117,7 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public boolean canPlaceAt(BlockState state, WorldView w, BlockPos pos) {
boolean isMoving) {
final Direction up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
this.dropTorch(world, pos);
}
}
private void dropTorch(final World w, final BlockPos pos) {
final BlockState prev = w.getBlockState(pos);
w.breakBlock(pos, true);
w.updateListeners(pos, prev, w.getBlockState(pos), 3);
}
@Override
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos) {
for (final Direction dir : Direction.values()) { for (final Direction dir : Direction.values()) {
if (this.canPlaceAt(w, pos, dir)) { if (this.canPlaceAt(w, pos, dir)) {
return true; return true;
@@ -144,7 +128,7 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
@Override @Override
public IOrientable getOrientable(final BlockView w, final BlockPos pos) { public IOrientable getOrientable(final BlockView w, final BlockPos pos) {
return new MetaRotation(w, pos, BlockStateProperties.FACING); return new MetaRotation(w, pos, Properties.FACING);
} }
} }
@@ -30,10 +30,10 @@ import net.minecraft.block.Blocks;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.property.Properties;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -42,7 +42,7 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
@@ -68,42 +68,42 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
final double yOff = -0.3 * facing.getOffsetY(); final double yOff = -0.3 * facing.getOffsetY();
final double zOff = -0.3 * facing.getOffsetZ(); final double zOff = -0.3 * facing.getOffsetZ();
VoxelShape shape = VoxelShapes VoxelShape shape = VoxelShapes
.create(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7)); .cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
SHAPES.put(facing, shape); SHAPES.put(facing, shape);
} }
} }
// Cannot use the vanilla FACING property here because it excludes facing DOWN // Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = Properties.FACING;
// Used to alternate between two variants of the fixture on adjacent blocks // Used to alternate between two variants of the fixture on adjacent blocks
public static final BooleanProperty ODD = BooleanProperty.create("odd"); public static final BooleanProperty ODD = BooleanProperty.of("odd");
public QuartzFixtureBlock() { public QuartzFixtureBlock() {
super(defaultProps(Material.MISCELLANEOUS).doesNotBlockMovement().strength(0).lightValue(14) super(defaultProps(Material.SUPPORTED).noCollision().strength(0).lightLevel(14)
.sounds(BlockSoundGroup.GLASS)); .sounds(BlockSoundGroup.GLASS));
this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false)); this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING, ODD); builder.add(FACING, ODD);
} }
// For reference, see WallTorchBlock // For reference, see WallTorchBlock
@Override @Override
@Nullable @Nullable
public BlockState getStateForPlacement(ItemPlacementContext context) { public BlockState getPlacementState(ItemPlacementContext context) {
BlockState blockstate = super.getStateForPlacement(context); BlockState blockstate = super.getPlacementState(context);
BlockPos pos = context.getBlockPos(); BlockPos pos = context.getBlockPos();
// Set the even/odd property // Set the even/odd property
boolean oddPlacement = ((pos.getX() + pos.getY() + pos.getZ()) % 2) != 0; boolean oddPlacement = ((pos.getX() + pos.getY() + pos.getZ()) % 2) != 0;
blockstate = blockstate.with(ODD, oddPlacement); blockstate = blockstate.with(ODD, oddPlacement);
IWorldReader iworldreader = context.getWorld(); WorldView iworldreader = context.getWorld();
Direction[] adirection = context.getNearestLookingDirections(); Direction[] adirection = context.getPlacementDirections();
for (Direction direction : adirection) { for (Direction direction : adirection) {
if (canPlaceAt(iworldreader, pos, direction)) { if (canPlaceAt(iworldreader, pos, direction)) {
@@ -117,7 +117,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
// Break the fixture if the block it is attached to is changed so that it could // Break the fixture if the block it is attached to is changed so that it could
// no longer be placed // no longer be placed
@Override @Override
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, WorldAccess worldIn, public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess worldIn,
BlockPos pos, BlockPos facingPos) { BlockPos pos, BlockPos facingPos) {
Direction fixtureFacing = state.get(FACING); Direction fixtureFacing = state.get(FACING);
if (facing.getOpposite() == fixtureFacing && !canPlaceAt(worldIn, pos, facing)) { if (facing.getOpposite() == fixtureFacing && !canPlaceAt(worldIn, pos, facing)) {
@@ -133,21 +133,21 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
return this.canPlaceAt(w, pos, up.getOpposite()); return this.canPlaceAt(w, pos, up.getOpposite());
} }
private boolean canPlaceAt(final IWorldReader w, final BlockPos pos, final Direction dir) { private boolean canPlaceAt(final WorldView w, final BlockPos pos, final Direction dir) {
final BlockPos test = pos.offset(dir); final BlockPos test = pos.offset(dir);
BlockState blockstate = w.getBlockState(test); BlockState blockstate = w.getBlockState(test);
return blockstate.isSolidSide(w, test, dir.getOpposite()); return blockstate.isSideSolidFullSquare(w, test, dir.getOpposite());
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
Direction facing = state.get(FACING); Direction facing = state.get(FACING);
return SHAPES.get(facing); return SHAPES.get(facing);
} }
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
@@ -170,7 +170,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
// FIXME: Replaced by the postPlaceupdate stuff above, but check item drops! // FIXME: Replaced by the postPlaceupdate stuff above, but check item drops!
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final Direction up = this.getOrientable(world, pos).getUp(); final Direction up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) { if (!this.canPlaceAt(world, pos, up.getOpposite())) {
@@ -185,7 +185,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
} }
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView w, BlockPos pos) {
for (final Direction dir : Direction.values()) { for (final Direction dir : Direction.values()) {
if (this.canPlaceAt(w, pos, dir)) { if (this.canPlaceAt(w, pos, dir)) {
return true; return true;
@@ -199,9 +199,4 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
return new MetaRotation(w, pos, FACING); return new MetaRotation(w, pos, FACING);
} }
@Override
public boolean isOpaque() {
return false;
}
} }
@@ -26,8 +26,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -44,7 +44,7 @@ import appeng.util.Platform;
public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAcceleratorBlockEntity> public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAcceleratorBlockEntity>
implements IOrientableBlock { implements IOrientableBlock {
private static final BooleanProperty POWERED = BooleanProperty.create("powered"); private static final BooleanProperty POWERED = BooleanProperty.of("powered");
public QuartzGrowthAcceleratorBlock() { public QuartzGrowthAcceleratorBlock() {
super(defaultProps(Material.STONE).sounds(BlockSoundGroup.METAL)); super(defaultProps(Material.STONE).sounds(BlockSoundGroup.METAL));
@@ -57,14 +57,14 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(POWERED); builder.add(POWERED);
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
@@ -99,30 +99,30 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
case 0: case 0:
dx = 0.6; dx = 0.6;
dz = d1; dz = d1;
pt = new BlockPos(x + west.getOffsetX(), y + west.getOffsetY(), z + west.getZOffset()); pt = new BlockPos(x + west.getOffsetX(), y + west.getOffsetY(), z + west.getOffsetZ());
break; break;
case 1: case 1:
dx = d1; dx = d1;
dz += 0.6; dz += 0.6;
pt = new BlockPos(x + forward.getOffsetX(), y + forward.getOffsetY(), z + forward.getZOffset()); pt = new BlockPos(x + forward.getOffsetX(), y + forward.getOffsetY(), z + forward.getOffsetZ());
break; break;
case 2: case 2:
dx = d1; dx = d1;
dz = -0.6; dz = -0.6;
pt = new BlockPos(x - forward.getOffsetX(), y - forward.getOffsetY(), z - forward.getZOffset()); pt = new BlockPos(x - forward.getOffsetX(), y - forward.getOffsetY(), z - forward.getOffsetZ());
break; break;
case 3: case 3:
dx = -0.6; dx = -0.6;
dz = d1; dz = d1;
pt = new BlockPos(x - west.getOffsetX(), y - west.getOffsetY(), z - west.getZOffset()); pt = new BlockPos(x - west.getOffsetX(), y - west.getOffsetY(), z - west.getOffsetZ());
break; break;
} }
if (!w.getBlockState(pt).getBlock().isAir(w.getBlockState(pt), w, pt)) { if (!w.getBlockState(pt).isAir()) {
return; return;
} }
@@ -134,7 +134,7 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
ry += dz * forward.getOffsetY(); ry += dz * forward.getOffsetY();
rz += dz * forward.getOffsetZ(); rz += dz * forward.getOffsetZ();
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D, 0.0D); MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D, 0.0D);
} }
} }
@@ -25,8 +25,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -41,17 +41,17 @@ import appeng.tile.misc.SecurityStationBlockEntity;
public class SecurityStationBlock extends AEBaseTileBlock<SecurityStationBlockEntity> { public class SecurityStationBlock extends AEBaseTileBlock<SecurityStationBlockEntity> {
private static final BooleanProperty POWERED = BooleanProperty.create("powered"); private static final BooleanProperty POWERED = BooleanProperty.of("powered");
public SecurityStationBlock() { public SecurityStationBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
this.setDefaultState(this.getDefaultState().with(POWERED, false)); this.setDefaultState(this.getDefaultState().with(POWERED, false));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(POWERED); builder.add(POWERED);
} }
@@ -74,7 +74,7 @@ public class SecurityStationBlock extends AEBaseTileBlock<SecurityStationBlockEn
} }
ContainerOpener.openContainer(SecurityStationContainer.TYPE, p, ContainerOpener.openContainer(SecurityStationContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
return ActionResult.PASS; return ActionResult.PASS;
@@ -29,7 +29,7 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock; import appeng.block.AEBaseTileBlock;
@@ -53,11 +53,11 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
private boolean canPlaceAt(final BlockView w, final BlockPos pos, final Direction dir) { private boolean canPlaceAt(final BlockView w, final BlockPos pos, final Direction dir) {
final BlockPos test = pos.offset(dir); final BlockPos test = pos.offset(dir);
BlockState blockstate = w.getBlockState(test); BlockState blockstate = w.getBlockState(test);
return blockstate.isSolidSide(w, test, dir.getOpposite()); return blockstate.isSideSolidFullSquare(w, test, dir.getOpposite());
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final SkyCompassBlockEntity sc = this.getBlockEntity(world, pos); final SkyCompassBlockEntity sc = this.getBlockEntity(world, pos);
final Direction forward = sc.getForward(); final Direction forward = sc.getForward();
@@ -73,7 +73,7 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
} }
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader w, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView w, BlockPos pos) {
for (final Direction dir : Direction.values()) { for (final Direction dir : Direction.values()) {
if (this.canPlaceAt(w, pos, dir)) { if (this.canPlaceAt(w, pos, dir)) {
return true; return true;
@@ -83,7 +83,7 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
// TODO: This definitely needs to be memoized // TODO: This definitely needs to be memoized
@@ -139,7 +139,7 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
break; break;
} }
return VoxelShapes.create(new Box(minX, minY, minZ, maxX, maxY, maxZ)); return VoxelShapes.cuboid(new Box(minX, minY, minZ, maxX, maxY, maxZ));
} }
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
@@ -26,7 +26,7 @@ import appeng.bootstrap.TileEntityRenderingCustomizer;
import appeng.client.render.tesr.SkyCompassTESR; import appeng.client.render.tesr.SkyCompassTESR;
import appeng.tile.misc.SkyCompassBlockEntity; import appeng.tile.misc.SkyCompassBlockEntity;
public class SkyCompassRendering extends TileEntityRenderingCustomizer<SkyCompassBlockEntity> { public class SkyCompassRendering implements TileEntityRenderingCustomizer<SkyCompassBlockEntity> {
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@@ -25,23 +25,22 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.Explosion; import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.server.world.ServerWorld;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.entity.TinyTNTPrimedEntity; import appeng.entity.TinyTNTPrimedEntity;
@@ -49,11 +48,10 @@ import appeng.entity.TinyTNTPrimedEntity;
public class TinyTNTBlock extends AEBaseBlock { public class TinyTNTBlock extends AEBaseBlock {
private static final VoxelShape SHAPE = VoxelShapes private static final VoxelShape SHAPE = VoxelShapes
.create(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f)); .cuboid(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
public TinyTNTBlock(Settings props) { public TinyTNTBlock(Settings props) {
super(props); super(props);
setFullSize(setOpaque(false));
} }
@Override @Override
@@ -62,7 +60,7 @@ public class TinyTNTBlock extends AEBaseBlock {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return SHAPE; return SHAPE;
} }
@@ -72,8 +70,8 @@ public class TinyTNTBlock extends AEBaseBlock {
if (heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL) { if (heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL) {
this.startFuse(w, pos, player); this.startFuse(w, pos, player);
w.removeBlock(pos, false); w.removeBlock(pos, false);
heldItem.damageItem(1, player, p -> { heldItem.damage(1, player, p -> {
p.sendBreakAnimation(hand); p.sendToolBreakStatus(hand);
}); // FIXME Check if onBroken is equivalent }); // FIXME Check if onBroken is equivalent
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} else { } else {
@@ -92,9 +90,8 @@ public class TinyTNTBlock extends AEBaseBlock {
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
boolean isMoving) { if (world.isReceivingRedstonePower(pos)) {
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(world, pos, null); this.startFuse(world, pos, null);
world.removeBlock(pos, false); world.removeBlock(pos, false);
} }
@@ -104,28 +101,24 @@ public class TinyTNTBlock extends AEBaseBlock {
public void onBlockAdded(BlockState state, World w, BlockPos pos, BlockState oldState, boolean isMoving) { public void onBlockAdded(BlockState state, World w, BlockPos pos, BlockState oldState, boolean isMoving) {
super.onBlockAdded(state, w, pos, oldState, isMoving); super.onBlockAdded(state, w, pos, oldState, isMoving);
if (w.getRedstonePowerFromNeighbors(pos) > 0) { if (w.getReceivedStrongRedstonePower(pos) > 0) {
this.startFuse(w, pos, null); this.startFuse(w, pos, null);
w.removeBlock(pos, false); w.removeBlock(pos, false);
} }
} }
@Override @Override
public void onEntityWalk(final World w, final BlockPos pos, final Entity entity) { public void onSteppedOn(final World w, final BlockPos pos, final Entity entity) {
if (entity instanceof AbstractArrowEntity && !w.isClient) { if (entity instanceof PersistentProjectileEntity && !w.isClient) {
final AbstractArrowEntity entityarrow = (AbstractArrowEntity) entity; final PersistentProjectileEntity entityarrow = (PersistentProjectileEntity) entity;
if (entityarrow.isBurning()) { if (entityarrow.isOnFire()) {
LivingEntity igniter = null; LivingEntity igniter = null;
// Check if the shooter still exists // Check if the shooter still exists
if (w instanceof ServerWorld) { Entity shooter = entityarrow.getOwner();
ServerWorld serverWorld = (ServerWorld) w;
Entity shooter = serverWorld.getEntityByUuid(entityarrow.shootingEntity);
if (shooter instanceof LivingEntity) { if (shooter instanceof LivingEntity) {
igniter = (LivingEntity) shooter; igniter = (LivingEntity) shooter;
} }
}
this.startFuse(w, pos, igniter); this.startFuse(w, pos, igniter);
w.removeBlock(pos, false); w.removeBlock(pos, false);
} }
@@ -133,18 +126,18 @@ public class TinyTNTBlock extends AEBaseBlock {
} }
@Override @Override
public boolean canDropFromExplosion(final Explosion exp) { public boolean shouldDropItemsOnExplosion(final Explosion exp) {
return false; return false;
} }
@Override @Override
public void onExplosionDestroy(final World w, final BlockPos pos, final Explosion exp) { public void onDestroyedByExplosion(final World w, final BlockPos pos, final Explosion exp) {
super.onExplosionDestroy(w, pos, exp); super.onDestroyedByExplosion(w, pos, exp);
if (!w.isClient) { if (!w.isClient) {
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F, final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F,
pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getExplosivePlacedBy()); pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getCausingEntity());
primedTinyTNTEntity primedTinyTNTEntity
.setFuse(w.rand.nextInt(primedTinyTNTEntity.getFuse() / 4) + primedTinyTNTEntity.getFuse() / 8); .setFuse(w.random.nextInt(primedTinyTNTEntity.getFuse() / 4) + primedTinyTNTEntity.getFuse() / 8);
w.spawnEntity(primedTinyTNTEntity); w.spawnEntity(primedTinyTNTEntity);
} }
} }
@@ -27,9 +27,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@@ -42,17 +42,16 @@ import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener; import appeng.container.ContainerOpener;
import appeng.container.implementations.VibrationChamberContainer; import appeng.container.implementations.VibrationChamberContainer;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.tile.AEBaseBlockEntity;
import appeng.tile.misc.VibrationChamberBlockEntity; import appeng.tile.misc.VibrationChamberBlockEntity;
import appeng.util.Platform; import appeng.util.Platform;
public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChamberBlockEntity> { public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChamberBlockEntity> {
// Indicates that the vibration chamber is currently working // Indicates that the vibration chamber is currently working
private static final BooleanProperty ACTIVE = BooleanProperty.create("active"); private static final BooleanProperty ACTIVE = BooleanProperty.of("active");
public VibrationChamberBlock() { public VibrationChamberBlock() {
super(defaultProps(Material.IRON).strength(4.2F)); super(defaultProps(Material.METAL).strength(4.2F));
this.setDefaultState(this.getDefaultState().with(ACTIVE, false)); this.setDefaultState(this.getDefaultState().with(ACTIVE, false));
} }
@@ -62,8 +61,8 @@ public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChambe
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(ACTIVE); builder.add(ACTIVE);
} }
@@ -78,7 +77,7 @@ public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChambe
final VibrationChamberBlockEntity tc = this.getBlockEntity(w, pos); final VibrationChamberBlockEntity tc = this.getBlockEntity(w, pos);
if (tc != null && !player.isInSneakingPose()) { if (tc != null && !player.isInSneakingPose()) {
ContainerOpener.openContainer(VibrationChamberContainer.TYPE, player, ContainerOpener.openContainer(VibrationChamberContainer.TYPE, player,
ContainerLocator.forTileEntitySide(tc, hit.getFace())); ContainerLocator.forTileEntitySide(tc, hit.getSide()));
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
} }
@@ -87,21 +86,19 @@ public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChambe
} }
@Override @Override
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
final AEBaseBlockEntity tile = this.getBlockEntity(w, pos); final VibrationChamberBlockEntity tile = this.getBlockEntity(w, pos);
if (tile instanceof VibrationChamberBlockEntity) { if (tile != null && tile.isOn) {
final VibrationChamberBlockEntity tc = (VibrationChamberBlockEntity) tile;
if (tc.isOn) {
double f1 = pos.getX() + 0.5F; double f1 = pos.getX() + 0.5F;
double f2 = pos.getY() + 0.5F; double f2 = pos.getY() + 0.5F;
double f3 = pos.getZ() + 0.5F; double f3 = pos.getZ() + 0.5F;
final Direction forward = tc.getForward(); final Direction forward = tile.getForward();
final Direction up = tc.getUp(); final Direction up = tile.getUp();
final int west_x = forward.getOffsetY() * up.getOffsetZ() - forward.getOffsetZ() * up.getOffsetY(); final int west_x = forward.getOffsetY() * up.getOffsetZ() - forward.getOffsetZ() * up.getOffsetY();
final int west_y = forward.getOffsetZ() * up.getOffsetX() - forward.getOffsetX() * up.getOffsetZ(); final int west_y = forward.getOffsetZ() * up.getOffsetX() - forward.getOffsetX() * up.getOffsetZ();
@@ -127,4 +124,3 @@ public final class VibrationChamberBlock extends AEBaseTileBlock<VibrationChambe
} }
} }
} }
}
@@ -53,7 +53,7 @@ import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadeContainer;
@@ -81,7 +81,9 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer(); private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
public CableBusBlock() { public CableBusBlock() {
super(defaultProps(AEGlassMaterial.INSTANCE).notSolid().noDrops()); super(defaultProps(AEGlassMaterial.INSTANCE)
.nonOpaque()
.dropsNothing());
} }
@Override @Override
@@ -90,17 +92,17 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
} }
@Override @Override
public void animateTick(final BlockState state, final World worldIn, final BlockPos pos, final Random rand) { public void randomDisplayTick(final BlockState state, final World worldIn, final BlockPos pos, final Random rand) {
this.cb(worldIn, pos).animateTick(worldIn, pos, rand); this.cb(worldIn, pos).randomDisplayTick(worldIn, pos, rand);
} }
@Override @Override
public void onNeighborChange(BlockState state, IWorldReader w, BlockPos pos, BlockPos neighbor) { public void onNeighborChange(BlockState state, WorldView w, BlockPos pos, BlockPos neighbor) {
this.cb(w, pos).onNeighborChanged(w, pos, neighbor); this.cb(w, pos).onneighborUpdate(w, pos, neighbor);
} }
@Override @Override
public int getWeakPower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) { public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO: return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
// IS // IS
// OPPOSITE!? // OPPOSITE!?
@@ -126,13 +128,13 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
@Override @Override
public int getLightValue(final BlockState state, final BlockView world, final BlockPos pos) { public int getLightValue(final BlockState state, final BlockView world, final BlockPos pos) {
if (state.getBlock() != this) { if (state.getBlock() != this) {
return state.getBlock().getLightValue(state, world, pos); return state.getLuminance();
} }
return this.cb(world, pos).getLightValue(); return this.cb(world, pos).getLightValue();
} }
@Override @Override
public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) { public boolean isLadder(BlockState state, WorldView world, BlockPos pos, LivingEntity entity) {
return this.cb(world, pos).isLadder(entity); return this.cb(world, pos).isLadder(entity);
} }
@@ -273,10 +275,10 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
if (Platform.isServer()) { if (Platform.isServer()) {
this.cb(world, pos).onNeighborChanged(world, pos, fromPos); this.cb(world, pos).onneighborUpdate(world, pos, fromPos);
} }
} }
@@ -364,7 +366,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
CableBusBlockEntity te = getBlockEntity(w, pos); CableBusBlockEntity te = getBlockEntity(w, pos);
if (te == null) { if (te == null) {
return VoxelShapes.empty(); return VoxelShapes.empty();
@@ -22,7 +22,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -67,14 +67,14 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
ControllerRenderType.class); ControllerRenderType.class);
public ControllerBlock() { public ControllerBlock() {
super(defaultProps(Material.IRON).strength(6)); super(defaultProps(Material.METAL).strength(6));
this.setDefaultState(this.getDefaultState().with(CONTROLLER_STATE, ControllerBlockState.offline) this.setDefaultState(this.getDefaultState().with(CONTROLLER_STATE, ControllerBlockState.offline)
.with(CONTROLLER_TYPE, ControllerRenderType.block)); .with(CONTROLLER_TYPE, ControllerRenderType.block));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(CONTROLLER_STATE); builder.add(CONTROLLER_STATE);
builder.add(CONTROLLER_TYPE); builder.add(CONTROLLER_TYPE);
} }
@@ -86,7 +86,7 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
* texture feel for the controller based on how it is placed. * texture feel for the controller based on how it is placed.
*/ */
@Override @Override
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, WorldAccess world, public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess world,
BlockPos pos, BlockPos facingPos) { BlockPos pos, BlockPos facingPos) {
// FIXME: this might work, or might _NOT_ work, but needs to be investigated // FIXME: this might work, or might _NOT_ work, but needs to be investigated
@@ -130,7 +130,7 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final ControllerBlockEntity tc = this.getBlockEntity(world, pos); final ControllerBlockEntity tc = this.getBlockEntity(world, pos);
if (tc != null) { if (tc != null) {
@@ -26,6 +26,6 @@ import appeng.tile.networking.EnergyAcceptorBlockEntity;
public class EnergyAcceptorBlock extends AEBaseTileBlock<EnergyAcceptorBlockEntity> { public class EnergyAcceptorBlock extends AEBaseTileBlock<EnergyAcceptorBlockEntity> {
public EnergyAcceptorBlock() { public EnergyAcceptorBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
} }
@@ -26,7 +26,7 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import appeng.block.AEBaseTileBlock; import appeng.block.AEBaseTileBlock;
@@ -59,8 +59,8 @@ public class EnergyCellBlock extends AEBaseTileBlock<EnergyCellBlockEntity> {
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(ENERGY_STORAGE); builder.add(ENERGY_STORAGE);
} }
@@ -22,7 +22,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@@ -79,8 +79,8 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(STATE); builder.add(STATE);
} }
@@ -92,7 +92,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
if (tg != null && !player.isInSneakingPose()) { if (tg != null && !player.isInSneakingPose()) {
if (Platform.isServer()) { if (Platform.isServer()) {
ContainerOpener.openContainer(WirelessContainer.TYPE, player, ContainerOpener.openContainer(WirelessContainer.TYPE, player,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -101,7 +101,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
final WirelessBlockEntity tile = this.getBlockEntity(w, pos); final WirelessBlockEntity tile = this.getBlockEntity(w, pos);
if (tile != null) { if (tile != null) {
final Direction forward = tile.getForward(); final Direction forward = tile.getForward();
@@ -154,7 +154,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
break; break;
} }
return VoxelShapes.create(new Box(minX, minY, minZ, maxX, maxY, maxZ)); return VoxelShapes.cuboid(new Box(minX, minY, minZ, maxX, maxY, maxZ));
} }
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
@@ -214,7 +214,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
break; break;
} }
return VoxelShapes.create(new Box(minX, minY, minZ, maxX, maxY, maxZ)); return VoxelShapes.cuboid(new Box(minX, minY, minZ, maxX, maxY, maxZ));
} else { } else {
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
@@ -54,17 +54,17 @@ public class PaintSplotchesBlock extends AEBaseTileBlock<PaintSplotchesBlockEnti
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final PaintSplotchesBlockEntity tp = this.getBlockEntity(world, pos); final PaintSplotchesBlockEntity tp = this.getBlockEntity(world, pos);
if (tp != null) { if (tp != null) {
tp.neighborChanged(); tp.neighborUpdate();
} }
} }
@@ -20,8 +20,8 @@ package appeng.block.qnb;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
@@ -35,13 +35,13 @@ import appeng.tile.qnb.QuantumBridgeBlockEntity;
public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeBlockEntity> { public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeBlockEntity> {
public static final BooleanProperty FORMED = BooleanProperty.create("formed"); public static final BooleanProperty FORMED = BooleanProperty.of("formed");
private static final VoxelShape SHAPE; private static final VoxelShape SHAPE;
static { static {
final float shave = 2.0f / 16.0f; final float shave = 2.0f / 16.0f;
SHAPE = VoxelShapes.create(new Box(shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave)); SHAPE = VoxelShapes.cuboid(new Box(shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave));
} }
public QuantumBaseBlock(Settings props) { public QuantumBaseBlock(Settings props) {
@@ -51,13 +51,13 @@ public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeBloc
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return SHAPE; return SHAPE;
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(FORMED); builder.add(FORMED);
} }
@@ -67,7 +67,7 @@ public abstract class QuantumBaseBlock extends AEBaseTileBlock<QuantumBridgeBloc
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final QuantumBridgeBlockEntity bridge = this.getBlockEntity(world, pos); final QuantumBridgeBlockEntity bridge = this.getBlockEntity(world, pos);
if (bridge != null) { if (bridge != null) {
@@ -51,7 +51,7 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
static { static {
final double onePixel = 2.0 / 16.0; final double onePixel = 2.0 / 16.0;
SHAPE = VoxelShapes.create( SHAPE = VoxelShapes.cuboid(
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel)); new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
} }
@@ -60,7 +60,7 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
} }
@Override @Override
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random rand) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random rand) {
final QuantumBridgeBlockEntity bridge = this.getBlockEntity(w, pos); final QuantumBridgeBlockEntity bridge = this.getBlockEntity(w, pos);
if (bridge != null) { if (bridge != null) {
if (bridge.hasQES()) { if (bridge.hasQES()) {
@@ -90,7 +90,7 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return SHAPE; return SHAPE;
} }
@@ -36,11 +36,11 @@ public class QuantumRingBlock extends QuantumBaseBlock {
private static final VoxelShape SHAPE_FORMED = createShape(1.0 / 16.0); private static final VoxelShape SHAPE_FORMED = createShape(1.0 / 16.0);
public QuantumRingBlock() { public QuantumRingBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView w, BlockPos pos, ShapeContext context) {
final QuantumBridgeBlockEntity bridge = this.getBlockEntity(w, pos); final QuantumBridgeBlockEntity bridge = this.getBlockEntity(w, pos);
if (bridge != null && bridge.isCorner()) { if (bridge != null && bridge.isCorner()) {
return SHAPE_CORNER; return SHAPE_CORNER;
@@ -51,7 +51,7 @@ public class QuantumRingBlock extends QuantumBaseBlock {
} }
private static VoxelShape createShape(double onePixel) { private static VoxelShape createShape(double onePixel) {
return VoxelShapes.create( return VoxelShapes.cuboid(
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel)); new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
} }
} }
@@ -32,9 +32,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext; import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.Explosion; import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@@ -71,13 +71,13 @@ public class MatrixFrameBlock extends AEBaseBlock {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
// This also prevents any blocks from being placed on this block! // This also prevents any blocks from being placed on this block!
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView worldIn, BlockPos pos) {
return false; return false;
} }
@@ -41,11 +41,11 @@ import appeng.util.Platform;
public class SpatialIOPortBlock extends AEBaseTileBlock<SpatialIOPortBlockEntity> { public class SpatialIOPortBlock extends AEBaseTileBlock<SpatialIOPortBlockEntity> {
public SpatialIOPortBlock() { public SpatialIOPortBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final SpatialIOPortBlockEntity te = this.getBlockEntity(world, pos); final SpatialIOPortBlockEntity te = this.getBlockEntity(world, pos);
if (te != null) { if (te != null) {
@@ -64,7 +64,7 @@ public class SpatialIOPortBlock extends AEBaseTileBlock<SpatialIOPortBlockEntity
if (tg != null) { if (tg != null) {
if (Platform.isServer()) { if (Platform.isServer()) {
ContainerOpener.openContainer(SpatialIOPortContainer.TYPE, p, ContainerOpener.openContainer(SpatialIOPortContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -35,11 +35,11 @@ public class SpatialPylonBlock extends AEBaseTileBlock<SpatialPylonBlockEntity>
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final SpatialPylonBlockEntity tsp = this.getBlockEntity(world, pos); final SpatialPylonBlockEntity tsp = this.getBlockEntity(world, pos);
if (tsp != null) { if (tsp != null) {
tsp.neighborChanged(); tsp.neighborUpdate();
} }
} }
@@ -26,7 +26,7 @@ import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Util; import net.minecraft.util.Util;
@@ -47,13 +47,13 @@ public class ChestBlock extends AEBaseTileBlock<ChestBlockEntity> {
DriveSlotState.class); DriveSlotState.class);
public ChestBlock() { public ChestBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
this.setDefaultState(this.getDefaultState().with(SLOT_STATE, DriveSlotState.EMPTY)); this.setDefaultState(this.getDefaultState().with(SLOT_STATE, DriveSlotState.EMPTY));
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(SLOT_STATE); builder.add(SLOT_STATE);
} }
@@ -87,7 +87,7 @@ public class ChestBlock extends AEBaseTileBlock<ChestBlockEntity> {
} }
} else { } else {
ContainerOpener.openContainer(ChestContainer.TYPE, p, ContainerOpener.openContainer(ChestContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@@ -39,7 +39,7 @@ import appeng.util.Platform;
public class DriveBlock extends AEBaseTileBlock<DriveBlockEntity> { public class DriveBlock extends AEBaseTileBlock<DriveBlockEntity> {
public DriveBlock() { public DriveBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -41,11 +41,11 @@ import appeng.util.Platform;
public class IOPortBlock extends AEBaseTileBlock<IOPortBlockEntity> { public class IOPortBlock extends AEBaseTileBlock<IOPortBlockEntity> {
public IOPortBlock() { public IOPortBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {
final IOPortBlockEntity te = this.getBlockEntity(world, pos); final IOPortBlockEntity te = this.getBlockEntity(world, pos);
if (te != null) { if (te != null) {
@@ -64,7 +64,7 @@ public class IOPortBlock extends AEBaseTileBlock<IOPortBlockEntity> {
if (tg != null) { if (tg != null) {
if (Platform.isServer()) { if (Platform.isServer()) {
ContainerOpener.openContainer(IOPortContainer.TYPE, p, ContainerOpener.openContainer(IOPortContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -86,10 +86,10 @@ public class SkyChestBlock extends AEBaseTileBlock<SkyChestBlockEntity> {
} }
@Override @Override
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) { public VoxelShape getOutlineShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
// TODO Cache this! It can't be that hard! // TODO Cache this! It can't be that hard!
Box aabb = computeAABB(worldIn, pos); Box aabb = computeAABB(worldIn, pos);
return VoxelShapes.create(aabb); return VoxelShapes.cuboid(aabb);
} }
private Box computeAABB(final BlockView w, final BlockPos pos) { private Box computeAABB(final BlockView w, final BlockPos pos) {
@@ -174,7 +174,7 @@ public class ClientHelper extends ServerHelper {
final double d1 = (Platform.getRandomFloat() - 0.5F) * 0.26D; final double d1 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
final double d2 = (Platform.getRandomFloat() - 0.5F) * 0.26D; final double d2 = (Platform.getRandomFloat() - 0.5F) * 0.26D;
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.VIBRANT, x + d0, y + d1, z + d2, 0.0D, 0.0D, MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.VIBRANT, x + d0, y + d1, z + d2, 0.0D, 0.0D,
0.0D); 0.0D);
} }
} }
@@ -184,12 +184,12 @@ public class ClientHelper extends ServerHelper {
final float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f; final float y = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
final float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f; final float z = (float) (((Platform.getRandomInt() % 100) * 0.01) - 0.5) * 0.7f;
MinecraftClient.getInstance().particles.addParticle(EnergyParticleData.FOR_BLOCK, posX + x, posY + y, posZ + z, MinecraftClient.getInstance().particleManager.addParticle(EnergyParticleData.FOR_BLOCK, posX + x, posY + y, posZ + z,
-x * 0.1, -y * 0.1, -z * 0.1); -x * 0.1, -y * 0.1, -z * 0.1);
} }
private void spawnLightning(final World world, final double posX, final double posY, final double posZ) { private void spawnLightning(final World world, final double posX, final double posY, final double posZ) {
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.LIGHTNING, posX, posY + 0.3f, posZ, 0.0f, 0.0f, MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, posX, posY + 0.3f, posZ, 0.0f, 0.0f,
0.0f); 0.0f);
} }
@@ -197,7 +197,7 @@ public class ClientHelper extends ServerHelper {
final Vec3d second) { final Vec3d second) {
final LightningFX fx = new LightningArcFX(world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f, final LightningFX fx = new LightningArcFX(world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f,
0.0f); 0.0f);
MinecraftClient.getInstance().particles.addEffect(fx); MinecraftClient.getInstance().particleManager.addParticle(fx);
} }
private void wheelEvent(final InputEvent.MouseScrollEvent me) { private void wheelEvent(final InputEvent.MouseScrollEvent me) {
@@ -57,7 +57,7 @@ public abstract class DelegateBakedModel implements BakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
baseModel.handlePerspective(cameraTransformType, mat); baseModel.handlePerspective(cameraTransformType, mat);
return this; return this;
} }
@@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.render.model.json.ModelOverrideList; import net.minecraft.client.render.model.json.ModelOverrideList;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.Material; import net.minecraft.client.render.model.Material;
@@ -108,7 +108,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel {
} }
return new DummyFluidBakedModel( return new DummyFluidBakedModel(
ItemLayerModel.getQuadsForSprite(0, sprite, TransformationMatrix.identity())); ItemLayerModel.getQuadsForSprite(0, sprite, AffineTransformation.identity()));
} }
}; };
} }
@@ -22,7 +22,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Quaternion; import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.renderer.Vector4f; import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@@ -22,9 +22,9 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.renderer.Vector3f;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig; import appeng.core.AEConfig;
@@ -67,7 +67,7 @@ public class StackSizeRenderer {
final float inverseScaleFactor = 1.0f / scaleFactor; final float inverseScaleFactor = 1.0f / scaleFactor;
final int offset = AEConfig.instance().isUseLargeFonts() ? 0 : -1; final int offset = AEConfig.instance().isUseLargeFonts() ? 0 : -1;
TransformationMatrix tm = new TransformationMatrix(new Vector3f(0, 0, 300), // Taken from AffineTransformation tm = new AffineTransformation(new Vector3f(0, 0, 300), // Taken from
// ItemRenderer.renderItemOverlayIntoGUI // ItemRenderer.renderItemOverlayIntoGUI
null, new Vector3f(scaleFactor, scaleFactor, scaleFactor), null); null, new Vector3f(scaleFactor, scaleFactor, scaleFactor), null);
@@ -23,7 +23,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -92,7 +92,7 @@ public class TesrRenderHelper {
// effect at least from head-on // effect at least from head-on
matrixStack.scale(scale, scale, 0.0002f); matrixStack.scale(scale, scale, 0.0002f);
MinecraftClient.getInstance().getItemRenderer().renderItem(itemStack, ModelTransformation.TransformType.GUI, MinecraftClient.getInstance().getItemRenderer().renderItem(itemStack, ModelTransformation.Mode.GUI,
combinedLightIn, OverlayTexture.NO_OVERLAY, matrixStack, buffers); combinedLightIn, OverlayTexture.NO_OVERLAY, matrixStack, buffers);
matrixStack.pop(); matrixStack.pop();
@@ -1,7 +1,7 @@
package appeng.client.render.cablebus; package appeng.client.render.cablebus;
import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.SpriteTexturedParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@@ -10,7 +10,7 @@ import net.fabricmc.api.Environment;
// Derived from Vanilla's BreakingParticle, but allows // Derived from Vanilla's BreakingParticle, but allows
// a texture to be specified directly rather than via an itemstack // a texture to be specified directly rather than via an itemstack
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class CableBusBreakingParticle extends SpriteTexturedParticle { public class CableBusBreakingParticle extends SpriteBillboardParticle {
private final float field_217571_C; private final float field_217571_C;
private final float field_217572_F; private final float field_217572_F;
@@ -365,7 +365,7 @@ public class CubeBuilder {
builder.put(i, x, y, z); builder.put(i, x, y, z);
break; break;
case NORMAL: case NORMAL:
builder.put(i, face.getOffsetX(), face.getOffsetY(), face.getZOffset()); builder.put(i, face.getOffsetX(), face.getOffsetY(), face.getOffsetZ());
break; break;
case COLOR: case COLOR:
// Color format is RGBA // Color format is RGBA
@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@@ -10,7 +10,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -30,7 +30,7 @@ import appeng.items.misc.EncodedPatternItem;
* a custom IBakedModel ({@link ShiftHoldingModelWrapper} if the player is * a custom IBakedModel ({@link ShiftHoldingModelWrapper} if the player is
* holding down shift from the override list. This custom baked model implements * holding down shift from the override list. This custom baked model implements
* {@link #doesHandlePerspectives()} and returns the crafting result model if * {@link #doesHandlePerspectives()} and returns the crafting result model if
* the model for {@link ModelTransformation.TransformType#GUI} is requested. * the model for {@link ModelTransformation.Mode#GUI} is requested.
*/ */
public class EncodedPatternBakedModel extends DelegateBakedModel { public class EncodedPatternBakedModel extends DelegateBakedModel {
@@ -71,11 +71,11 @@ public class EncodedPatternBakedModel extends DelegateBakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
// No need to re-check for shift being held since this model is only handed out // No need to re-check for shift being held since this model is only handed out
// in that case // in that case
if (cameraTransformType == ModelTransformation.TransformType.GUI) { if (cameraTransformType == ModelTransformation.Mode.GUI) {
ImmutableMap<ModelTransformation.TransformType, TransformationMatrix> transforms = PerspectiveMapWrapper ImmutableMap<ModelTransformation.Mode, AffineTransformation> transforms = PerspectiveMapWrapper
.getTransforms(outputModel.getTransformation()); .getTransforms(outputModel.getTransformation());
return PerspectiveMapWrapper.handlePerspective(this.outputModel, transforms, cameraTransformType, mat); return PerspectiveMapWrapper.handlePerspective(this.outputModel, transforms, cameraTransformType, mat);
} else { } else {
@@ -98,7 +98,7 @@ public class EncodedPatternBakedModel extends DelegateBakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
return getBaseModel().handlePerspective(cameraTransformType, mat); return getBaseModel().handlePerspective(cameraTransformType, mat);
} }
@@ -23,7 +23,7 @@ import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.RedstoneParticle; import net.minecraft.client.particle.RedstoneParticle;
import net.minecraft.particles.BasicParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.particles.RedstoneParticleData; import net.minecraft.particles.RedstoneParticleData;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@@ -50,7 +50,7 @@ public class ChargedOreFX extends RedstoneParticle {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> { public static class Factory implements IParticleFactory<DefaultParticleType> {
private final IAnimatedSprite spriteSet; private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite p_i50477_1_) { public Factory(IAnimatedSprite p_i50477_1_) {
@@ -58,7 +58,7 @@ public class ChargedOreFX extends RedstoneParticle {
} }
@Override @Override
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, public Particle makeParticle(DefaultParticleType typeIn, World worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) { double xSpeed, double ySpeed, double zSpeed) {
return new ChargedOreFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet); return new ChargedOreFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
} }
@@ -25,17 +25,17 @@ import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SpriteTexturedParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.particles.BasicParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class CraftingFx extends SpriteTexturedParticle { public class CraftingFx extends SpriteBillboardParticle {
// Offset relative to center of block, is the starting point of the particle // Offset relative to center of block, is the starting point of the particle
// movement // movement
@@ -126,7 +126,7 @@ public class CraftingFx extends SpriteTexturedParticle {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> { public static class Factory implements IParticleFactory<DefaultParticleType> {
private final IAnimatedSprite spriteSet; private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite p_i50477_1_) { public Factory(IAnimatedSprite p_i50477_1_) {
@@ -134,7 +134,7 @@ public class CraftingFx extends SpriteTexturedParticle {
} }
@Override @Override
public Particle makeParticle(BasicParticleType data, World worldIn, double x, double y, double z, double xSpeed, public Particle makeParticle(DefaultParticleType data, World worldIn, double x, double y, double z, double xSpeed,
double ySpeed, double zSpeed) { double ySpeed, double zSpeed) {
return new CraftingFx(worldIn, x, y, z, spriteSet); return new CraftingFx(worldIn, x, y, z, spriteSet);
} }
@@ -28,7 +28,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class EnergyFx extends SpriteTexturedParticle { public class EnergyFx extends SpriteBillboardParticle {
private final int startBlkX; private final int startBlkX;
private final int startBlkY; private final int startBlkY;
@@ -24,12 +24,12 @@ import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.particles.IParticleData; import net.minecraft.particle.ParticleEffect;
import net.minecraft.particles.ParticleType; import net.minecraft.particle.ParticleType;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
public class EnergyParticleData implements IParticleData { public class EnergyParticleData implements ParticleEffect {
public static final EnergyParticleData FOR_BLOCK = new EnergyParticleData(false, AEPartLocation.INTERNAL); public static final EnergyParticleData FOR_BLOCK = new EnergyParticleData(false, AEPartLocation.INTERNAL);
@@ -42,9 +42,9 @@ public class EnergyParticleData implements IParticleData {
this.direction = direction; this.direction = direction;
} }
public static final IDeserializer<EnergyParticleData> DESERIALIZER = new IDeserializer<EnergyParticleData>() { public static final Factory<EnergyParticleData> DESERIALIZER = new Factory<EnergyParticleData>() {
@Override @Override
public EnergyParticleData deserialize(ParticleType<EnergyParticleData> particleTypeIn, StringReader reader) public EnergyParticleData read(ParticleType<EnergyParticleData> particleTypeIn, StringReader reader)
throws CommandSyntaxException { throws CommandSyntaxException {
reader.expect(' '); reader.expect(' ');
boolean forItem = reader.readBoolean(); boolean forItem = reader.readBoolean();
@@ -73,7 +73,7 @@ public class EnergyParticleData implements IParticleData {
} }
@Override @Override
public String getParameters() { public String asString() {
return String.format(Locale.ROOT, "%s %s", forItem ? "true" : "false", direction.name().toLowerCase()); return String.format(Locale.ROOT, "%s %s", forItem ? "true" : "false", direction.name().toLowerCase());
} }
@@ -24,7 +24,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.client.particle.IAnimatedSprite; import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SpriteTexturedParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@@ -77,7 +77,7 @@ public class LightningArcFX extends LightningFX {
@Override @Override
public Particle makeParticle(LightningArcParticleData data, World worldIn, double x, double y, double z, public Particle makeParticle(LightningArcParticleData data, World worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) { double xSpeed, double ySpeed, double zSpeed) {
SpriteTexturedParticle lightningFX = new LightningArcFX(worldIn, x, y, z, data.target.x, data.target.y, SpriteBillboardParticle lightningFX = new LightningArcFX(worldIn, x, y, z, data.target.x, data.target.y,
data.target.z, 0, 0, 0); data.target.z, 0, 0, 0);
lightningFX.selectSpriteRandomly(this.spriteSet); lightningFX.selectSpriteRandomly(this.spriteSet);
return lightningFX; return lightningFX;
@@ -6,15 +6,15 @@ import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.particles.IParticleData; import net.minecraft.particle.ParticleEffect;
import net.minecraft.particles.ParticleType; import net.minecraft.particle.ParticleType;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
/** /**
* Contains the target point of the lightning arc (the source point is infered * Contains the target point of the lightning arc (the source point is infered
* from the particle starting position). * from the particle starting position).
*/ */
public class LightningArcParticleData implements IParticleData { public class LightningArcParticleData implements ParticleEffect {
public final Vec3d target; public final Vec3d target;
@@ -22,9 +22,9 @@ public class LightningArcParticleData implements IParticleData {
this.target = target; this.target = target;
} }
public static final IDeserializer<LightningArcParticleData> DESERIALIZER = new IDeserializer<LightningArcParticleData>() { public static final Factory<LightningArcParticleData> DESERIALIZER = new Factory<LightningArcParticleData>() {
@Override @Override
public LightningArcParticleData deserialize(ParticleType<LightningArcParticleData> particleTypeIn, public LightningArcParticleData read(ParticleType<LightningArcParticleData> particleTypeIn,
StringReader reader) throws CommandSyntaxException { StringReader reader) throws CommandSyntaxException {
reader.expect(' '); reader.expect(' ');
float x = reader.readFloat(); float x = reader.readFloat();
@@ -58,7 +58,7 @@ public class LightningArcParticleData implements IParticleData {
} }
@Override @Override
public String getParameters() { public String asString() {
return String.format(Locale.ROOT, "%.2f %.2f %.2f", target.x, target.y, target.z); return String.format(Locale.ROOT, "%.2f %.2f %.2f", target.x, target.y, target.z);
} }
@@ -29,16 +29,16 @@ import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SpriteTexturedParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particles.BasicParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class LightningFX extends SpriteTexturedParticle { public class LightningFX extends SpriteBillboardParticle {
private static final Random RANDOM_GENERATOR = new Random(); private static final Random RANDOM_GENERATOR = new Random();
private static final int STEPS = 5; private static final int STEPS = 5;
@@ -245,7 +245,7 @@ public class LightningFX extends SpriteTexturedParticle {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> { public static class Factory implements IParticleFactory<DefaultParticleType> {
private final IAnimatedSprite spriteSet; private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite spriteSet) { public Factory(IAnimatedSprite spriteSet) {
@@ -253,7 +253,7 @@ public class LightningFX extends SpriteTexturedParticle {
} }
@Override @Override
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, public Particle makeParticle(DefaultParticleType typeIn, World worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) { double xSpeed, double ySpeed, double zSpeed) {
LightningFX lightningFX = new LightningFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed); LightningFX lightningFX = new LightningFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed);
lightningFX.selectSpriteRandomly(this.spriteSet); lightningFX.selectSpriteRandomly(this.spriteSet);
@@ -20,13 +20,13 @@ package appeng.client.render.effects;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.minecraft.client.particle.*; import net.minecraft.client.particle.*;
import net.minecraft.particles.BasicParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
public class MatterCannonFX extends SpriteTexturedParticle { public class MatterCannonFX extends SpriteBillboardParticle {
public MatterCannonFX(final World par1World, final double x, final double y, final double z, public MatterCannonFX(final World par1World, final double x, final double y, final double z,
IAnimatedSprite sprite) { IAnimatedSprite sprite) {
@@ -73,7 +73,7 @@ public class MatterCannonFX extends SpriteTexturedParticle {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> { public static class Factory implements IParticleFactory<DefaultParticleType> {
private final IAnimatedSprite spriteSet; private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite spriteSet) { public Factory(IAnimatedSprite spriteSet) {
@@ -81,7 +81,7 @@ public class MatterCannonFX extends SpriteTexturedParticle {
} }
@Override @Override
public Particle makeParticle(BasicParticleType data, World world, double x, double y, double z, double xSpeed, public Particle makeParticle(DefaultParticleType data, World world, double x, double y, double z, double xSpeed,
double ySpeed, double zSpeed) { double ySpeed, double zSpeed) {
return new MatterCannonFX(world, x, y, z, spriteSet); return new MatterCannonFX(world, x, y, z, spriteSet);
} }
@@ -1,7 +1,8 @@
package appeng.client.render.effects; package appeng.client.render.effects;
import net.minecraft.particles.BasicParticleType; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
import net.minecraft.particles.ParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.particle.ParticleType;
import appeng.core.AppEng; import appeng.core.AppEng;
@@ -10,15 +11,15 @@ public final class ParticleTypes {
private ParticleTypes() { private ParticleTypes() {
} }
public static final BasicParticleType CHARGED_ORE = new BasicParticleType(false); public static final DefaultParticleType CHARGED_ORE = FabricParticleTypes.simple(false);
public static final BasicParticleType CRAFTING = new BasicParticleType(false); public static final DefaultParticleType CRAFTING = FabricParticleTypes.simple(false);
public static final ParticleType<EnergyParticleData> ENERGY = new ParticleType<>(false, public static final ParticleType<EnergyParticleData> ENERGY = FabricParticleTypes.complex(false,
EnergyParticleData.DESERIALIZER); EnergyParticleData.DESERIALIZER);
public static final ParticleType<LightningArcParticleData> LIGHTNING_ARC = new ParticleType<>(false, public static final ParticleType<LightningArcParticleData> LIGHTNING_ARC = FabricParticleTypes.complex(false,
LightningArcParticleData.DESERIALIZER); LightningArcParticleData.DESERIALIZER);
public static final BasicParticleType LIGHTNING = new BasicParticleType(false); public static final DefaultParticleType LIGHTNING = FabricParticleTypes.simple(false);
public static final BasicParticleType MATTER_CANNON = new BasicParticleType(false); public static final DefaultParticleType MATTER_CANNON = FabricParticleTypes.simple(false);
public static final BasicParticleType VIBRANT = new BasicParticleType(false); public static final DefaultParticleType VIBRANT = FabricParticleTypes.simple(false);
static { static {
CHARGED_ORE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx"); CHARGED_ORE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx");
@@ -24,12 +24,12 @@ import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SpriteTexturedParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.particles.BasicParticleType; import net.minecraft.particle.DefaultParticleType;
import net.minecraft.world.World; import net.minecraft.world.World;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class VibrantFX extends SpriteTexturedParticle { public class VibrantFX extends SpriteBillboardParticle {
public VibrantFX(final World par1World, final double x, final double y, final double z, final double par8, public VibrantFX(final World par1World, final double x, final double y, final double z, final double par8,
final double par10, final double par12, IAnimatedSprite sprite) { final double par10, final double par12, IAnimatedSprite sprite) {
@@ -80,7 +80,7 @@ public class VibrantFX extends SpriteTexturedParticle {
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> { public static class Factory implements IParticleFactory<DefaultParticleType> {
private final IAnimatedSprite spriteSet; private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite spriteSet) { public Factory(IAnimatedSprite spriteSet) {
@@ -88,7 +88,7 @@ public class VibrantFX extends SpriteTexturedParticle {
} }
@Override @Override
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, public Particle makeParticle(DefaultParticleType typeIn, World worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) { double xSpeed, double ySpeed, double zSpeed) {
return new VibrantFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet); return new VibrantFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet);
} }
@@ -182,7 +182,7 @@ class BiometricCardBakedModel implements BakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
baseModel.handlePerspective(cameraTransformType, mat); baseModel.handlePerspective(cameraTransformType, mat);
return this; return this;
} }
@@ -113,7 +113,7 @@ class ColorApplicatorBakedModel implements BakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType, mat); return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType, mat);
} }
} }
@@ -150,7 +150,7 @@ class MemoryCardBakedModel implements BakedModel {
} }
@Override @Override
public BakedModel handlePerspective(ModelTransformation.TransformType cameraTransformType, MatrixStack mat) { public BakedModel handlePerspective(ModelTransformation.Mode cameraTransformType, MatrixStack mat) {
baseModel.handlePerspective(cameraTransformType, mat); baseModel.handlePerspective(cameraTransformType, mat);
return this; return this;
} }
@@ -35,6 +35,7 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
@@ -42,7 +43,6 @@ import net.minecraft.util.Identifier;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.BlockFaceUV; import net.minecraft.client.render.model.BlockFaceUV;
import net.minecraft.client.render.model.BlockModel; import net.minecraft.client.render.model.BlockModel;
@@ -89,7 +89,7 @@ public class UVLModelLoader implements IModelLoader<UVLModelLoader.UVLModelWrapp
.registerTypeAdapter(ItemTransformVec3f.class, new ItemTransformVec3f.Deserializer()) .registerTypeAdapter(ItemTransformVec3f.class, new ItemTransformVec3f.Deserializer())
.registerTypeAdapter(ModelTransformation.class, new ModelTransformation.Deserializer()) .registerTypeAdapter(ModelTransformation.class, new ModelTransformation.Deserializer())
.registerTypeAdapter(ItemOverride.class, new ItemOverride.Deserializer()) .registerTypeAdapter(ItemOverride.class, new ItemOverride.Deserializer())
.registerTypeAdapter(TransformationMatrix.class, new TransformationHelper.Deserializer()).create(); .registerTypeAdapter(AffineTransformation.class, new TransformationHelper.Deserializer()).create();
private static class BlockPartFaceOverrideSerializer extends BlockPartFace.Deserializer { private static class BlockPartFaceOverrideSerializer extends BlockPartFace.Deserializer {
@Override @Override
@@ -18,37 +18,35 @@
package appeng.client.render.renderable; package appeng.client.render.renderable;
import java.util.function.Function;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.Transformation;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.client.renderer.TransformationMatrix; import java.util.function.Function;
import net.minecraft.item.ItemStack;
public class ItemRenderable<T extends BlockEntity> implements Renderable<T> { public class ItemRenderable<T extends BlockEntity> implements Renderable<T> {
private final Function<T, Pair<ItemStack, TransformationMatrix>> f; private final Function<T, Pair<ItemStack, Transformation>> f;
public ItemRenderable(Function<T, Pair<ItemStack, TransformationMatrix>> f) { public ItemRenderable(Function<T, Pair<ItemStack, Transformation>> f) {
this.f = f; this.f = f;
} }
@Override @Override
public void renderTileEntityAt(T te, float partialTicks, net.minecraft.client.util.math.MatrixStack matrixStack, public void renderTileEntityAt(T te, float partialTicks, net.minecraft.client.util.math.MatrixStack matrixStack,
VertexConsumerProvider buffers, int combinedLight, int combinedOverlay) { VertexConsumerProvider buffers, int combinedLight, int combinedOverlay) {
Pair<ItemStack, TransformationMatrix> pair = this.f.apply(te); Pair<ItemStack, Transformation> pair = this.f.apply(te);
if (pair != null && pair.getLeft() != null) { if (pair != null && pair.getLeft() != null) {
if (pair.getRight() != null) {
pair.getRight().push(matrixStack);
} else {
matrixStack.push(); matrixStack.push();
if (pair.getRight() != null) {
pair.getRight().apply(true, matrixStack); // FIXME: check left handed
} }
MinecraftClient.getInstance().getItemRenderer().renderItem(pair.getLeft(), MinecraftClient.getInstance().getItemRenderer().renderItem(pair.getLeft(),
ModelTransformation.TransformType.GROUND, combinedLight, combinedOverlay, matrixStack, buffers); ModelTransformation.Mode.GROUND, combinedLight, combinedOverlay, matrixStack, buffers);
matrixStack.pop(); matrixStack.pop();
} }
} }
@@ -10,7 +10,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.renderer.RenderState; import net.minecraft.client.renderer.RenderState;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
@@ -178,7 +178,7 @@ public final class InscriberTESR extends BlockEntityRenderer<InscriberBlockEntit
vb.tex(sprite.getInterpolatedU(texU), sprite.getInterpolatedV(texV)); vb.tex(sprite.getInterpolatedU(texU), sprite.getInterpolatedV(texV));
vb.overlay(overlayUV); vb.overlay(overlayUV);
vb.lightmap(lightmapUV); vb.lightmap(lightmapUV);
vb.normal(ms.getLast().getNormal(), front.getOffsetX(), front.getOffsetY(), front.getZOffset()); vb.normal(ms.getLast().getNormal(), front.getOffsetX(), front.getOffsetY(), front.getOffsetZ());
vb.endVertex(); vb.endVertex();
} }
@@ -201,7 +201,7 @@ public final class InscriberTESR extends BlockEntityRenderer<InscriberBlockEntit
ms.scale(0.5f, 0.5f, 0.5f); ms.scale(0.5f, 0.5f, 0.5f);
} }
itemRenderer.renderItem(stack, ModelTransformation.TransformType.FIXED, combinedLight, combinedOverlay, ms, itemRenderer.renderItem(stack, ModelTransformation.Mode.FIXED, combinedLight, combinedOverlay, ms,
buffers); buffers);
ms.pop(); ms.pop();
} }
@@ -28,7 +28,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.Atlases; import net.minecraft.client.renderer.Atlases;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.render.model.Material; import net.minecraft.client.render.model.Material;
import net.minecraft.client.render.model.ModelRenderer; import net.minecraft.client.render.model.ModelRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
@@ -152,7 +152,7 @@ public class QuartzKnifeContainer extends AEBaseContainer {
if (!this.getItemHandler().extractItem(0, 1, false).isEmpty()) { if (!this.getItemHandler().extractItem(0, 1, false).isEmpty()) {
final ItemStack item = QuartzKnifeContainer.this.toolInv.getItemStack(); final ItemStack item = QuartzKnifeContainer.this.toolInv.getItemStack();
final ItemStack before = item.copy(); final ItemStack before = item.copy();
item.damageItem(1, QuartzKnifeContainer.this.getPlayerInv().player, p -> { item.damage(1, QuartzKnifeContainer.this.getPlayerInv().player, p -> {
QuartzKnifeContainer.this.getPlayerInv().setStack( QuartzKnifeContainer.this.getPlayerInv().setStack(
QuartzKnifeContainer.this.getPlayerInv().currentItem, ItemStack.EMPTY); QuartzKnifeContainer.this.getPlayerInv().currentItem, ItemStack.EMPTY);
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent( MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(
+1 -1
View File
@@ -33,7 +33,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.inventory.container.ContainerType; import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.particles.ParticleType; import net.minecraft.particle.ParticleType;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
+1 -1
View File
@@ -30,8 +30,8 @@ import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.inventory.container.ContainerType; import net.minecraft.inventory.container.ContainerType;
import net.minecraft.particle.ParticleType;
import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.particles.ParticleType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
@@ -329,7 +329,7 @@ public final class ApiBlocks implements IBlocks {
() -> new SkyChestBlock(SkyChestBlock.SkyChestType.BLOCK, skyStoneChestProps)) () -> new SkyChestBlock(SkyChestBlock.SkyChestType.BLOCK, skyStoneChestProps))
.features(AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS).tileEntity(skyChestTile).build(); .features(AEFeature.SKY_STONE, AEFeature.SKY_STONE_CHESTS).tileEntity(skyChestTile).build();
this.skyCompass = registry.block("sky_compass", () -> new SkyCompassBlock(defaultProps(Material.MISCELLANEOUS))) this.skyCompass = registry.block("sky_compass", () -> new SkyCompassBlock(defaultProps(Material.SUPPORTED)))
.features(AEFeature.METEORITE_COMPASS) .features(AEFeature.METEORITE_COMPASS)
.tileEntity(registry.tileEntity("sky_compass", SkyCompassBlockEntity.class, SkyCompassBlockEntity::new) .tileEntity(registry.tileEntity("sky_compass", SkyCompassBlockEntity.class, SkyCompassBlockEntity::new)
.rendering(new SkyCompassRendering()).build()) .rendering(new SkyCompassRendering()).build())
@@ -353,7 +353,7 @@ public final class ApiBlocks implements IBlocks {
} }
}).build()) }).build())
.build(); .build();
this.inscriber = registry.block("inscriber", () -> new InscriberBlock(defaultProps(Material.IRON).notSolid())) this.inscriber = registry.block("inscriber", () -> new InscriberBlock(defaultProps(Material.METAL).notSolid()))
.features(AEFeature.INSCRIBER) .features(AEFeature.INSCRIBER)
.tileEntity(registry.tileEntity("inscriber", InscriberBlockEntity.class, InscriberBlockEntity::new) .tileEntity(registry.tileEntity("inscriber", InscriberBlockEntity.class, InscriberBlockEntity::new)
.rendering(new InscriberRendering()).build()) .rendering(new InscriberRendering()).build())
@@ -481,7 +481,7 @@ public final class ApiBlocks implements IBlocks {
.tileEntity("crafting_unit", CraftingBlockEntity.class, CraftingBlockEntity::new).build(); .tileEntity("crafting_unit", CraftingBlockEntity.class, CraftingBlockEntity::new).build();
FeatureFactory crafting = registry.features(AEFeature.CRAFTING_CPU); FeatureFactory crafting = registry.features(AEFeature.CRAFTING_CPU);
AbstractBlock.Settings craftingBlockProps = defaultProps(Material.IRON); AbstractBlock.Settings craftingBlockProps = defaultProps(Material.METAL);
this.craftingUnit = crafting this.craftingUnit = crafting
.block("crafting_unit", () -> new CraftingUnitBlock(craftingBlockProps, CraftingUnitType.UNIT)) .block("crafting_unit", () -> new CraftingUnitBlock(craftingBlockProps, CraftingUnitType.UNIT))
.rendering(new CraftingCubeRendering()).tileEntity(craftingUnit).build(); .rendering(new CraftingCubeRendering()).tileEntity(craftingUnit).build();
@@ -539,7 +539,7 @@ public final class ApiBlocks implements IBlocks {
}).build(); }).build();
this.molecularAssembler = registry this.molecularAssembler = registry
.block("molecular_assembler", () -> new MolecularAssemblerBlock(defaultProps(Material.IRON).notSolid())) .block("molecular_assembler", () -> new MolecularAssemblerBlock(defaultProps(Material.METAL).notSolid()))
.features(AEFeature.MOLECULAR_ASSEMBLER).rendering(new BlockRenderingCustomizer() { .features(AEFeature.MOLECULAR_ASSEMBLER).rendering(new BlockRenderingCustomizer() {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
@@ -29,10 +29,10 @@ import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.client.audio.SimpleSound; import net.minecraft.client.audio.SimpleSound;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.tags.FluidTags; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.SoundCategory; import net.minecraft.tag.FluidTags;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.GameData;
@@ -116,7 +116,7 @@ public class BlockTransitionEffectPacket extends BasePacket {
double speedY = 0.1f * this.direction.yOffset; double speedY = 0.1f * this.direction.yOffset;
double speedZ = 0.1f * this.direction.zOffset; double speedZ = 0.1f * this.direction.zOffset;
MinecraftClient.getInstance().particles.addParticle(data, x, y, z, speedX, speedY, speedZ); MinecraftClient.getInstance().particleManager.addParticle(data, x, y, z, speedX, speedY, speedZ);
} }
} }
} }
@@ -82,7 +82,7 @@ public class ItemTransitionEffectPacket extends BasePacket {
double speedX = 0.1f * this.d.xOffset; double speedX = 0.1f * this.d.xOffset;
double speedY = 0.1f * this.d.yOffset; double speedY = 0.1f * this.d.yOffset;
double speedZ = 0.1f * this.d.zOffset; double speedZ = 0.1f * this.d.zOffset;
MinecraftClient.getInstance().particles.addParticle(data, x, y, z, speedX, speedY, speedZ); MinecraftClient.getInstance().particleManager.addParticle(data, x, y, z, speedX, speedY, speedZ);
} }
} }
} }
@@ -83,7 +83,7 @@ public class MatterCannonPacket extends BasePacket {
public void clientPacketData(final INetworkInfo network, final PlayerEntity player) { public void clientPacketData(final INetworkInfo network, final PlayerEntity player) {
try { try {
for (int a = 1; a < this.len; a++) { for (int a = 1; a < this.len; a++) {
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.MATTER_CANNON, this.x + this.dx * a, MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.MATTER_CANNON, this.x + this.dx * a,
this.y + this.dy * a, this.z + this.dz * a, 0, 0, 0); this.y + this.dy * a, this.z + this.dz * a, 0, 0, 0);
} }
} catch (final Exception ignored) { } catch (final Exception ignored) {
@@ -23,11 +23,9 @@ import io.netty.buffer.Unpooled;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import appeng.core.AppEng;
import appeng.core.sync.BasePacket; import appeng.core.sync.BasePacket;
import appeng.core.sync.network.INetworkInfo; import appeng.core.sync.network.INetworkInfo;
@@ -25,7 +25,7 @@ import appeng.block.AEBaseTileBlock;
public class ChunkLoaderBlock extends AEBaseTileBlock<ChunkLoaderBlockEntity> { public class ChunkLoaderBlock extends AEBaseTileBlock<ChunkLoaderBlockEntity> {
public ChunkLoaderBlock() { public ChunkLoaderBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
} }
@@ -18,7 +18,7 @@
package appeng.debug; package appeng.debug;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.Tickable;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -27,7 +27,7 @@ import net.minecraft.server.world.ServerWorld;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.tile.AEBaseBlockEntity; import appeng.tile.AEBaseBlockEntity;
public class ChunkLoaderBlockEntity extends AEBaseBlockEntity implements ITickableTileEntity { public class ChunkLoaderBlockEntity extends AEBaseBlockEntity implements Tickable {
public ChunkLoaderBlockEntity(BlockEntityType<?> tileEntityTypeIn) { public ChunkLoaderBlockEntity(BlockEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn); super(tileEntityTypeIn);
@@ -34,7 +34,7 @@ import appeng.block.AEBaseTileBlock;
public class CubeGeneratorBlock extends AEBaseTileBlock<CubeGeneratorBlockEntity> { public class CubeGeneratorBlock extends AEBaseTileBlock<CubeGeneratorBlockEntity> {
public CubeGeneratorBlock() { public CubeGeneratorBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -23,7 +23,7 @@ import net.minecraft.item.DirectionalPlaceContext;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.Tickable;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -33,7 +33,7 @@ import appeng.core.AppEng;
import appeng.tile.AEBaseBlockEntity; import appeng.tile.AEBaseBlockEntity;
import appeng.util.Platform; import appeng.util.Platform;
public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements ITickableTileEntity { public class CubeGeneratorBlockEntity extends AEBaseBlockEntity implements Tickable {
private int size = 3; private int size = 3;
private ItemStack is = ItemStack.EMPTY; private ItemStack is = ItemStack.EMPTY;
@@ -25,7 +25,7 @@ import appeng.block.AEBaseTileBlock;
public class EnergyGeneratorBlock extends AEBaseTileBlock<EnergyGeneratorBlockEntity> { public class EnergyGeneratorBlock extends AEBaseTileBlock<EnergyGeneratorBlockEntity> {
public EnergyGeneratorBlock() { public EnergyGeneratorBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
} }
@@ -24,7 +24,7 @@ import com.google.common.math.IntMath;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.util.Tickable;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
@@ -34,7 +34,7 @@ import net.minecraftforge.energy.IEnergyStorage;
import appeng.tile.AEBaseBlockEntity; import appeng.tile.AEBaseBlockEntity;
public class EnergyGeneratorBlockEntity extends AEBaseBlockEntity implements ITickableTileEntity, IEnergyStorage { public class EnergyGeneratorBlockEntity extends AEBaseBlockEntity implements Tickable, IEnergyStorage {
/** /**
* The base energy injected each tick. Adjacent TileEnergyGenerators will * The base energy injected each tick. Adjacent TileEnergyGenerators will
* increase it to pow(base, #generators). * increase it to pow(base, #generators).
+1 -1
View File
@@ -28,7 +28,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.tags.BlockTags; import net.minecraft.tag.BlockTags;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
+1 -1
View File
@@ -25,7 +25,7 @@ import appeng.block.AEBaseTileBlock;
public class ItemGenBlock extends AEBaseTileBlock<ItemGenBlockEntity> { public class ItemGenBlock extends AEBaseTileBlock<ItemGenBlockEntity> {
public ItemGenBlock() { public ItemGenBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
} }
@@ -34,7 +34,7 @@ import appeng.block.AEBaseTileBlock;
public class PhantomNodeBlock extends AEBaseTileBlock<PhantomNodeBlockEntity> { public class PhantomNodeBlock extends AEBaseTileBlock<PhantomNodeBlockEntity> {
public PhantomNodeBlock() { public PhantomNodeBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -38,7 +38,7 @@ public class ChargedQuartzOreBlock extends QuartzOreBlock {
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
@@ -72,7 +72,7 @@ public class ChargedQuartzOreBlock extends QuartzOreBlock {
} }
if (AppEng.proxy.shouldAddParticles(r)) { if (AppEng.proxy.shouldAddParticles(r)) {
MinecraftClient.getInstance().particles.addParticle(ParticleTypes.CHARGED_ORE, pos.getX() + xOff, MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.CHARGED_ORE, pos.getX() + xOff,
pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f); pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
} }
} }
@@ -38,7 +38,7 @@ public class QuartzLampBlock extends QuartzGlassBlock {
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(final BlockState state, final World w, final BlockPos pos, final Random r) { public void randomDisplayTick(final BlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) { if (!AEConfig.instance().isEnableEffects()) {
return; return;
} }
@@ -30,7 +30,7 @@ public class QuartzOreBlock extends AEBaseBlock {
} }
@Override @Override
public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, public int getExpDrop(BlockState state, net.minecraft.world.WorldView reader, BlockPos pos, int fortune,
int silktouch) { int silktouch) {
return silktouch == 0 ? MathHelper.nextInt(RANDOM, 2, 5) : 0; return silktouch == 0 ? MathHelper.nextInt(RANDOM, 2, 5) : 0;
} }
@@ -21,8 +21,8 @@ package appeng.decorative.solid;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateManager;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.property.Properties;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
@@ -33,7 +33,7 @@ import appeng.decorative.AEDecorativeBlock;
import appeng.helpers.MetaRotation; import appeng.helpers.MetaRotation;
public class QuartzPillarBlock extends AEDecorativeBlock implements IOrientableBlock { public class QuartzPillarBlock extends AEDecorativeBlock implements IOrientableBlock {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS; public static final EnumProperty<Direction.Axis> AXIS = Properties.AXIS;
public QuartzPillarBlock(Properties props) { public QuartzPillarBlock(Properties props) {
super(props); super(props);
@@ -43,8 +43,8 @@ public class QuartzPillarBlock extends AEDecorativeBlock implements IOrientableB
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.appendProperties(builder);
builder.add(AXIS); builder.add(AXIS);
} }
@@ -64,14 +64,14 @@ public class SkyStoneBlock extends AEBaseBlock {
} }
@Override @Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, WorldAccess worldIn, public BlockState getStateForNeighborUpdate(BlockState stateIn, Direction facing, BlockState facingState, WorldAccess worldIn,
BlockPos currentPos, BlockPos facingPos) { BlockPos currentPos, BlockPos facingPos) {
if (worldIn instanceof ServerWorld) { if (worldIn instanceof ServerWorld) {
WorldData.instance().compassData().service().updateArea(worldIn, new ChunkPos(currentPos), WorldData.instance().compassData().service().updateArea(worldIn, new ChunkPos(currentPos),
currentPos.getY()); currentPos.getY());
} }
return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); return super.getStateForNeighborUpdate(stateIn, facing, facingState, worldIn, currentPos, facingPos);
} }
@Override @Override
@@ -23,21 +23,17 @@ import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.*;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MoverType; import net.minecraft.entity.MoverType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.item.TNTEntity;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion; import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.Explosion.Mode; import net.minecraft.world.explosion.Explosion.Mode;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
@@ -48,7 +44,7 @@ import appeng.core.AppEng;
import appeng.core.sync.packets.MockExplosionPacket; import appeng.core.sync.packets.MockExplosionPacket;
import appeng.util.Platform; import appeng.util.Platform;
public final class TinyTNTPrimedEntity extends TNTEntity implements IEntityAdditionalSpawnData { public final class TinyTNTPrimedEntity extends TntEntity implements IEntityAdditionalSpawnData {
public static EntityType<TinyTNTPrimedEntity> TYPE; public static EntityType<TinyTNTPrimedEntity> TYPE;
@@ -24,7 +24,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.TNTMinecartRenderer; import net.minecraft.client.renderer.entity.TNTMinecartRenderer;
@@ -39,7 +39,7 @@ import appeng.util.Platform;
public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceBlockEntity> { public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceBlockEntity> {
public FluidInterfaceBlock() { public FluidInterfaceBlock() {
super(defaultProps(Material.IRON)); super(defaultProps(Material.METAL));
} }
@Override @Override
@@ -53,7 +53,7 @@ public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceBlockEnti
if (tg != null) { if (tg != null) {
if (Platform.isServer()) { if (Platform.isServer()) {
ContainerOpener.openContainer(FluidInterfaceContainer.TYPE, p, ContainerOpener.openContainer(FluidInterfaceContainer.TYPE, p,
ContainerLocator.forTileEntitySide(tg, hit.getFace())); ContainerLocator.forTileEntitySide(tg, hit.getSide()));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
@@ -13,8 +13,8 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tags.FluidTags; import net.minecraft.tag.FluidTags;
import net.minecraft.tags.Tag; import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -179,7 +179,7 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
} }
@Override @Override
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) { public void onneighborUpdate(BlockView w, BlockPos pos, BlockPos neighbor) {
if (pos.offset(this.getSide().getFacing()).equals(neighbor)) { if (pos.offset(this.getSide().getFacing()).equals(neighbor)) {
this.refresh(); this.refresh();
} }
@@ -267,7 +267,7 @@ public class FluidLevelEmitterPart extends UpgradeablePart
} }
@Override @Override
public void animateTick(final World world, final BlockPos pos, final Random r) { public void randomDisplayTick(final World world, final BlockPos pos, final Random r) {
if (this.isLevelEmitterOn()) { if (this.isLevelEmitterOn()) {
final AEPartLocation d = this.getSide(); final AEPartLocation d = this.getSide();
@@ -67,7 +67,7 @@ public abstract class SharedFluidBusPart extends UpgradeablePart implements IGri
} }
@Override @Override
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) { public void onneighborUpdate(BlockView w, BlockPos pos, BlockPos neighbor) {
this.updateState(); this.updateState();
if (this.lastRedstone != this.getHost().hasRedstone(this.getSide())) { if (this.lastRedstone != this.getHost().hasRedstone(this.getSide())) {
this.lastRedstone = !this.lastRedstone; this.lastRedstone = !this.lastRedstone;
@@ -978,7 +978,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
hostTile.getPos().getZ() + 0.5); hostTile.getPos().getZ() + 0.5);
from = from.add(direction.getOffsetX() * 0.501, direction.getOffsetY() * 0.501, from = from.add(direction.getOffsetX() * 0.501, direction.getOffsetY() * 0.501,
direction.getOffsetZ() * 0.501); direction.getOffsetZ() * 0.501);
final Vec3d to = from.add(direction.getOffsetX(), direction.getOffsetY(), direction.getZOffset()); final Vec3d to = from.add(direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ());
final BlockHitResult hit = null;// hostWorld.rayTraceBlocks( from, to ); //FIXME: final BlockHitResult hit = null;// hostWorld.rayTraceBlocks( from, to ); //FIXME:
// https://github.com/MinecraftForge/MinecraftForge/pull/6708 // https://github.com/MinecraftForge/MinecraftForge/pull/6708
if (hit != null && !BAD_BLOCKS.contains(directedBlock)) { if (hit != null && !BAD_BLOCKS.contains(directedBlock)) {
@@ -19,7 +19,7 @@
package appeng.helpers; package appeng.helpers;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.Property; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Direction.Axis; import net.minecraft.util.math.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -31,11 +31,11 @@ import appeng.decorative.solid.QuartzPillarBlock;
public class MetaRotation implements IOrientable { public class MetaRotation implements IOrientable {
private final Property<Direction> facingProp; private final DirectionProperty facingProp;
private final BlockView w; private final BlockView w;
private final BlockPos pos; private final BlockPos pos;
public MetaRotation(final BlockView world, final BlockPos pos, final Property<Direction> facingProp) { public MetaRotation(final BlockView world, final BlockPos pos, final DirectionProperty facingProp) {
this.w = world; this.w = world;
this.pos = pos; this.pos = pos;
this.facingProp = facingProp; this.facingProp = facingProp;
@@ -58,12 +58,12 @@ public class MetaRotation implements IOrientable {
public Direction getUp() { public Direction getUp() {
final BlockState state = this.w.getBlockState(this.pos); final BlockState state = this.w.getBlockState(this.pos);
if (this.facingProp != null && state.has(this.facingProp)) { if (this.facingProp != null && state.contains(this.facingProp)) {
return state.get(this.facingProp); return state.get(this.facingProp);
} }
// TODO 1.10.2-R - Temp // TODO 1.10.2-R - Temp
if (state.has(QuartzPillarBlock.AXIS)) { if (state.contains(QuartzPillarBlock.AXIS)) {
Axis a = state.get(QuartzPillarBlock.AXIS); Axis a = state.get(QuartzPillarBlock.AXIS);
switch (a) { switch (a) {
case X: case X:
@@ -26,8 +26,8 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.tags.BlockTags; import net.minecraft.tag.BlockTags;
import net.minecraft.tags.Tag; import net.minecraft.tag.Tag;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
@@ -31,7 +31,7 @@ import net.minecraft.text.TranslatableText;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
@@ -184,7 +184,7 @@ public class MemoryCardItem extends AEBaseItem implements IMemoryCard {
} }
@Override @Override
public boolean doesSneakBypassUse(ItemStack stack, IWorldReader world, BlockPos pos, PlayerEntity player) { public boolean doesSneakBypassUse(ItemStack stack, WorldView world, BlockPos pos, PlayerEntity player) {
return true; return true;
} }
@@ -32,7 +32,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.world.IWorldReader; import net.minecraft.world.WorldView;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.implementations.guiobjects.IGuiItem; import appeng.api.implementations.guiobjects.IGuiItem;
@@ -112,7 +112,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
} }
@Override @Override
public boolean doesSneakBypassUse(ItemStack stack, IWorldReader world, BlockPos pos, PlayerEntity player) { public boolean doesSneakBypassUse(ItemStack stack, WorldView world, BlockPos pos, PlayerEntity player) {
return true; return true;
} }
@@ -132,7 +132,7 @@ public class NetworkToolItem extends AEBaseItem implements IGuiItem, IAEWrench {
final BlockEntity te = w.getBlockEntity(pos); final BlockEntity te = w.getBlockEntity(pos);
if (!(te instanceof IGridHost)) { if (!(te instanceof IGridHost)) {
if (bs.rotate(w, pos, Rotation.CLOCKWISE_90) != bs) { if (bs.rotate(w, pos, Rotation.CLOCKWISE_90) != bs) {
bs.neighborChanged(w, pos, Blocks.AIR, pos, false); bs.neighborUpdate(w, pos, Blocks.AIR, pos, false);
p.swingArm(hand); p.swingArm(hand);
return !w.isClient; return !w.isClient;
} }
@@ -64,9 +64,9 @@ import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.SnowballItem; import net.minecraft.item.SnowballItem;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.IProperty; import net.minecraft.state.property.Property;
import net.minecraft.tags.ItemTags; import net.minecraft.tag.ItemTags;
import net.minecraft.tags.Tag; import net.minecraft.tag.Tag;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@@ -327,7 +327,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
Block recolored = BlockRecolorer.recolor(blk, newColor); Block recolored = BlockRecolorer.recolor(blk, newColor);
if (recolored != blk) { if (recolored != blk) {
BlockState newState = recolored.getDefaultState(); BlockState newState = recolored.getDefaultState();
for (IProperty<?> prop : newState.getProperties()) { for (Property<?> prop : newState.getProperties()) {
newState = copyProp(state, newState, prop); newState = copyProp(state, newState, prop);
} }
@@ -353,8 +353,8 @@ public class ColorApplicatorItem extends AEBasePoweredItem
} }
private static <T extends Comparable<T>> BlockState copyProp(BlockState oldState, BlockState newState, private static <T extends Comparable<T>> BlockState copyProp(BlockState oldState, BlockState newState,
IProperty<T> prop) { Property<T> prop) {
if (newState.has(prop)) { if (newState.contains(prop)) {
return newState.with(prop, oldState.get(prop)); return newState.with(prop, oldState.get(prop));
} }
return newState; return newState;
@@ -34,8 +34,9 @@ import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.item.crafting.FurnaceRecipe; import net.minecraft.item.crafting.FurnaceRecipe;
import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.RecipeType;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particle.ParticleTypes;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.sound.SoundEvents;
import net.minecraft.state.property.Properties;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -89,7 +90,7 @@ public class EntropyManipulatorItem extends AEBasePoweredItem implements IBlockT
this.heatUp.put(new InWorldToolOperationIngredient(Blocks.WATER, Fluids.FLOWING_WATER), this.heatUp.put(new InWorldToolOperationIngredient(Blocks.WATER, Fluids.FLOWING_WATER),
new InWorldToolOperationResult()); new InWorldToolOperationResult());
this.heatUp.put(new InWorldToolOperationIngredient(Blocks.SNOW), new InWorldToolOperationResult( this.heatUp.put(new InWorldToolOperationIngredient(Blocks.SNOW), new InWorldToolOperationResult(
Blocks.WATER.getDefaultState().with(BlockStateProperties.LEVEL_0_15, 7), Fluids.FLOWING_WATER)); Blocks.WATER.getDefaultState().with(Properties.LEVEL_0_15, 7), Fluids.FLOWING_WATER));
} }
private static class InWorldToolOperationIngredient { private static class InWorldToolOperationIngredient {
+2 -2
View File
@@ -202,7 +202,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
} }
@Override @Override
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) { public void onneighborUpdate(BlockView w, BlockPos pos, BlockPos neighbor) {
} }
@@ -275,7 +275,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(final World world, final BlockPos pos, final Random r) { public void randomDisplayTick(final World world, final BlockPos pos, final Random r) {
} }

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