Do some porty stuff

This commit is contained in:
grimmauld 2020-09-22 17:44:22 +02:00
parent 4beaab9b97
commit 83c64121eb
147 changed files with 757 additions and 709 deletions

View file

@ -31,6 +31,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
@ -371,31 +372,26 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
@Override
public boolean hasFastRenderer() {
return true;
}
@Override
public boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking) {
public boolean addToTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
tooltip.add(spacing + GOLD + Lang.translate("gui.stressometer.overstressed"));
tooltip.add(ITextComponent.of(spacing + GOLD + Lang.translate("gui.stressometer.overstressed")));
String hint = Lang.translate("gui.contraptions.network_overstressed", I18n.format(getBlockState().getBlock()
.getTranslationKey()));
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++)
tooltip.add((i == 0 ? "" : spacing) + cutString.get(i));
tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i)));
return true;
}
if (notFastEnough) {
tooltip.add(spacing + GOLD + Lang.translate("tooltip.speedRequirement"));
tooltip.add(ITextComponent.of(spacing + GOLD + Lang.translate("tooltip.speedRequirement")));
String hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock()
.getTranslationKey()));
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++)
tooltip.add((i == 0 ? "" : spacing) + cutString.get(i));
tooltip.add(ITextComponent.of((i == 0 ? "" : spacing) + cutString.get(i)));
return true;
}
@ -403,23 +399,23 @@ public abstract class KineticTileEntity extends SmartTileEntity
}
@Override
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
boolean added = false;
float stressAtBase = calculateStressApplied();
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) {
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats"));
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact"));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.goggles.kinetic_stats")));
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact")));
float stressTotal = stressAtBase * Math.abs(getSpeed());
String stressString =
spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
tooltip.add(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
Lang.translate("gui.goggles.base_value")));
tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
Lang.translate("gui.goggles.at_current_speed")));
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
Lang.translate("gui.goggles.base_value"))));
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
Lang.translate("gui.goggles.at_current_speed"))));
added = true;
}

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.utility.BlockHelper;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -49,7 +50,7 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
Direction direction = state.get(HORIZONTAL_FACING);
BlockPos offset = pos.offset(direction.getOpposite());
return Block.hasSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction);
return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction);
}
@Override

View file

@ -6,7 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
public class BellMovementBehaviour extends MovementBehaviour {
@Override
@ -15,7 +15,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
}
@Override
public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) {
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
double dotProduct = oldMotion.dotProduct(motion);
if (dotProduct <= 0 && (context.relativeMotion.length() != 0 || context.rotation.length() == 0)

View file

@ -135,7 +135,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
}
public void onBlockBroken(BlockState stateToBreak) {
FluidState ifluidstate = world.getFluidState(breakingPos);
FluidState FluidState = world.getFluidState(breakingPos);
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak));
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null;
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
@ -149,9 +149,9 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
world.addEntity(itementity);
}
});
stateToBreak.spawnAdditionalDrops(world, breakingPos, ItemStack.EMPTY);
world.setBlockState(breakingPos, ifluidstate.getBlockState(), 3);
if (world instanceof ServerWorld)
stateToBreak.spawnAdditionalDrops((ServerWorld) world, breakingPos, ItemStack.EMPTY);
world.setBlockState(breakingPos, FluidState.getBlockState(), 3);
}
protected float getBreakSpeed() {

View file

@ -9,10 +9,5 @@ public class HarvesterTileEntity extends SyncedTileEntity {
public HarvesterTileEntity(TileEntityType<? extends HarvesterTileEntity> type) {
super(type);
}
@Override
public boolean hasFastRenderer() {
return true;
}
}

View file

@ -49,7 +49,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
BlockRayTraceResult ray = world
.rayTraceBlocks(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player));
if (ray == null || ray.getType() != Type.BLOCK)
if (ray.getType() != Type.BLOCK)
return;
ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray);
@ -83,7 +83,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
}
private PloughFakePlayer getPlayer(MovementContext context) {
if (!(context.temporaryData instanceof PloughFakePlayer) && context.world instanceof ServerWorld) {
if (!(context.temporaryData instanceof PloughFakePlayer) && context.world != null) {
PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world);
player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
context.temporaryData = player;

View file

@ -55,7 +55,7 @@ public class SeatBlock extends Block {
@Override
public void onLanded(IBlockReader reader, Entity entity) {
BlockPos pos = entity.getPosition();
BlockPos pos = entity.getBlockPos();
if (entity instanceof PlayerEntity || !(entity instanceof LivingEntity) || isSeatOccupied(entity.world, pos)) {
Blocks.PINK_BED.onLanded(reader, entity);
return;

View file

@ -13,7 +13,7 @@ import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
import net.minecraftforge.fml.network.NetworkHooks;
@ -44,18 +44,18 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
public void setPos(double x, double y, double z) {
super.setPos(x, y, z);
AxisAlignedBB bb = getBoundingBox();
Vec3d diff = new Vec3d(x, y, z).subtract(bb.getCenter());
Vector3d diff = new Vector3d(x, y, z).subtract(bb.getCenter());
setBoundingBox(bb.offset(diff));
}
@Override
public void setMotion(Vec3d p_213317_1_) {}
public void setMotion(Vector3d p_213317_1_) {}
@Override
public void tick() {
if (world.isRemote)
return;
boolean blockPresent = world.getBlockState(getPosition())
boolean blockPresent = world.getBlockState(getBlockPos())
.getBlock() instanceof SeatBlock;
if (isBeingRidden() && blockPresent)
return;
@ -70,7 +70,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
@Override
protected void removePassenger(Entity entity) {
super.removePassenger(entity);
Vec3d pos = entity.getPositionVec();
Vector3d pos = entity.getPositionVec();
entity.setPosition(pos.x, pos.y + 0.85f, pos.z);
}

View file

@ -17,7 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.properties.SlabType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
public class SeatMovementBehaviour extends MovementBehaviour {
@ -61,7 +61,7 @@ public class SeatMovementBehaviour extends MovementBehaviour {
}
if (toDismount != null) {
toDismount.stopRiding();
Vec3d position = VecHelper.getCenterOf(pos)
Vector3d position = VecHelper.getCenterOf(pos)
.add(0, slab ? .5f : 1f, 0);
toDismount.setPositionAndUpdate(position.x, position.y, position.z);
toDismount.getPersistentData()

View file

@ -19,7 +19,7 @@
//import net.minecraft.util.Direction;
//import net.minecraft.util.Direction.Axis;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.util.math.Vec3d;
//import net.minecraft.util.math.vector.Vector3d;
//import net.minecraft.world.World;
//import net.minecraftforge.items.IItemHandlerModifiable;
//import net.minecraftforge.items.ItemHandlerHelper;
@ -31,8 +31,8 @@
// private static final String _workingPos_ = "WorkingPos";
//
// @Override
// public Vec3d getActiveAreaOffset(MovementContext context) {
// return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
// public Vector3d getActiveAreaOffset(MovementContext context) {
// return new Vector3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
// }
//
// @Override
@ -149,7 +149,7 @@
// }
//
// private Direction getCurrentFacing(MovementContext context) {
// Vec3d directionVec = new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec());
// Vector3d directionVec = new Vector3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec());
// directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z);
// return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
// }

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.contraptions.components.actors.dispenser;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.utility.BlockHelper;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.BlockState;
import net.minecraft.dispenser.IBlockSource;
@ -8,7 +9,7 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
@ -50,7 +51,7 @@ public class ContraptionBlockSource implements IBlockSource {
@Override
public BlockState getBlockState() {
if(context.state.has(BlockStateProperties.FACING) && overrideFacing != null)
if(BlockHelper.hasBlockStateProperty(context.state, BlockStateProperties.FACING) && overrideFacing != null)
return context.state.with(BlockStateProperties.FACING, overrideFacing);
return context.state;
}
@ -62,7 +63,7 @@ public class ContraptionBlockSource implements IBlockSource {
}
@Override
public World getWorld() {
public ServerWorld getWorld() {
return context.world;
}
}

View file

@ -13,7 +13,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
@ -60,7 +60,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
return;
}
Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec());
Vector3d facingVec = Vector3d.of(context.state.get(DispenserBlock.FACING).getDirectionVec());
facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
facingVec.normalize();
Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z);

View file

@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.server.ServerWorld;
import java.util.ArrayList;
import java.util.List;
@ -41,7 +40,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
}
private void updateTemporaryData(MovementContext context) {
if (!(context.temporaryData instanceof NonNullList) && context.world instanceof ServerWorld) {
if (!(context.temporaryData instanceof NonNullList) && context.world != null) {
NonNullList<ItemStack> stacks = NonNullList.withSize(getInvSize(), ItemStack.EMPTY);
ItemStackHelper.loadAllItems(context.tileData, stacks);
context.temporaryData = stacks;

View file

@ -7,9 +7,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.IBucketPickupHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.item.FireworkRocketEntity;
import net.minecraft.entity.item.TNTEntity;
import net.minecraft.entity.projectile.*;
import net.minecraft.fluid.FlowingFluid;
@ -26,7 +24,7 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
@ -36,7 +34,7 @@ public interface IMovedDispenseItemBehaviour {
static void init() {
MovedProjectileDispenserBehaviour movedPotionDispenseItemBehaviour = new MovedProjectileDispenserBehaviour() {
@Override
protected IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) {
protected ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) {
return Util.make(new PotionEntity(world, x, y, z), (p_218411_1_) -> p_218411_1_.setItem(itemStack));
}
@ -54,7 +52,7 @@ public interface IMovedDispenseItemBehaviour {
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.TNT, new MovedDefaultDispenseItemBehaviour() {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
double x = pos.getX() + facing.x * .7 + .5;
double y = pos.getY() + facing.y * .7 + .5;
double z = pos.getZ() + facing.z * .7 + .5;
@ -70,7 +68,7 @@ public interface IMovedDispenseItemBehaviour {
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.FIREWORK_ROCKET, new MovedDefaultDispenseItemBehaviour() {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
double x = pos.getX() + facing.x * .7 + .5;
double y = pos.getY() + facing.y * .7 + .5;
double z = pos.getZ() + facing.z * .7 + .5;
@ -95,7 +93,7 @@ public interface IMovedDispenseItemBehaviour {
}
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
Random random = context.world.rand;
double x = pos.getX() + facing.x * .7 + .5;
double y = pos.getY() + facing.y * .7 + .5;
@ -110,16 +108,16 @@ public interface IMovedDispenseItemBehaviour {
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.GLASS_BOTTLE, new MovedOptionalDispenseBehaviour() {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
this.successful = false;
BlockPos interactAt = pos.offset(getClosestFacingDirection(facing));
BlockState state = context.world.getBlockState(interactAt);
Block block = state.getBlock();
if (block.isIn(BlockTags.field_226151_aa_) && state.get(BeehiveBlock.HONEY_LEVEL) >= 5) { // Beehive -> honey bottles
if (state.method_27851(BlockTags.BEEHIVES, (p_239787_0_) -> p_239787_0_.contains(BeehiveBlock.HONEY_LEVEL)) && state.get(BeehiveBlock.HONEY_LEVEL) >= 5) { // Beehive -> honey bottles
((BeehiveBlock) block).takeHoney(context.world, state, interactAt, null, BeehiveTileEntity.State.BEE_RELEASED);
this.successful = true;
return placeItemInInventory(itemStack, new ItemStack(Items.field_226638_pX_), context, pos, facing);
return placeItemInInventory(itemStack, new ItemStack(Items.HONEY_BOTTLE), context, pos, facing);
} else if (context.world.getFluidState(interactAt).isTagged(FluidTags.WATER)) {
this.successful = true;
return placeItemInInventory(itemStack, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER), context, pos, facing);
@ -131,7 +129,7 @@ public interface IMovedDispenseItemBehaviour {
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.BUCKET, new MovedDefaultDispenseItemBehaviour() {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
BlockPos interactAt = pos.offset(getClosestFacingDirection(facing));
BlockState state = context.world.getBlockState(interactAt);
Block block = state.getBlock();
@ -146,7 +144,7 @@ public interface IMovedDispenseItemBehaviour {
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
if (!(itemStack.getItem() instanceof SpawnEggItem))
return super.dispenseStack(itemStack, context, pos, facing);
EntityType<?> entityType = ((SpawnEggItem) itemStack.getItem()).getType(itemStack.getTag());

View file

@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.HopperTileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper;
@ -17,7 +17,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
private static final MovedDefaultDispenseItemBehaviour defaultInstance = new MovedDefaultDispenseItemBehaviour();
public static void doDispense(World p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vec3d facing, BlockPos p_82486_4_, MovementContext context) {
public static void doDispense(World p_82486_0_, ItemStack p_82486_1_, int p_82486_2_, Vector3d facing, BlockPos p_82486_4_, MovementContext context) {
double d0 = p_82486_4_.getX() + facing.x + .5;
double d1 = p_82486_4_.getY() + facing.y + .5;
double d2 = p_82486_4_.getZ() + facing.z + .5;
@ -35,7 +35,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
@Override
public ItemStack dispense(ItemStack itemStack, MovementContext context, BlockPos pos) {
Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec());
Vector3d facingVec = Vector3d.of(context.state.get(DispenserBlock.FACING).getDirectionVec());
facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
facingVec.normalize();
@ -55,7 +55,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
ItemStack itemstack = itemStack.split(1);
doDispense(context.world, itemstack, 6, facing, pos, context);
return itemStack;
@ -71,7 +71,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
/**
* Order clients to display dispense particles from the specified block and facing.
*/
protected void spawnDispenseParticles(IWorld world, BlockPos pos, Vec3d facing) {
protected void spawnDispenseParticles(IWorld world, BlockPos pos, Vector3d facing) {
spawnDispenseParticles(world, pos, getClosestFacingDirection(facing));
}
@ -79,11 +79,11 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
world.playEvent(2000, pos, direction.getIndex());
}
protected Direction getClosestFacingDirection(Vec3d exactFacing) {
protected Direction getClosestFacingDirection(Vector3d exactFacing) {
return Direction.getFacingFromVector(exactFacing.x, exactFacing.y, exactFacing.z);
}
protected ItemStack placeItemInInventory(ItemStack consumedFrom, ItemStack output, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack placeItemInInventory(ItemStack consumedFrom, ItemStack output, MovementContext context, BlockPos pos, Vector3d facing) {
consumedFrom.shrink(1);
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
if (!remainder.isEmpty())

View file

@ -4,10 +4,10 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import net.minecraft.dispenser.IPosition;
import net.minecraft.dispenser.ProjectileDispenseBehavior;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
@ -18,16 +18,16 @@ import java.lang.reflect.Method;
public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDispenseItemBehaviour {
@Override
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3d facing) {
protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vector3d facing) {
double x = pos.getX() + facing.x * .7 + .5;
double y = pos.getY() + facing.y * .7 + .5;
double z = pos.getZ() + facing.z * .7 + .5;
IProjectile iprojectile = this.getProjectileEntity(context.world, x, y, z, itemStack.copy());
if (iprojectile == null)
ProjectileEntity ProjectileEntity = this.getProjectileEntity(context.world, x, y, z, itemStack.copy());
if (ProjectileEntity == null)
return itemStack;
Vec3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion);
iprojectile.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy());
context.world.addEntity((Entity) iprojectile);
Vector3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion);
ProjectileEntity.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy());
context.world.addEntity(ProjectileEntity);
itemStack.shrink(1);
return itemStack;
}
@ -38,7 +38,7 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp
}
@Nullable
protected abstract IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack);
protected abstract ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack);
protected float getProjectileInaccuracy() {
return 6.0F;
@ -51,9 +51,9 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp
public static MovedProjectileDispenserBehaviour of(ProjectileDispenseBehavior vanillaBehaviour) {
return new MovedProjectileDispenserBehaviour() {
@Override
protected IProjectile getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) {
protected ProjectileEntity getProjectileEntity(World world, double x, double y, double z, ItemStack itemStack) {
try {
return (IProjectile) MovedProjectileDispenserBehaviour.getProjectileEntityLookup().invoke(vanillaBehaviour, world, new SimplePos(x, y, z) , itemStack);
return (ProjectileEntity) MovedProjectileDispenserBehaviour.getProjectileEntityLookup().invoke(vanillaBehaviour, world, new SimplePos(x, y, z) , itemStack);
} catch (Throwable ignored) {
}
return null;

View file

@ -83,7 +83,7 @@ public class CuckooClockTileEntity extends KineticTileEntity {
if (animationType == Animation.SURPRISE && animationProgress.value == 50) {
Vector3d center = VecHelper.getCenterOf(pos);
world.destroyBlock(pos, false);
world.createExplosion(null, CUCKOO_SURPRISE, center.x, center.y, center.z, 3, false,
world.createExplosion(null, CUCKOO_SURPRISE, null, center.x, center.y, center.z, 3, false,
Explosion.Mode.BREAK);
}

View file

@ -1,20 +1,7 @@
package com.simibubi.create.content.contraptions.components.crafter;
import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import com.google.common.base.Predicates;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
@ -29,11 +16,17 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
public class ConnectedInputHandler {
public static boolean shouldConnect(World world, BlockPos pos, Direction face, Direction direction) {
BlockState refState = world.getBlockState(pos);
if (!refState.has(HORIZONTAL_FACING))
if (!BlockHelper.hasBlockStateProperty(refState, HORIZONTAL_FACING))
return false;
Direction refDirection = refState.get(HORIZONTAL_FACING);
if (direction.getAxis() == refDirection.getAxis())
@ -64,7 +57,7 @@ public class ConnectedInputHandler {
MechanicalCrafterTileEntity controller = CrafterHelper.getCrafter(world, controllerPos1);
Set<BlockPos> positions = controller.input.data.stream()
.map(l -> controllerPos1.add(l))
.map(controllerPos1::add)
.collect(Collectors.toSet());
List<BlockPos> frontier = new LinkedList<>();
List<BlockPos> splitGroup = new ArrayList<>();
@ -182,7 +175,7 @@ public class ConnectedInputHandler {
List<IItemHandlerModifiable> list = data.stream()
.map(l -> CrafterHelper.getCrafter(world, pos.add(l)))
.filter(Predicates.notNull())
.filter(Objects::nonNull)
.map(crafter -> crafter.inventory)
.collect(Collectors.toList());
return new CombinedInvWrapper(Arrays.copyOf(list.toArray(), list.size(), IItemHandlerModifiable[].class));

View file

@ -177,10 +177,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
groupedItemsBeforeCraft = before;
if (phaseBefore == Phase.EXPORTING && phase == Phase.WAITING) {
Direction facing = getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING);
Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.75)
Vector3d vec = Vector3d.of(facing.getDirectionVec()).scale(.75)
.add(VecHelper.getCenterOf(pos));
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(getBlockState());
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(1));
vec = vec.add(Vector3d.of(targetDirection.getDirectionVec()).scale(1));
world.addParticle(ParticleTypes.CRIT, vec.x, vec.y, vec.z, 0, 0, 0);
}
}

View file

@ -130,7 +130,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
try {
CrushingWheelTileEntity te = getTileEntity(worldIn, pos);
if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.onGround)
if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.isOnGround())
return;
double x = 0;

View file

@ -84,7 +84,7 @@ public class CrushingWheelControllerBlock extends Block
return;
try {
CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getPosition().down());
CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getBlockPos().down());
if (te.crushingspeed == 0)
return;
if (entityIn instanceof ItemEntity)
@ -116,11 +116,11 @@ public class CrushingWheelControllerBlock extends Block
@Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) {
updateSpeed(stateIn, worldIn.getWorld(), currentPos);
updateSpeed(stateIn, worldIn, currentPos);
return stateIn;
}
public void updateSpeed(BlockState state, World world, BlockPos pos) {
public void updateSpeed(BlockState state, IWorld world, BlockPos pos) {
withTileEntityDo(world, pos, te -> {
if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) {
if (te.crushingspeed != 0) {

View file

@ -217,7 +217,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
@Override
public void write(CompoundNBT compound, boolean clientPacket) {
if (hasEntity())
compound.put("Entity", NBTUtil.writeUniqueId(entityUUID));
compound.put("Entity", NBTUtil.fromUuid(entityUUID));
compound.put("Inventory", inventory.serializeNBT());
compound.putFloat("Speed", crushingspeed);
super.write(compound, clientPacket);

View file

@ -74,7 +74,7 @@ public class DeployerFakePlayer extends FakePlayer {
}
@Override
public Vector3d getPositionVector() {
public Vector3d getPositionVec() {
return new Vector3d(getX(), getY(), getZ());
}
@ -94,9 +94,9 @@ public class DeployerFakePlayer extends FakePlayer {
}
@SubscribeEvent
public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) {
public static void deployerHasEyesOnHisFeet(EntityEvent.Size event) {
if (event.getEntity() instanceof DeployerFakePlayer)
event.setNewHeight(0);
event.setNewEyeHeight(0);
}
@SubscribeEvent(priority = EventPriority.LOWEST)

View file

@ -117,13 +117,13 @@ public class AirCurrent {
} else {
switch (processingType) {
case BLASTING:
if (!entity.isImmuneToFire()) {
if (!entity.isFireImmune()) {
entity.setFire(10);
entity.attackEntityFrom(damageSourceLava, 4);
}
break;
case SMOKING:
if (!entity.isImmuneToFire()) {
if (!entity.isFireImmune()) {
entity.setFire(2);
entity.attackEntityFrom(damageSourceFire, 2);
}
@ -136,7 +136,7 @@ public class AirCurrent {
if (!entity.isBurning())
break;
entity.extinguish();
world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE,
world.playSound(null, entity.getBlockPos(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE,
SoundCategory.NEUTRAL, 0.7F,
1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
break;
@ -168,7 +168,7 @@ public class AirCurrent {
BlockPos start = source.getPos();
float max = this.maxDistance;
Direction facing = direction;
Vec3d directionVec = new Vec3d(facing.getDirectionVec());
Vector3d directionVec = Vector3d.of(facing.getDirectionVec());
maxDistance = getFlowLimit(world, start, max, facing);
// Determine segments with transported fluids/gases
@ -216,12 +216,12 @@ public class AirCurrent {
}
public static float getFlowLimit(World world, BlockPos start, float max, Direction facing) {
Vec3d directionVec = new Vec3d(facing.getDirectionVec());
Vec3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec);
Vector3d directionVec = Vector3d.of(facing.getDirectionVec());
Vector3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec);
// 4 Rays test for holes in the shapes blocking the flow
float offsetDistance = .25f;
Vec3d[] offsets = new Vec3d[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance),
Vector3d[] offsets = new Vector3d[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance),
planeVec.mul(-offsetDistance, -offsetDistance, offsetDistance),
planeVec.mul(offsetDistance, -offsetDistance, -offsetDistance),
planeVec.mul(-offsetDistance, offsetDistance, -offsetDistance), };
@ -244,11 +244,11 @@ public class AirCurrent {
break;
}
for (Vec3d offset : offsets) {
Vec3d rayStart = VecHelper.getCenterOf(currentPos)
for (Vector3d offset : offsets) {
Vector3d rayStart = VecHelper.getCenterOf(currentPos)
.subtract(directionVec.scale(.5f + 1 / 32f))
.add(offset);
Vec3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
Vector3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
BlockRayTraceResult blockraytraceresult =
world.rayTraceBlocks(rayStart, rayEnd, currentPos, voxelshape, state);
if (blockraytraceresult == null)

View file

@ -7,6 +7,7 @@ import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.config.CKinetics;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties;
@ -78,11 +79,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity {
.isIn(AllBlockTags.FAN_HEATERS.tag))
return false;
if (checkState.has(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.get(BlazeBurnerBlock.HEAT_LEVEL)
if (BlockHelper.hasBlockStateProperty(checkState, BlazeBurnerBlock.HEAT_LEVEL) && !checkState.get(BlazeBurnerBlock.HEAT_LEVEL)
.isAtLeast(BlazeBurnerBlock.HeatLevel.FADING))
return false;
if (checkState.has(BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT))
if (BlockHelper.hasBlockStateProperty(checkState, BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT))
return false;
return true;

View file

@ -25,7 +25,6 @@ public class FlywheelGenerator extends SpecialBlockStateGen {
BlockState state) {
return prov.models()
.getExistingFile(prov.modLoc("block/" + ctx.getName() + "/casing_" + state.get(FlywheelBlock.CONNECTION)
.getName()));
.getString()));
}
}

View file

@ -29,11 +29,6 @@ public class EngineTileEntity extends SmartTileEntity {
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
}
@Override
public boolean hasFastRenderer() {
return true;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return super.getRenderBoundingBox().grow(1.5f);

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.AbstractFurnaceBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -26,7 +27,7 @@ public class FurnaceEngineTileEntity extends EngineTileEntity {
return;
float modifier = state.getBlock() == Blocks.BLAST_FURNACE ? 2 : 1;
boolean active = state.has(AbstractFurnaceBlock.LIT) && state.get(AbstractFurnaceBlock.LIT);
boolean active = BlockHelper.hasBlockStateProperty(state, AbstractFurnaceBlock.LIT) && state.get(AbstractFurnaceBlock.LIT);
float speed = active ? 16 * modifier : 0;
float capacity =
(float) (active ? AllConfigs.SERVER.kinetics.stressValues.getCapacityOf(AllBlocks.FURNACE_ENGINE.get())

View file

@ -95,7 +95,7 @@ public class MillstoneBlock extends KineticBlock implements ITE<MillstoneTileEnt
return;
MillstoneTileEntity millstone = null;
for (BlockPos pos : Iterate.hereAndBelow(entityIn.getPosition())) {
for (BlockPos pos : Iterate.hereAndBelow(entityIn.getBlockPos())) {
try {
millstone = getTileEntity(worldIn, pos);
} catch (TileEntityException e) {

View file

@ -14,6 +14,7 @@ import com.simibubi.create.content.contraptions.processing.BasinTileEntity;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
@ -246,7 +247,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
if (world == null)
return HeatLevel.NONE;
BlockState state = world.getBlockState(pos.down(3));
if (state.has(BlazeBurnerBlock.HEAT_LEVEL))
if (BlockHelper.hasBlockStateProperty(state, BlazeBurnerBlock.HEAT_LEVEL))
return state.get(BlazeBurnerBlock.HEAT_LEVEL);
return AllTags.AllBlockTags.FAN_HEATERS.matches(state) ? HeatLevel.SMOULDERING : HeatLevel.NONE;
}

View file

@ -89,7 +89,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements ITE<SawTile
if (entityIn.world.isRemote)
return;
BlockPos pos = entityIn.getPosition();
BlockPos pos = entityIn.getBlockPos();
withTileEntityDo(entityIn.world, pos, te -> {
if (te.getSpeed() == 0)
return;

View file

@ -20,6 +20,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity;
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.AbstractPressurePlateBlock;
import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.BellBlock;
@ -101,7 +102,7 @@ public class BlockMovementTraits {
*/
public static boolean isBrittle(BlockState state) {
Block block = state.getBlock();
if (state.has(BlockStateProperties.HANGING))
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HANGING))
return true;
if (block instanceof LadderBlock)
@ -161,7 +162,7 @@ public class BlockMovementTraits {
if (attachFace == AttachFace.WALL)
return direction.getOpposite() == state.get(HorizontalFaceBlock.HORIZONTAL_FACING);
}
if (state.has(BlockStateProperties.HANGING))
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HANGING))
return direction == (state.get(BlockStateProperties.HANGING) ? Direction.UP : Direction.DOWN);
if (block instanceof AbstractRailBlock)
return direction == Direction.DOWN;

View file

@ -17,6 +17,7 @@ import java.util.stream.Collectors;
import javax.annotation.Nullable;
import com.simibubi.create.foundation.utility.BlockHelper;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
@ -472,7 +473,7 @@ public abstract class Contraption {
tag.putInt("y", info.pos.getY());
tag.putInt("z", info.pos.getZ());
TileEntity te = TileEntity.create(tag);
TileEntity te = TileEntity.createFromTag(info.state, tag);
if (te == null)
return;
te.setLocation(new WrappedWorld(world) {
@ -575,7 +576,7 @@ public abstract class Contraption {
nbt.put("Seats", NBTHelper.writeCompoundList(getSeats(), NBTUtil::writeBlockPos));
nbt.put("Passengers", NBTHelper.writeCompoundList(getSeatMapping().entrySet(), e -> {
CompoundNBT tag = new CompoundNBT();
tag.put("Id", NBTUtil.writeUniqueId(e.getKey()));
tag.put("Id", NBTUtil.fromUuid(e.getKey()));
tag.putInt("Seat", e.getValue());
return tag;
}));
@ -603,7 +604,7 @@ public abstract class Contraption {
return false;
}
public void removeBlocksFromWorld(IWorld world, BlockPos offset) {
public void removeBlocksFromWorld(World world, BlockPos offset) {
storage.values()
.forEach(MountedStorage::removeStorageFromWorld);
glueToRemove.forEach(SuperGlueEntity::remove);
@ -623,14 +624,12 @@ public abstract class Contraption {
Block blockIn = oldState.getBlock();
if (block.state.getBlock() != blockIn)
iterator.remove();
world.getWorld()
.removeTileEntity(add);
world.removeTileEntity(add);
int flags = 67;
if (blockIn instanceof DoorBlock)
flags = flags | 32 | 16;
if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED)
&& oldState.get(BlockStateProperties.WATERLOGGED)
.booleanValue()) {
if (blockIn instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(oldState, BlockStateProperties.WATERLOGGED)
&& oldState.get(BlockStateProperties.WATERLOGGED)) {
world.setBlockState(add, Blocks.WATER.getDefaultState(), flags);
continue;
}
@ -671,10 +670,10 @@ public abstract class Contraption {
Block.spawnDrops(state, world, targetPos, null);
continue;
}
if (state.getBlock() instanceof IWaterLoggable && state.has(BlockStateProperties.WATERLOGGED)) {
IFluidState ifluidstate = world.getFluidState(targetPos);
if (state.getBlock() instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED)) {
FluidState FluidState = world.getFluidState(targetPos);
state = state.with(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
FluidState.getFluid() == Fluids.WATER);
}
world.destroyBlock(targetPos, true);
@ -699,7 +698,7 @@ public abstract class Contraption {
tag.remove("InitialOffset");
}
tileEntity.read(tag);
tileEntity.fromTag(tileEntity.getBlockState(), tag);
if (storage.containsKey(block.pos)) {
MountedStorage mountedStorage = storage.get(block.pos);

View file

@ -210,7 +210,7 @@ public class ContraptionCollider {
Vector3d contactPointMotion = Vector3d.ZERO;
if (surfaceCollision.isTrue()) {
entity.fallDistance = 0;
entity.onGround = true;
entity.setOnGround(true);
contraptionEntity.collidingEntities.add(entity);
if (!serverPlayer)
contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition);
@ -273,7 +273,7 @@ public class ContraptionCollider {
boolean flag = movement.x != Vector3d.x;
boolean flag1 = movement.y != Vector3d.y;
boolean flag2 = movement.z != Vector3d.z;
boolean flag3 = e.onGround || flag1 && movement.y < 0.0D;
boolean flag3 = e.isOnGround() || flag1 && movement.y < 0.0D;
if (e.stepHeight > 0.0F && flag3 && (flag || flag2)) {
Vector3d Vector3d1 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, (double) e.stepHeight, movement.z),
bb, world, ctx, reuseablestream);

View file

@ -11,6 +11,7 @@ import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.entity.projectile.ProjectileEntity;
import org.apache.commons.lang3.tuple.MutablePair;
import com.simibubi.create.AllEntityTypes;
@ -32,7 +33,7 @@ import net.minecraft.block.material.PushReaction;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.ProjectileEntity;
import net.minecraft.entity.item.BoatEntity;
import net.minecraft.entity.item.HangingEntity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
@ -344,7 +345,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
if (coupling != null && coupling.areBothEndsPresent()) {
boolean notOnMainCart = !coupling.getId()
.equals(riding.getUniqueID());
Vec3d positionVec = coupling.asCouple()
Vector3d positionVec = coupling.asCouple()
.get(notOnMainCart)
.getPositionVec();
prevYaw = yaw;
@ -365,11 +366,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
pauseWhileRotating = mountedContraption.rotationMode == CartMovementMode.ROTATE_PAUSED;
}
Vec3d movementVector = riding.getMotion();
Vector3d movementVector = riding.getMotion();
if (!isOnCoupling) {
if (riding instanceof BoatEntity)
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
Vec3d motion = movementVector.normalize();
Vector3d motion = movementVector.normalize();
if (!rotationLock) {
if (motion.length() > 0) {
@ -469,7 +470,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
boolean newPosVisited = false;
BlockPos gridPosition = new BlockPos(actorPosition);
Vec3d oldMotion = context.motion;
Vector3d oldMotion = context.motion;
if (!context.stall) {
Vector3d previousPosition = context.position;
@ -486,7 +487,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
BearingContraption bc = (BearingContraption) getContraption();
Direction facing = bc.getFacing();
Vector3d activeAreaOffset = actor.getActiveAreaOffset(context);
if (activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(new Vec3d(facing.getDirectionVec())))
if (activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(Vector3d.of(facing.getDirectionVec())))
.equals(Vector3d.ZERO)) {
if (VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) {
context.motion = Vector3d.of(facing.getDirectionVec()).scale(facing.getAxis()
@ -676,8 +677,8 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
compound.putBoolean("Initialized", initialized);
if (getCouplingId() != null) {
compound.put("OnCoupling", NBTUtil.writeUniqueId(getCouplingId()));
compound.put("CoupledCart", NBTUtil.writeUniqueId(getCoupledCart()));
compound.put("OnCoupling", NBTUtil.fromUuid(getCouplingId()));
compound.put("CoupledCart", NBTUtil.fromUuid(getCoupledCart()));
}
}
@ -876,7 +877,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
return false;
if (e instanceof SeatEntity)
return false;
if (e instanceof IProjectile)
if (e instanceof ProjectileEntity)
return false;
if (e.getRidingEntity() != null)
return false;

View file

@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants.NBT;
@ -42,7 +42,7 @@ public class ContraptionHandler {
CompoundNBT data = entityLiving.getPersistentData();
if (!data.contains("ContraptionDismountLocation"))
return;
Vec3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE));
Vector3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE));
if (entityLiving.getRidingEntity() == null)
entityLiving.setPositionAndUpdate(position.x, position.y, position.z);
data.remove("ContraptionDismountLocation");

View file

@ -14,7 +14,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
import net.minecraftforge.api.distmarker.Dist;
@ -37,18 +37,18 @@ public class ContraptionInteractionHandler {
return;
if (!event.isUseItem())
return;
Vec3d origin = RaycastHelper.getTraceOrigin(player);
Vector3d origin = RaycastHelper.getTraceOrigin(player);
double reach = mc.playerController.getBlockReachDistance();
if (mc.objectMouseOver != null && mc.objectMouseOver.getHitVec() != null)
reach = Math.min(mc.objectMouseOver.getHitVec().distanceTo(origin), reach);
Vec3d target = RaycastHelper.getTraceTarget(player, reach, origin);
Vector3d target = RaycastHelper.getTraceTarget(player, reach, origin);
for (ContraptionEntity contraptionEntity : mc.world.getEntitiesWithinAABB(ContraptionEntity.class,
new AxisAlignedBB(origin, target))) {
Vec3d localOrigin = contraptionEntity.toLocalVector(origin);
Vec3d localTarget = contraptionEntity.toLocalVector(target);
Vector3d localOrigin = contraptionEntity.toLocalVector(origin);
Vector3d localTarget = contraptionEntity.toLocalVector(target);
Contraption contraption = contraptionEntity.getContraption();
MutableObject<BlockRayTraceResult> mutableResult = new MutableObject<>();

View file

@ -55,7 +55,7 @@ public abstract class MovementBehaviour {
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {}
public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) {
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.Constants.NBT;
public class MovementContext {

View file

@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.DirectionHelper;
import com.simibubi.create.foundation.utility.VecHelper;
@ -69,10 +70,10 @@ public class StructureTransform {
}
public Vec3d apply(Vec3d localVec) {
Vec3d vec = localVec;
public Vector3d apply(Vector3d localVec) {
Vector3d vec = localVec;
vec = VecHelper.rotateCentered(vec, angle, rotationAxis);
vec = vec.add(new Vec3d(offset));
vec = vec.add(Vector3d.of(offset));
return vec;
}
@ -146,33 +147,33 @@ public class StructureTransform {
return state;
}
if (state.has(FACING)) {
if (BlockHelper.hasBlockStateProperty(state, FACING)) {
Direction newFacing = transformFacing(state.get(FACING));
if (state.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) {
if (BlockHelper.hasBlockStateProperty(state, DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) {
if (rotationAxis == newFacing.getAxis() && rotation.ordinal() % 2 == 1)
state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE);
}
state = state.with(FACING, newFacing);
} else if (state.has(AXIS)) {
} else if (BlockHelper.hasBlockStateProperty(state, AXIS)) {
state = state.with(AXIS, transformAxis(state.get(AXIS)));
} else if (halfTurn) {
if (state.has(FACING)) {
if (BlockHelper.hasBlockStateProperty(state, FACING)) {
Direction stateFacing = state.get(FACING);
if (stateFacing.getAxis() == rotationAxis)
return state;
}
if (state.has(HORIZONTAL_FACING)) {
if (BlockHelper.hasBlockStateProperty(state, HORIZONTAL_FACING)) {
Direction stateFacing = state.get(HORIZONTAL_FACING);
if (stateFacing.getAxis() == rotationAxis)
return state;
}
state = state.rotate(rotation);
if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE)
if (BlockHelper.hasBlockStateProperty(state, SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE)
state = state.with(SlabBlock.TYPE,
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
}

View file

@ -12,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
@ -269,7 +270,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
BlockState blockState = getBlockState();
if (!(contraption.getContraption() instanceof BearingContraption))
return;
if (!blockState.has(FACING))
if (!BlockHelper.hasBlockStateProperty(blockState, FACING))
return;
this.movedContraption = contraption;

View file

@ -43,7 +43,7 @@ public class ChassisRangeDisplay {
}
protected Object getOutlineKey() {
return Pair.of(te.getPos(), new Integer(1));
return Pair.of(te.getPos(), 1);
}
protected Set<BlockPos> createSelection(ChassisTileEntity chassis) {

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gl
import javax.annotation.Nullable;
import net.minecraft.world.server.ServerWorld;
import org.apache.commons.lang3.Validate;
import com.simibubi.create.AllEntityTypes;
@ -247,11 +248,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
}
@Override
public boolean processInitialInteract(PlayerEntity player, Hand hand) {
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
triggerPlaceBlock(player, hand);
});
return true;
return ActionResultType.CONSUME;
}
@OnlyIn(Dist.CLIENT)
@ -367,7 +368,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
}
@Override
public void onStruckByLightning(LightningBoltEntity lightningBolt) {}
public void onStruckByLightning(ServerWorld world, LightningBoltEntity lightningBolt) {}
@Override
public void recalculateSize() {}

View file

@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.RayTraceWorld;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@ -23,6 +24,7 @@ import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -63,11 +65,11 @@ public class SuperGlueHandler {
public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, PlayerEntity placer) {
ItemStack itemstack = placer.getHeldItemOffhand();
if (!AllItems.SUPER_GLUE.isIn(itemstack))
ModifiableAttributeInstance reachAttribute = placer.getAttribute(ForgeMod.REACH_DISTANCE.get());
if (!AllItems.SUPER_GLUE.isIn(itemstack) || reachAttribute == null)
return;
double distance = placer.getAttribute(PlayerEntity.REACH_DISTANCE)
.getValue();
double distance = reachAttribute.getValue();
Vector3d start = placer.getEyePosition(1);
Vector3d look = placer.getLook(1);
Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance);

View file

@ -219,7 +219,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
if (couplingFound) {
MinecartCouplingHandler.connectCarts(null, world, cart.getEntityId(),
contraption.connectedCart.getEntityId());
Vec3d diff = contraption.connectedCart.getPositionVec()
Vector3d diff = contraption.connectedCart.getPositionVec()
.subtract(cart.getPositionVec());
initialAngle = Direction.fromAngle(MathHelper.atan2(diff.z, diff.x) * 180 / Math.PI)
.getHorizontalAngle();
@ -304,10 +304,12 @@ public class CartAssemblerBlock extends AbstractRailBlock
return PushReaction.BLOCK;
}
/* FIXME: Is there a 1.16 equivalent to be used? Or is this just removed?
@Override
public boolean isNormalCube(@Nonnull BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos) {
return false;
}
*/
@Override
public Class<CartAssemblerTileEntity> getTileEntityClass() {
@ -338,10 +340,10 @@ public class CartAssemblerBlock extends AbstractRailBlock
}
@SuppressWarnings("deprecation")
public List<ItemStack> getDropedAssembler(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_,
public List<ItemStack> getDropedAssembler(BlockState state, ServerWorld world, BlockPos pos,
@Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) {
return super.getDrops(p_220077_0_, (new LootContext.Builder(p_220077_1_)).withRandom(p_220077_1_.rand)
.withParameter(LootParameters.POSITION, p_220077_2_)
return super.getDrops(state, (new LootContext.Builder(world)).withRandom(world.rand)
.withParameter(LootParameters.ORIGIN, Vector3d.of(pos))
.withParameter(LootParameters.TOOL, p_220077_5_)
.withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_)
.withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_));
@ -360,7 +362,8 @@ public class CartAssemblerBlock extends AbstractRailBlock
.forEach(itemStack -> {
player.inventory.placeItemBackInInventory(world, itemStack);
});
state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY);
if(world instanceof ServerWorld)
state.spawnAdditionalDrops((ServerWorld) world, pos, ItemStack.EMPTY);
world.setBlockState(pos, getRailBlock(state));
return ActionResultType.SUCCESS;
}

View file

@ -4,6 +4,7 @@ import static com.simibubi.create.content.contraptions.components.structureMovem
import java.util.List;
import com.simibubi.create.foundation.utility.BlockHelper;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks;
@ -51,7 +52,7 @@ public class MountedContraption extends Contraption {
return null;
BlockState state = world.getBlockState(pos);
if (!state.has(RAIL_SHAPE))
if (!BlockHelper.hasBlockStateProperty(state, RAIL_SHAPE))
return null;
MountedContraption contraption = new MountedContraption();

View file

@ -15,7 +15,7 @@ import net.minecraftforge.client.model.generators.ModelFile;
public class MechanicalPistonGenerator extends SpecialBlockStateGen {
private PistonType type;
private final PistonType type;
public MechanicalPistonGenerator(PistonType type) {
this.type = type;
@ -43,7 +43,7 @@ public class MechanicalPistonGenerator extends SpecialBlockStateGen {
PistonState pistonState = state.get(MechanicalPistonBlock.STATE);
String path = "block/mechanical_piston";
String folder = pistonState == PistonState.RETRACTED ? type.getName() : pistonState.getName();
String folder = pistonState == PistonState.RETRACTED ? type.getString() : pistonState.getString();
String partial = facing.getAxis() == Axis.X ^ axisAlongFirst ? "block_rotated" : "block";
return prov.models()

View file

@ -107,7 +107,7 @@ public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
FluidState FluidState = context.getWorld().getFluidState(context.getPos());
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
}
}

View file

@ -91,9 +91,9 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
FluidState FluidState = context.getWorld().getFluidState(context.getPos());
return getDefaultState().with(FACING, context.getFace().getOpposite())
.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
}
@Override

View file

@ -5,6 +5,7 @@ import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.IWaterLoggable;
@ -110,7 +111,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (!isMoving && (!state.has(BlockStateProperties.WATERLOGGED) || !newState.has(BlockStateProperties.WATERLOGGED) || state.get(BlockStateProperties.WATERLOGGED) == newState.get(BlockStateProperties.WATERLOGGED))) {
if (!isMoving && (!BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED) || !BlockHelper.hasBlockStateProperty(newState, BlockStateProperties.WATERLOGGED) || state.get(BlockStateProperties.WATERLOGGED) == newState.get(BlockStateProperties.WATERLOGGED))) {
onRopeBroken(worldIn, pos.up());
if (!worldIn.isRemote) {
BlockState above = worldIn.getBlockState(pos.up());
@ -149,8 +150,8 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
FluidState FluidState = context.getWorld().getFluidState(context.getPos());
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
}
}

View file

@ -9,6 +9,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.IWaterLoggable;
@ -71,7 +72,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
for (int i = ((int) offset); i > 0; i--) {
BlockPos offset = pos.down(i);
BlockState oldState = world.getBlockState(offset);
if (oldState.getBlock() instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED)) {
if (oldState.getBlock() instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(oldState, BlockStateProperties.WATERLOGGED) && oldState.get(BlockStateProperties.WATERLOGGED)) {
world.setBlockState(offset, Blocks.WATER.getDefaultState(), 66);
continue;
}
@ -105,19 +106,19 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
if (!removed) {
if (offset > 0) {
BlockPos magnetPos = pos.down((int) offset);
FluidState ifluidstate = world.getFluidState(magnetPos);
FluidState FluidState = world.getFluidState(magnetPos);
world.destroyBlock(magnetPos, world.getBlockState(magnetPos)
.getCollisionShape(world, magnetPos)
.isEmpty());
world.setBlockState(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)), 66);
world.setBlockState(magnetPos, AllBlocks.PULLEY_MAGNET.getDefaultState().with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER)), 66);
}
boolean[] waterlog = new boolean[(int) offset];
for (int i = 1; i <= ((int) offset) - 1; i++) {
BlockPos ropePos = pos.down(i);
FluidState ifluidstate = world.getFluidState(ropePos);
waterlog[i] = ifluidstate.getFluid() == Fluids.WATER;
FluidState FluidState = world.getFluidState(ropePos);
waterlog[i] = FluidState.getFluid() == Fluids.WATER;
world.destroyBlock(ropePos, world.getBlockState(ropePos)
.getCollisionShape(world, ropePos)
.isEmpty());

View file

@ -6,21 +6,21 @@ import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.fml.network.NetworkEvent.Context;
public class ClientMotionPacket extends SimplePacketBase {
private Vec3d motion;
private Vector3d motion;
private boolean onGround;
public ClientMotionPacket(Vec3d motion, boolean onGround) {
public ClientMotionPacket(Vector3d motion, boolean onGround) {
this.motion = motion;
this.onGround = onGround;
}
public ClientMotionPacket(PacketBuffer buffer) {
motion = new Vec3d(buffer.readFloat(), buffer.readFloat(), buffer.readFloat());
motion = new Vector3d(buffer.readFloat(), buffer.readFloat(), buffer.readFloat());
onGround = buffer.readBoolean();
}
@ -41,7 +41,7 @@ public class ClientMotionPacket extends SimplePacketBase {
if (sender == null)
return;
sender.setMotion(motion);
sender.onGround = onGround;
sender.setOnGround(onGround);
if (onGround) {
sender.handleFallDamage(sender.fallDistance, 1);
sender.fallDistance = 0;

View file

@ -16,7 +16,7 @@ import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.particles.RedstoneParticleData;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
public class ClientMinecartCouplingHandler {
@ -54,11 +54,11 @@ public class ClientMinecartCouplingHandler {
private static void spawnSelectionParticles(AxisAlignedBB axisAlignedBB, boolean highlight) {
ClientWorld world = Minecraft.getInstance().world;
Vec3d center = axisAlignedBB.getCenter();
Vector3d center = axisAlignedBB.getCenter();
int amount = highlight ? 100 : 2;
IParticleData particleData = highlight ? ParticleTypes.END_ROD : new RedstoneParticleData(1, 1, 1, 1);
for (int i = 0; i < amount; i++) {
Vec3d v = VecHelper.offsetRandomly(Vec3d.ZERO, r, 1);
Vector3d v = VecHelper.offsetRandomly(Vector3d.ZERO, r, 1);
double yOffset = v.y;
v = v.mul(1, 0, 1)
.normalize()

View file

@ -15,14 +15,14 @@ import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
public class MinecartCouplingRenderer {
@ -35,7 +35,7 @@ public class MinecartCouplingRenderer {
carts.map(c -> WorldRenderer.getLightmapCoordinates(world, new BlockPos(c.getBoundingBox()
.getCenter())));
Vec3d center = carts.getFirst()
Vector3d center = carts.getFirst()
.getPositionVec()
.add(carts.getSecond()
.getPositionVec())
@ -49,12 +49,12 @@ public class MinecartCouplingRenderer {
SuperByteBuffer ring = AllBlockPartials.COUPLING_RING.renderOn(renderState);
SuperByteBuffer connector = AllBlockPartials.COUPLING_CONNECTOR.renderOn(renderState);
Vec3d zero = Vec3d.ZERO;
Vec3d firstEndpoint = transforms.getFirst()
Vector3d zero = Vector3d.ZERO;
Vector3d firstEndpoint = transforms.getFirst()
.apply(zero);
Vec3d secondEndpoint = transforms.getSecond()
Vector3d secondEndpoint = transforms.getSecond()
.apply(zero);
Vec3d endPointDiff = secondEndpoint.subtract(firstEndpoint);
Vector3d endPointDiff = secondEndpoint.subtract(firstEndpoint);
double connectorYaw = -Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI;
double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.mul(1, 0, 1)
.length()) * 180 / Math.PI;
@ -89,7 +89,7 @@ public class MinecartCouplingRenderer {
ms.pop();
}
private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vec3d centerOfCoupling) {
private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vector3d centerOfCoupling) {
long i = cart.getEntityId() * 493286711L;
i = i * i * 4392167121L + i * 98761L;
float x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
@ -112,11 +112,11 @@ public class MinecartCouplingRenderer {
rollAmplifier = 0.0F;
roll = roll > 0 ? MathHelper.sin(roll) * roll * rollAmplifier / 10.0F * cart.getRollingDirection() : 0;
Vec3d positionVec = new Vec3d(xIn, yIn, zIn);
Vec3d frontVec = positionVec.add(VecHelper.rotate(new Vec3d(.5, 0, 0), 180 - yaw, Axis.Y));
Vec3d backVec = positionVec.add(VecHelper.rotate(new Vec3d(-.5, 0, 0), 180 - yaw, Axis.Y));
Vector3d positionVec = new Vector3d(xIn, yIn, zIn);
Vector3d frontVec = positionVec.add(VecHelper.rotate(new Vector3d(.5, 0, 0), 180 - yaw, Axis.Y));
Vector3d backVec = positionVec.add(VecHelper.rotate(new Vector3d(-.5, 0, 0), 180 - yaw, Axis.Y));
Vec3d railVecOfPos = cart.getPos(xIn, yIn, zIn);
Vector3d railVecOfPos = cart.getPos(xIn, yIn, zIn);
boolean flip = false;
if (railVecOfPos != null) {
@ -131,7 +131,7 @@ public class MinecartCouplingRenderer {
y += (frontVec.y + backVec.y) / 2;
z += railVecOfPos.z;
Vec3d endPointDiff = backVec.add(-frontVec.x, -frontVec.y, -frontVec.z);
Vector3d endPointDiff = backVec.add(-frontVec.x, -frontVec.y, -frontVec.z);
if (endPointDiff.length() != 0.0D) {
endPointDiff = endPointDiff.normalize();
yaw = (float) (Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI);
@ -174,7 +174,7 @@ public class MinecartCouplingRenderer {
this.flip = flip;
}
public Vec3d apply(Vec3d vec) {
public Vector3d apply(Vector3d vec) {
vec = vec.add(offset, 0, 0);
vec = VecHelper.rotate(vec, roll, Axis.X);
vec = VecHelper.rotate(vec, pitch, Axis.Z);

View file

@ -32,7 +32,7 @@ public class MinecartCouplingSerializer {
private static CompoundNBT createCouplingTag(boolean main, MinecartCoupling coupling) {
CompoundNBT nbt = new CompoundNBT();
nbt.put("Id", NBTUtil.writeUniqueId(coupling.getId()));
nbt.put("Id", NBTUtil.fromUuid(coupling.getId()));
nbt.putBoolean("Main", main);
nbt.putDouble("Length", coupling.length);
return nbt;

View file

@ -19,21 +19,21 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3i;
public class MinecartSim2020 {
private static final Map<RailShape, Pair<Vec3i, Vec3i>> MATRIX =
private static final Map<RailShape, Pair<Vector3i, Vector3i>> MATRIX =
Util.make(Maps.newEnumMap(RailShape.class), (p_226574_0_) -> {
Vec3i vec3i = Direction.WEST.getDirectionVec();
Vec3i vec3i1 = Direction.EAST.getDirectionVec();
Vec3i vec3i2 = Direction.NORTH.getDirectionVec();
Vec3i vec3i3 = Direction.SOUTH.getDirectionVec();
Vec3i vec3i4 = vec3i.down();
Vec3i vec3i5 = vec3i1.down();
Vec3i vec3i6 = vec3i2.down();
Vec3i vec3i7 = vec3i3.down();
Vector3i vec3i = Direction.WEST.getDirectionVec();
Vector3i vec3i1 = Direction.EAST.getDirectionVec();
Vector3i vec3i2 = Direction.NORTH.getDirectionVec();
Vector3i vec3i3 = Direction.SOUTH.getDirectionVec();
Vector3i vec3i4 = vec3i.down();
Vector3i vec3i5 = vec3i1.down();
Vector3i vec3i6 = vec3i2.down();
Vector3i vec3i7 = vec3i3.down();
p_226574_0_.put(RailShape.NORTH_SOUTH, Pair.of(vec3i2, vec3i3));
p_226574_0_.put(RailShape.EAST_WEST, Pair.of(vec3i, vec3i1));
p_226574_0_.put(RailShape.ASCENDING_EAST, Pair.of(vec3i4, vec3i1));
@ -46,7 +46,7 @@ public class MinecartSim2020 {
p_226574_0_.put(RailShape.NORTH_EAST, Pair.of(vec3i2, vec3i1));
});
public static Vec3d predictMotionOf(AbstractMinecartEntity cart) {
public static Vector3d predictMotionOf(AbstractMinecartEntity cart) {
if (cart instanceof FurnaceMinecartEntity) {
return cart.getPositionVec()
.subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ);
@ -83,13 +83,13 @@ public class MinecartSim2020 {
return true;
}
public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vec3d forcedMovement, BlockPos cartPos,
public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vector3d forcedMovement, BlockPos cartPos,
BlockState trackState) {
if (forcedMovement.equals(Vec3d.ZERO))
if (forcedMovement.equals(Vector3d.ZERO))
return;
Vec3d previousMotion = cart.getMotion();
Vector3d previousMotion = cart.getMotion();
cart.fallDistance = 0.0F;
double x = cart.getX();
@ -100,7 +100,7 @@ public class MinecartSim2020 {
double actualY = y;
double actualZ = z;
Vec3d actualVec = cart.getPos(actualX, actualY, actualZ);
Vector3d actualVec = cart.getPos(actualX, actualY, actualZ);
actualY = cartPos.getY() + 1;
AbstractRailBlock abstractrailblock = (AbstractRailBlock) trackState.getBlock();
@ -125,9 +125,9 @@ public class MinecartSim2020 {
break;
}
Pair<Vec3i, Vec3i> pair = MATRIX.get(railshape);
Vec3i vec3i = pair.getFirst();
Vec3i vec3i1 = pair.getSecond();
Pair<Vector3i, Vector3i> pair = MATRIX.get(railshape);
Vector3i vec3i = pair.getFirst();
Vector3i vec3i1 = pair.getSecond();
double d4 = (double) (vec3i1.getX() - vec3i.getX());
double d5 = (double) (vec3i1.getZ() - vec3i.getZ());
// double d6 = Math.sqrt(d4 * d4 + d5 * d5);
@ -177,16 +177,16 @@ public class MinecartSim2020 {
y = cart.getY();
z = cart.getZ();
Vec3d vec3d3 = cart.getPos(x, y, z);
if (vec3d3 != null && actualVec != null) {
double d17 = (actualVec.y - vec3d3.y) * 0.05D;
Vec3d vec3d4 = cart.getMotion();
double d18 = Math.sqrt(horizontalMag(vec3d4));
Vector3d Vector3d3 = cart.getPos(x, y, z);
if (Vector3d3 != null && actualVec != null) {
double d17 = (actualVec.y - Vector3d3.y) * 0.05D;
Vector3d Vector3d4 = cart.getMotion();
double d18 = Math.sqrt(horizontalMag(Vector3d4));
if (d18 > 0.0D) {
cart.setMotion(vec3d4.mul((d18 + d17) / d18, 1.0D, (d18 + d17) / d18));
cart.setMotion(Vector3d4.mul((d18 + d17) / d18, 1.0D, (d18 + d17) / d18));
}
cart.setPosition(x, vec3d3.y, z);
cart.setPosition(x, Vector3d3.y, z);
}
x = cart.getX();
@ -196,24 +196,24 @@ public class MinecartSim2020 {
int j = MathHelper.floor(x);
int i = MathHelper.floor(z);
if (j != cartPos.getX() || i != cartPos.getZ()) {
Vec3d vec3d5 = cart.getMotion();
double d26 = Math.sqrt(horizontalMag(vec3d5));
cart.setMotion(d26 * (double) (j - cartPos.getX()), vec3d5.y, d26 * (double) (i - cartPos.getZ()));
Vector3d Vector3d5 = cart.getMotion();
double d26 = Math.sqrt(horizontalMag(Vector3d5));
cart.setMotion(d26 * (double) (j - cartPos.getX()), Vector3d5.y, d26 * (double) (i - cartPos.getZ()));
}
cart.setMotion(previousMotion);
if (cart instanceof FurnaceMinecartEntity) {
// FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart;
// Vec3d vec3d = cart.getMotion();
// double d2 = horizontalMag(vec3d);
// Vector3d Vector3d = cart.getMotion();
// double d2 = horizontalMag(Vector3d);
// double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ;
// if (d3 > 1.0E-4D && d2 > 0.001D) {
// double d40 = (double) MathHelper.sqrt(d2);
// double d50 = (double) MathHelper.sqrt(d3);
// furnaceCart.pushX = vec3d.x / d40 * d50;
// furnaceCart.pushZ = vec3d.z / d40 * d50;
// furnaceCart.setMotion(vec3d.mul(0.8D, 0.0D, 0.8D)
// furnaceCart.pushX = Vector3d.x / d40 * d50;
// furnaceCart.pushZ = Vector3d.z / d40 * d50;
// furnaceCart.setMotion(Vector3d.mul(0.8D, 0.0D, 0.8D)
// .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ));
// }
}

View file

@ -18,7 +18,7 @@ import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
public class MinecartTrain {
@ -201,7 +201,7 @@ public class MinecartTrain {
}
public void hardCollisionStep(World world, Couple<AbstractMinecartEntity> carts, double couplingLength) {
Couple<Vec3d> corrections = Couple.create(null, null);
Couple<Vector3d> corrections = Couple.create(null, null);
Couple<Float> maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail);
boolean firstLoop = true;
for (boolean current : new boolean[] { true, false, true }) {
@ -220,9 +220,9 @@ public class MinecartTrain {
shape = block.getRailDirection(railState, world, railPosition, cart);
}
Vec3d correction = Vec3d.ZERO;
Vec3d pos = cart.getPositionVec();
Vec3d link = otherCart.getPositionVec()
Vector3d correction = Vector3d.ZERO;
Vector3d pos = cart.getPositionVec();
Vector3d link = otherCart.getPositionVec()
.subtract(pos);
float correctionMagnitude = firstLoop ? -stress / 2f : -stress;
correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos)
@ -248,7 +248,7 @@ public class MinecartTrain {
public void softCollisionStep(World world, Couple<AbstractMinecartEntity> carts, double couplingLength) {
Couple<Vec3d> positions = carts.map(Entity::getPositionVector);
Couple<Vector3d> positions = carts.map(Entity::getPositionVec);
Couple<Float> maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail);
Couple<Boolean> canAddmotion = carts.map(MinecartSim2020::canAddMotion);
@ -261,9 +261,9 @@ public class MinecartTrain {
return block.getRailDirection(railState, world, railPosition, current);
});
Couple<Vec3d> motions = carts.map(MinecartSim2020::predictMotionOf);
Couple<Vec3d> nextPositions = positions.copy();
nextPositions.replaceWithParams(Vec3d::add, motions);
Couple<Vector3d> motions = carts.map(MinecartSim2020::predictMotionOf);
Couple<Vector3d> nextPositions = positions.copy();
nextPositions.replaceWithParams(Vector3d::add, motions);
float futureStress = (float) (couplingLength - nextPositions.getFirst()
.distanceTo(nextPositions.getSecond()));
@ -271,9 +271,9 @@ public class MinecartTrain {
return;
for (boolean current : Iterate.trueAndFalse) {
Vec3d correction = Vec3d.ZERO;
Vec3d pos = nextPositions.get(current);
Vec3d link = nextPositions.get(!current)
Vector3d correction = Vector3d.ZERO;
Vector3d pos = nextPositions.get(current);
Vector3d link = nextPositions.get(!current)
.subtract(pos);
float correctionMagnitude = -futureStress / 2f;
@ -293,16 +293,16 @@ public class MinecartTrain {
carts.forEachWithParams(Entity::setMotion, motions);
}
public static Vec3d followLinkOnRail(Vec3d link, Vec3d cart, float diffToReduce, RailShape shape) {
Vec3d railAxis = getRailVec(shape);
public static Vector3d followLinkOnRail(Vector3d link, Vector3d cart, float diffToReduce, RailShape shape) {
Vector3d railAxis = getRailVec(shape);
double dotProduct = railAxis.dotProduct(link);
if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0)
return cart;
Vec3d axis = railAxis.scale(-Math.signum(dotProduct));
Vec3d center = cart.add(link);
Vector3d axis = railAxis.scale(-Math.signum(dotProduct));
Vector3d center = cart.add(link);
double radius = link.length() - diffToReduce;
Vec3d intersectSphere = VecHelper.intersectSphere(cart, axis, center, radius);
Vector3d intersectSphere = VecHelper.intersectSphere(cart, axis, center, radius);
// Cannot satisfy on current rail vector
if (intersectSphere == null)
@ -311,24 +311,24 @@ public class MinecartTrain {
return intersectSphere;
}
private static Vec3d getRailVec(RailShape shape) {
private static Vector3d getRailVec(RailShape shape) {
switch (shape) {
case ASCENDING_NORTH:
case ASCENDING_SOUTH:
case NORTH_SOUTH:
return new Vec3d(0, 0, 1);
return new Vector3d(0, 0, 1);
case ASCENDING_EAST:
case ASCENDING_WEST:
case EAST_WEST:
return new Vec3d(1, 0, 0);
return new Vector3d(1, 0, 0);
case NORTH_EAST:
case SOUTH_WEST:
return new Vec3d(1, 0, 1).normalize();
return new Vector3d(1, 0, 1).normalize();
case NORTH_WEST:
case SOUTH_EAST:
return new Vec3d(1, 0, -1).normalize();
return new Vector3d(1, 0, -1).normalize();
default:
return new Vec3d(0, 1, 0);
return new Vector3d(0, 1, 0);
}
}
@ -345,9 +345,9 @@ public class MinecartTrain {
return;
int yOffset = 1;
Vec3d mainCenter = mainCart.getPositionVec()
Vector3d mainCenter = mainCart.getPositionVec()
.add(0, yOffset, 0);
Vec3d connectedCenter = connectedCart.getPositionVec()
Vector3d connectedCenter = connectedCart.getPositionVec()
.add(0, yOffset, 0);
int color = ColorHelper.mixColors(0xabf0e9, 0xee8572,
@ -357,7 +357,7 @@ public class MinecartTrain {
.colored(color)
.lineWidth(1 / 8f);
Vec3d point = mainCart.getPositionVec()
Vector3d point = mainCart.getPositionVec()
.add(0, yOffset, 0);
CreateClient.outliner.showLine(coupling.getId() + "" + index, point, point.add(0, 1 / 128f, 0))
.colored(0xffffff)

View file

@ -108,10 +108,11 @@ public class ReinforcedRailBlock extends AbstractRailBlock {
return PushReaction.BLOCK;
}
/* FIXME: Same thing as before, does this still matter? If so, what is the new way of doing it?
@Override
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
return false;
}
}*/
@Override
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) {

View file

@ -47,7 +47,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
@Override
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity e) {
if (!e.onGround)
if (!e.isOnGround())
return;
if (e.getMotion().y > 0)
return;
@ -61,7 +61,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
World world = e.getEntityWorld();
if (world.isRemote && (e instanceof PlayerEntity)) {
if (worldIn.getBlockState(e.getPosition()) != state) {
if (worldIn.getBlockState(e.getBlockPos()) != state) {
Vector3d origin = VecHelper.getCenterOf(pos);
Vector3d offset = e.getPositionVec()
.subtract(origin);

View file

@ -13,11 +13,11 @@ public class TurntableHandler {
public static void gameRenderTick() {
Minecraft mc = Minecraft.getInstance();
BlockPos pos = mc.player.getPosition();
BlockPos pos = mc.player.getBlockPos();
if (!AllBlocks.TURNTABLE.has(mc.world.getBlockState(pos)))
return;
if (!mc.player.onGround)
if (!mc.player.isOnGround())
return;
if (mc.isGamePaused())
return;

View file

@ -8,6 +8,7 @@ import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.fluid.Fluids;
@ -24,6 +25,10 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<WaterWheelTileEntity> {
public WaterWheelBlock(Properties properties) {
@ -61,10 +66,9 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
@Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) {
World world = worldIn.getWorld();
if (world == null || worldIn instanceof WrappedWorld)
if (worldIn instanceof WrappedWorld)
return stateIn;
updateFlowAt(stateIn, world, currentPos, facing);
updateFlowAt(stateIn, worldIn, currentPos, facing);
updateWheelSpeed(worldIn, currentPos);
return stateIn;
}
@ -80,7 +84,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
updateWheelSpeed(worldIn, pos);
}
private void updateFlowAt(BlockState state, World world, BlockPos pos, Direction f) {
private void updateFlowAt(BlockState state, IWorld world, BlockPos pos, Direction f) {
if (f.getAxis() == state.get(HORIZONTAL_FACING)
.getAxis())
return;
@ -113,7 +117,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
flowStrength = flow.y > 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y;
}
if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote) {
if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote()) {
AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5);
if (fluid.getFluid() == Fluids.FLOWING_LAVA || fluid.getFluid() == Fluids.LAVA)
AllTriggers.triggerForNearbyPlayers(AllTriggers.LAVA_WHEEL, world, pos, 5);

View file

@ -29,7 +29,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
if (compound.contains("Flows")) {
for (Direction d : Direction.values())
setFlow(d, compound.getCompound("Flows")
.getFloat(d.getName()));
.getFloat(d.getString()));
}
}
@ -42,7 +42,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
public void write(CompoundNBT compound, boolean clientPacket) {
CompoundNBT flows = new CompoundNBT();
for (Direction d : Direction.values())
flows.putFloat(d.getName(), this.flows.get(d));
flows.putFloat(d.getString(), this.flows.get(d));
compound.put("Flows", flows);
super.write(compound, clientPacket);

View file

@ -7,13 +7,13 @@ import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import net.minecraft.block.BlockState;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
public class FluidPipeAttachmentBehaviour extends TileEntityBehaviour {
public static BehaviourType<FluidPipeAttachmentBehaviour> TYPE = new BehaviourType<>();
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
if (!isPipeConnectedTowards(state, direction))
return AttachmentTypes.NONE;

View file

@ -37,7 +37,7 @@ import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -296,15 +296,15 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
return;
float rimRadius = getRimRadius(state, side);
Vec3d directionVec = new Vec3d(side.getDirectionVec());
Vector3d directionVec = Vector3d.of(side.getDirectionVec());
for (int i = 0; i < amount; i++) {
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, 1)
Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, 1)
.normalize();
vec = VecHelper.clampComponentWise(vec, rimRadius)
.mul(VecHelper.axisAlingedPlaneOf(directionVec))
.add(directionVec.scale(.45 + r.nextFloat() / 16f));
Vec3d m = vec;
Vector3d m = vec;
vec = vec.add(VecHelper.getCenterOf(pos));
world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z);
@ -317,7 +317,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
.getDefaultState()
.getBlockState());
float rimRadius = getRimRadius(state, side);
Vec3d directionVec = new Vec3d(side.getDirectionVec());
Vector3d directionVec = Vector3d.of(side.getDirectionVec());
Couple<PipeFlows> couple = allFlows.get(side);
if (couple == null)
@ -326,11 +326,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
if (flow.progress == null)
return;
for (int i = 0; i < amount; i++) {
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, rimRadius);
Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, rimRadius);
vec = vec.mul(VecHelper.axisAlingedPlaneOf(directionVec))
.add(directionVec.scale(.5 + r.nextFloat() / 4f));
Vec3d m = vec;
Vec3d centerOf = VecHelper.getCenterOf(tileEntity.getPos());
Vector3d m = vec;
Vector3d centerOf = VecHelper.getCenterOf(tileEntity.getPos());
vec = vec.add(centerOf);
if (inbound) {
vec = vec.add(m);
@ -350,7 +350,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
.getRenderViewEntity();
if (renderViewEntity == null)
return false;
Vec3d center = VecHelper.getCenterOf(tileEntity.getPos());
Vector3d center = VecHelper.getCenterOf(tileEntity.getPos());
if (renderViewEntity.getPositionVec()
.distanceTo(center) > MAX_PARTICLE_RENDER_DISTANCE)
return false;
@ -411,7 +411,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
return;
for (Entry<Direction, Couple<PipeFlows>> entry : allFlows.entrySet()) {
Direction face = entry.getKey();
Vec3d directionVec = new Vec3d(face.getDirectionVec());
Vector3d directionVec = Vector3d.of(face.getDirectionVec());
float size = 1 / 4f;
boolean extended = !isConnectedTo(tileEntity.getBlockState(), face.getOpposite());
float length = extended ? .75f : .5f;
@ -421,11 +421,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
if (flow.progress == null)
return;
float value = flow.progress.getValue();
Vec3d start = directionVec.scale(inbound ? .5 : .5f - length);
Vec3d offset = directionVec.scale(length * (inbound ? -1 : 1))
Vector3d start = directionVec.scale(inbound ? .5 : .5f - length);
Vector3d offset = directionVec.scale(length * (inbound ? -1 : 1))
.scale(value);
Vec3d scale = new Vec3d(1, 1, 1).subtract(directionVec.scale(face.getAxisDirection()
Vector3d scale = new Vector3d(1, 1, 1).subtract(directionVec.scale(face.getAxisDirection()
.getOffset()))
.scale(size);
AxisAlignedBB bb =

View file

@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.simibubi.create.foundation.utility.BlockHelper;
import org.apache.commons.lang3.mutable.MutableObject;
import com.simibubi.create.AllBlocks;
@ -27,7 +28,7 @@ import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
@ -73,11 +74,11 @@ public class FluidPropagator {
if (PumpBlock.isPump(connectedState) && connectedState.get(PumpBlock.FACING)
.getAxis() == side.getAxis())
return false;
if (Block.hasSolidSide(connectedState, reader, connectedPos, side.getOpposite()))
if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite()))
return false;
if (!(connectedState.getMaterial()
.isReplaceable() && connectedState.getBlockHardness(reader, connectedPos) != -1)
&& !connectedState.has(BlockStateProperties.WATERLOGGED))
&& !BlockHelper.hasBlockStateProperty(connectedState, BlockStateProperties.WATERLOGGED))
return false;
return true;
}
@ -139,14 +140,14 @@ public class FluidPropagator {
public static OutlineParams showBlockFace(BlockFace face) {
MutableObject<OutlineParams> params = new MutableObject<>(new OutlineParams());
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
Vec3d directionVec = new Vec3d(face.getFace()
Vector3d directionVec = Vector3d.of(face.getFace()
.getDirectionVec());
Vec3d scaleVec = directionVec.scale(-.25f * face.getFace()
Vector3d scaleVec = directionVec.scale(-.25f * face.getFace()
.getAxisDirection()
.getOffset());
directionVec = directionVec.scale(.5f);
params.setValue(CreateClient.outliner.showAABB(face,
FluidPropagator.smallCenter.offset(directionVec.add(new Vec3d(face.getPos())))
FluidPropagator.smallCenter.offset(directionVec.add(Vector3d.of(face.getPos())))
.grow(scaleVec.x, scaleVec.y, scaleVec.z)
.grow(1 / 16f)));
});

View file

@ -6,7 +6,7 @@ import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
@ -21,7 +21,7 @@ public class FluidReactions {
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
}
public static void handlePipeSpillCollision(World world, BlockPos pos, Fluid pipeFluid, IFluidState worldFluid) {
public static void handlePipeSpillCollision(World world, BlockPos pos, Fluid pipeFluid, FluidState worldFluid) {
Fluid pf = FluidHelper.convertToStill(pipeFluid);
Fluid wf = worldFluid.getFluid();
if (pf == Fluids.WATER && wf == Fluids.LAVA)

View file

@ -3,13 +3,14 @@ package com.simibubi.create.content.contraptions.fluids;
import javax.annotation.Nullable;
import com.simibubi.create.foundation.utility.BlockFace;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.math.BlockPos;
@ -44,8 +45,8 @@ public class OpenEndedPipe {
}
BlockState state = world.getBlockState(outputPos);
IFluidState fluidState = state.getFluidState();
boolean waterlog = state.has(BlockStateProperties.WATERLOGGED);
FluidState fluidState = state.getFluidState();
boolean waterlog = BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED);
if (!waterlog && !state.getMaterial()
.isReplaceable())
@ -128,14 +129,14 @@ public class OpenEndedPipe {
if (resource.isEmpty())
return 0;
BlockState state = world.getBlockState(outputPos);
IFluidState fluidState = state.getFluidState();
FluidState fluidState = state.getFluidState();
if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) {
FluidReactions.handlePipeSpillCollision(world, outputPos, resource.getFluid(), fluidState);
return 0;
}
if (fluidState.isSource())
return 0;
if (!(state.has(BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER)
if (!(BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER)
&& !state.getMaterial()
.isReplaceable())
return 0;

View file

@ -17,7 +17,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
@ -31,7 +31,7 @@ public class PipeAttachmentModel extends WrappedBakedModel {
}
@Override
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
PipeModelData data = new PipeModelData();
FluidPipeAttachmentBehaviour attachmentBehaviour =
TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE);

View file

@ -153,10 +153,10 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
FluidState ifluidstate = context.getWorld()
FluidState FluidState = context.getWorld()
.getFluidState(context.getPos());
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
}
public static boolean isPump(BlockState state) {

View file

@ -25,7 +25,7 @@ import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
@ -368,7 +368,7 @@ public class PumpTileEntity extends KineticTileEntity {
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
if (attachment == AttachmentTypes.RIM)
return AttachmentTypes.NONE;

View file

@ -27,7 +27,7 @@ import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
@ -228,7 +228,7 @@ public class SpoutTileEntity extends SmartTileEntity {
}
protected void spawnProcessingParticles(FluidStack fluid) {
Vec3d vec = VecHelper.getCenterOf(pos);
Vector3d vec = VecHelper.getCenterOf(pos);
vec = vec.subtract(0, 8 / 16f, 0);
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
.getDefaultState()
@ -239,14 +239,14 @@ public class SpoutTileEntity extends SmartTileEntity {
protected static int SPLASH_PARTICLE_COUNT = 20;
protected void spawnSplash(FluidStack fluid) {
Vec3d vec = VecHelper.getCenterOf(pos);
Vector3d vec = VecHelper.getCenterOf(pos);
vec = vec.subtract(0, 2 - 5 / 16f, 0);
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
.getDefaultState()
.getBlockState());
for (int i = 0; i < SPLASH_PARTICLE_COUNT; i++) {
Vec3d m = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, 0.25f);
m = new Vec3d(m.x, Math.abs(m.y), m.z);
Vector3d m = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, 0.25f);
m = new Vector3d(m.x, Math.abs(m.y), m.z);
world.addOptionalParticle(particle, vec.x, vec.y, vec.z, m.x, m.y, m.z);
}
}

View file

@ -18,7 +18,7 @@ import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.SixWayBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemUseContext;
import net.minecraft.network.DebugPacketSender;
@ -33,7 +33,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.TickPriority;
import net.minecraft.world.World;
@ -140,7 +140,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
return state.getBlock() instanceof FluidPipeBlock;
}
public static boolean canConnectTo(ILightReader world, BlockPos pos, BlockState neighbour, Direction blockFace) {
public static boolean canConnectTo(IBlockDisplayReader world, BlockPos pos, BlockState neighbour, Direction blockFace) {
if (isPipe(neighbour) || FluidPropagator.hasFluidCapability(neighbour, world, pos, blockFace))
return true;
FluidPipeAttachmentBehaviour attachmentBehaviour =
@ -150,7 +150,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
return attachmentBehaviour.isPipeConnectedTowards(neighbour, blockFace);
}
public static boolean shouldDrawRim(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
public static boolean shouldDrawRim(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
BlockPos offsetPos = pos.offset(direction);
BlockState facingState = world.getBlockState(offsetPos);
if (!isPipe(facingState))
@ -170,11 +170,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
return state.get(FACING_TO_PROPERTY_MAP.get(direction));
}
public static boolean isCornerOrEndPipe(ILightReader world, BlockPos pos, BlockState state) {
public static boolean isCornerOrEndPipe(IBlockDisplayReader world, BlockPos pos, BlockState state) {
return isPipe(state) && !FluidPropagator.isStraightPipe(state) && !shouldDrawCasing(world, pos, state);
}
public static boolean shouldDrawCasing(ILightReader world, BlockPos pos, BlockState state) {
public static boolean shouldDrawCasing(IBlockDisplayReader world, BlockPos pos, BlockState state) {
if (!isPipe(state))
return false;
for (Axis axis : Iterate.axes) {
@ -196,11 +196,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
IFluidState ifluidstate = context.getWorld()
FluidState FluidState = context.getWorld()
.getFluidState(context.getPos());
return updateBlockState(getDefaultState(), context.getNearestLookingDirection(), null, context.getWorld(),
context.getPos()).with(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
}
@Override
@ -214,7 +214,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
}
public BlockState updateBlockState(BlockState state, Direction preferredDirection, @Nullable Direction ignore,
ILightReader world, BlockPos pos) {
IBlockDisplayReader world, BlockPos pos) {
// Update sides that are not ignored
for (Direction d : Iterate.directions)
if (d != ignore)
@ -241,7 +241,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
}
@Override
public IFluidState getFluidState(BlockState state) {
public FluidState getFluidState(BlockState state) {
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
: Fluids.EMPTY.getDefaultState();
}

View file

@ -11,7 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
public class FluidPipeTileEntity extends SmartTileEntity {
@ -45,7 +45,7 @@ public class FluidPipeTileEntity extends SmartTileEntity {
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
BlockPos offsetPos = pos.offset(direction);

View file

@ -12,7 +12,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
public class StraightPipeTileEntity extends SmartTileEntity {
@ -46,7 +46,7 @@ public class StraightPipeTileEntity extends SmartTileEntity {
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
public AttachmentTypes getAttachment(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
BlockState otherState = world.getBlockState(pos.offset(direction));
if (state.getBlock() instanceof AxisPipeBlock && otherState.getBlock() instanceof AxisPipeBlock) {

View file

@ -31,7 +31,7 @@ import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
@ -171,10 +171,10 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
if (reversed)
level = 1 - level;
Vec3d vec = ray.getHitVec();
vec = new Vec3d(vec.x, controllerTE.getPos()
Vector3d vec = ray.getHitVec();
vec = new Vector3d(vec.x, controllerTE.getPos()
.getY() + level * (controllerTE.height - .5f) + .25f, vec.z);
Vec3d motion = player.getPositionVec()
Vector3d motion = player.getPositionVec()
.subtract(vec)
.scale(1 / 20f);
vec = vec.add(motion);
@ -222,7 +222,7 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
PLAIN, WINDOW, WINDOW_NW, WINDOW_SW, WINDOW_NE, WINDOW_SE;
@Override
public String getName() {
public String getString() {
return Lang.asId(name());
}
}

View file

@ -6,7 +6,7 @@ import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
import net.minecraft.block.BlockState;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
@ -19,7 +19,7 @@ public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
}
@Override
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos, BlockPos otherPos,
public boolean connectsTo(BlockState state, BlockState other, IBlockDisplayReader reader, BlockPos pos, BlockPos otherPos,
Direction face) {
return state.getBlock() == other.getBlock() && FluidTankConnectivityHandler.isConnected(reader, pos, otherPos);
}

View file

@ -38,7 +38,7 @@ public class FluidTankGenerator extends SpecialBlockStateGen {
shapeName = "bottom";
return AssetLookup.partialBaseModel(ctx, prov,
shapeName + (shape == Shape.PLAIN ? "" : "_" + shape.getName()));
shapeName + (shape == Shape.PLAIN ? "" : "_" + shape.getString()));
}
}

View file

@ -16,7 +16,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelProperty;
@ -31,7 +31,7 @@ public class FluidTankModel extends CTModel {
}
@Override
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
CullData cullData = new CullData();
for (Direction d : Iterate.horizontalDirections)
cullData.setCulled(d, FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(d)));

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.goggles;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
@ -8,6 +8,7 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
@ -17,22 +18,22 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
private int offsetX;
private int offsetY;
private final List<String> tooltip;
private final List<ITextComponent> tooltip;
public GoggleConfigScreen() {
String spacing = " ";
tooltip = new ArrayList<>();
tooltip.add(spacing + Lang.translate("gui.config.overlay1"));
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2"));
tooltip.add("");
tooltip.add(spacing + Lang.translate("gui.config.overlay3"));
tooltip.add(spacing + Lang.translate("gui.config.overlay4"));
tooltip.add("");
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5"));
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6"));
tooltip.add("");
tooltip.add(spacing + Lang.translate("gui.config.overlay7"));
tooltip.add(spacing + Lang.translate("gui.config.overlay8"));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay1")));
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2")));
tooltip.add(ITextComponent.of(""));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay3")));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay4")));
tooltip.add(ITextComponent.of(""));
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5")));
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6")));
tooltip.add(ITextComponent.of(""));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay7")));
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay8")));
}
@Override
@ -71,16 +72,16 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
}
@Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
RenderSystem.pushMatrix();
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
ms.push();
int posX = this.width / 2 + offsetX;
int posY = this.height / 2 + offsetY;
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
renderTooltip(tooltip, posX, posY);
renderTooltip(ms, tooltip, posX, posY);
ItemStack item = AllItems.GOGGLES.asStack();
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
GuiGameElement.of(item).at(posX + 10, posY - 16).render();
RenderSystem.popMatrix();
ms.pop();
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.contraptions.goggles;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.config.AllConfigs;
@ -29,6 +30,7 @@ public class GoggleOverlayRenderer {
@SubscribeEvent
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
MatrixStack ms = event.getMatrixStack();
if (event.getType() != ElementType.HOTBAR)
return;
@ -49,7 +51,7 @@ public class GoggleOverlayRenderer {
if (!goggleInformation && !hoveringInformation)
return;
List<String> tooltip = new ArrayList<>();
List<ITextComponent> tooltip = new ArrayList<>();
if (goggleInformation && AllItems.GOGGLES.isIn(goggles)) {
IHaveGoggleInformation gte = (IHaveGoggleInformation) te;
@ -60,7 +62,7 @@ public class GoggleOverlayRenderer {
if (hoveringInformation) {
boolean goggleAddedInformation = !tooltip.isEmpty();
if (goggleAddedInformation)
tooltip.add("");
tooltip.add(ITextComponent.of(""));
IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
if (!hte.addToTooltip(tooltip, mc.player.isSneaking()))
hoveringInformation = false;
@ -79,7 +81,7 @@ public class GoggleOverlayRenderer {
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
tooltipScreen.renderTooltip(tooltip, posX, posY);
tooltipScreen.renderTooltip(ms, tooltip, posX, posY);
ItemStack item = AllItems.GOGGLES.asStack();
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
@ -95,9 +97,9 @@ public class GoggleOverlayRenderer {
@Override
public void init(Minecraft mc, int width, int height) {
this.minecraft = mc;
this.client = mc;
this.itemRenderer = mc.getItemRenderer();
this.font = mc.fontRenderer;
this.textRenderer = mc.fontRenderer;
this.width = width;
this.height = height;
}

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.contraptions.goggles;
import net.minecraft.util.text.ITextComponent;
import java.text.DecimalFormat;
import java.util.List;
@ -17,7 +19,7 @@ public interface IHaveGoggleInformation {
* @return {{@code true}} if the tooltip creation was successful and should be displayed,
* or {{@code false}} if the overlay should not be displayed
* */
default boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking){
default boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking){
return false;
}

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.contraptions.goggles;
import net.minecraft.util.text.ITextComponent;
import java.util.List;
/*
@ -7,7 +9,7 @@ import java.util.List;
* */
public interface IHaveHoveringInformation {
default boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking){
default boolean addToTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking){
return false;
}

View file

@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particles.BlockParticleData;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntity;
@ -25,8 +26,8 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
private EncasedFanTileEntity source;
protected AirFlowParticle(World world, EncasedFanTileEntity source, double x, double y, double z,
IAnimatedSprite sprite) {
protected AirFlowParticle(ClientWorld world, EncasedFanTileEntity source, double x, double y, double z,
IAnimatedSprite sprite) {
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
this.source = source;
this.particleScale *= 0.75F;
@ -159,7 +160,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
this.spriteSet = animatedSprite;
}
public Particle makeParticle(AirFlowParticleData data, World worldIn, double x, double y, double z,
public Particle makeParticle(AirFlowParticleData data, ClientWorld worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) {
TileEntity te = worldIn.getTileEntity(new BlockPos(data.posX, data.posY, data.posZ));
if (!(te instanceof EncasedFanTileEntity))

View file

@ -9,10 +9,11 @@ import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
public class AirParticle extends SimpleAnimatedParticle {
@ -24,8 +25,8 @@ public class AirParticle extends SimpleAnimatedParticle {
private float twirlRadius, twirlAngleOffset;
private Axis twirlAxis;
protected AirParticle(World world, AirParticleData data, double x, double y, double z, double dx, double dy,
double dz, IAnimatedSprite sprite) {
protected AirParticle(ClientWorld world, AirParticleData data, double x, double y, double z, double dx, double dy,
double dz, IAnimatedSprite sprite) {
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
particleScale *= 0.75F;
canCollide = false;
@ -44,7 +45,7 @@ public class AirParticle extends SimpleAnimatedParticle {
twirlAxis = Create.random.nextBoolean() ? Axis.X : Axis.Z;
// speed in m/ticks
maxAge = Math.min((int) (new Vec3d(dx, dy, dz).length() / data.speed), 60);
maxAge = Math.min((int) (new Vector3d(dx, dy, dz).length() / data.speed), 60);
selectSprite(7);
setAlphaF(.25f);
}
@ -65,7 +66,7 @@ public class AirParticle extends SimpleAnimatedParticle {
float progress = (float) Math.pow(((float) age) / maxAge, drag);
float angle = (progress * 2 * 360 + twirlAngleOffset) % 360;
Vec3d twirl = VecHelper.rotate(new Vec3d(0, twirlRadius, 0), angle, twirlAxis);
Vector3d twirl = VecHelper.rotate(new Vector3d(0, twirlRadius, 0), angle, twirlAxis);
float x = (float) (MathHelper.lerp(progress, originX, targetX) + twirl.x);
float y = (float) (MathHelper.lerp(progress, originY, targetY) + twirl.y);
@ -95,7 +96,7 @@ public class AirParticle extends SimpleAnimatedParticle {
this.spriteSet = animatedSprite;
}
public Particle makeParticle(AirParticleData data, World worldIn, double x, double y, double z, double xSpeed,
public Particle makeParticle(AirParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed,
double ySpeed, double zSpeed) {
return new AirParticle(worldIn, data, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.contraptions.particle;
import net.minecraft.client.world.ClientWorld;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
@ -84,7 +85,7 @@ public class CubeParticle extends Particle {
protected float scale;
protected boolean hot;
public CubeParticle(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
public CubeParticle(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) {
super(world, x, y, z);
this.motionX = motionX;
this.motionY = motionY;
@ -113,9 +114,9 @@ public class CubeParticle extends Particle {
if (this.hot && this.age > 0) {
if (this.prevPosY == this.posY) {
billowing = true;
field_228343_B_ = false; // Prevent motion being ignored due to vertical collision
field_21507 = false; // Prevent motion being ignored due to vertical collision
if (this.motionX == 0 && this.motionZ == 0) {
Vec3d diff = new Vec3d(new BlockPos(posX, posY, posZ)).add(0.5, 0.5, 0.5).subtract(posX, posY, posZ);
Vector3d diff = Vector3d.of(new BlockPos(posX, posY, posZ)).add(0.5, 0.5, 0.5).subtract(posX, posY, posZ);
this.motionX = -diff.x * 0.1;
this.motionZ = -diff.z * 0.1;
}
@ -170,7 +171,7 @@ public class CubeParticle extends Particle {
public Factory() {}
@Override
public Particle makeParticle(CubeParticleData data, World world, double x, double y, double z, double motionX,
public Particle makeParticle(CubeParticleData data, ClientWorld world, double x, double y, double z, double motionX,
double motionY, double motionZ) {
CubeParticle particle = new CubeParticle(world, x, y, z, motionX, motionY, motionZ);
particle.setColor(data.r, data.g, data.b);

View file

@ -8,6 +8,7 @@ import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
@ -17,8 +18,8 @@ public class HeaterParticle extends SimpleAnimatedParticle {
private final IAnimatedSprite animatedSprite;
public HeaterParticle(World worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy,
double vz, IAnimatedSprite spriteSet) {
public HeaterParticle(ClientWorld worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy,
double vz, IAnimatedSprite spriteSet) {
super(worldIn, x, y, z, spriteSet, worldIn.rand.nextFloat() * .5f);
this.animatedSprite = spriteSet;
@ -102,7 +103,7 @@ public class HeaterParticle extends SimpleAnimatedParticle {
}
@Override
public Particle makeParticle(HeaterParticleData data, World worldIn, double x, double y, double z, double vx,
public Particle makeParticle(HeaterParticleData data, ClientWorld worldIn, double x, double y, double z, double vx,
double vy, double vz) {
return new HeaterParticle(worldIn, data.r, data.g, data.b, x, y, z, vx, vy, vz, this.spriteSet);
}

View file

@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
@ -28,8 +29,8 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
protected Vector3d offset;
protected boolean isVisible;
private RotationIndicatorParticle(World world, double x, double y, double z, int color, float radius1,
float radius2, float speed, Axis axis, int lifeSpan, boolean isVisible, IAnimatedSprite sprite) {
private RotationIndicatorParticle(ClientWorld world, double x, double y, double z, int color, float radius1,
float radius2, float speed, Axis axis, int lifeSpan, boolean isVisible, IAnimatedSprite sprite) {
super(world, x, y, z, sprite, 0);
this.motionX = 0;
this.motionY = 0;
@ -82,7 +83,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
this.spriteSet = animatedSprite;
}
public Particle makeParticle(RotationIndicatorParticleData data, World worldIn, double x, double y, double z,
public Particle makeParticle(RotationIndicatorParticleData data, ClientWorld worldIn, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) {
ClientPlayerEntity player = Minecraft.getInstance().player;
boolean visible = player != null && GogglesItem.canSeeParticles(player);

View file

@ -75,21 +75,21 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
@Override
public void onLanded(IBlockReader worldIn, Entity entityIn) {
super.onLanded(worldIn, entityIn);
if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getPosition())))
if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getBlockPos())))
return;
if (!(entityIn instanceof ItemEntity))
return;
if (!entityIn.isAlive())
return;
ItemEntity itemEntity = (ItemEntity) entityIn;
withTileEntityDo(worldIn, entityIn.getPosition(), te -> {
withTileEntityDo(worldIn, entityIn.getBlockPos(), te -> {
ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputInventory, itemEntity.getItem()
.copy(), false);
if (insertItem.isEmpty()) {
itemEntity.remove();
if (!itemEntity.world.isRemote)
AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world,
itemEntity.getPosition(), 3);
itemEntity.getBlockPos(), 3);
return;
}

View file

@ -21,7 +21,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
@ -54,7 +54,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new DirectBeltInputBehaviour(this));
filtering = new FilteringBehaviour(this, new BasinValueBox()).moveText(new Vec3d(2, -8, 0))
filtering = new FilteringBehaviour(this, new BasinValueBox()).moveText(new Vector3d(2, -8, 0))
.withCallback(newFilter -> contentsChanged = true)
.forRecipes();
behaviours.add(filtering);
@ -145,7 +145,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
class BasinValueBox extends ValueBoxTransform.Sided {
@Override
protected Vec3d getSouthLocation() {
protected Vector3d getSouthLocation() {
return VecHelper.voxelSpace(8, 12, 16);
}

View file

@ -31,7 +31,7 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.WeightedSpawnerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
@ -115,20 +115,20 @@ public class BlazeBurnerBlockItem extends BlockItem {
}
@Override
public boolean itemInteractionForEntity(ItemStack heldItem, PlayerEntity player, LivingEntity entity, Hand hand) {
public ActionResultType itemInteractionForEntity(ItemStack heldItem, PlayerEntity player, LivingEntity entity, Hand hand) {
if (hasCapturedBlaze())
return false;
return ActionResultType.PASS;
if (!(entity instanceof BlazeEntity))
return false;
return ActionResultType.PASS;
World world = player.world;
spawnCaptureEffects(world, entity.getPositionVec());
if (world.isRemote)
return true;
return ActionResultType.FAIL;
giveBurnerItemTo(player, heldItem, hand);
entity.remove();
return true;
return ActionResultType.SUCCESS;
}
protected void giveBurnerItemTo(PlayerEntity player, ItemStack heldItem, Hand hand) {
@ -142,12 +142,12 @@ public class BlazeBurnerBlockItem extends BlockItem {
player.inventory.placeItemBackInInventory(player.world, filled);
}
private void spawnCaptureEffects(World world, Vec3d vec) {
private void spawnCaptureEffects(World world, Vector3d vec) {
if (world.isRemote) {
for (int i = 0; i < 40; i++) {
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .125f);
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .125f);
world.addParticle(ParticleTypes.FLAME, vec.x, vec.y, vec.z, motion.x, motion.y, motion.z);
Vec3d circle = motion.mul(1, 0, 1)
Vector3d circle = motion.mul(1, 0, 1)
.normalize()
.scale(.5f);
world.addParticle(ParticleTypes.SMOKE, circle.x, vec.y, circle.z, 0, -0.125, 0);

View file

@ -25,7 +25,7 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.entity.ProjectileImpactEvent;
@ -232,22 +232,22 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
if (r.nextDouble() > 0.25)
return;
Vec3d color = randomColor(heatLevel);
Vector3d color = randomColor(heatLevel);
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.03F, 15, false), 0.015 * burstMult, 0.1 * burstMult);
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.FADING) {
if (r.nextDouble() > 0.5)
return;
Vec3d color = randomColor(heatLevel);
Vector3d color = randomColor(heatLevel);
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.035F, 18, false), 0.03 * burstMult, 0.15 * burstMult);
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.KINDLED) {
Vec3d color = randomColor(heatLevel);
Vector3d color = randomColor(heatLevel);
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.04F, 35, true), 0.05 * burstMult, 0.2 * burstMult);
}else if (heatLevel == BlazeBurnerBlock.HeatLevel.SEETHING) {
for (int i = 0; i < 2; i++) {
if (r.nextDouble() > 0.6)
return;
Vec3d color = randomColor(heatLevel);
Vector3d color = randomColor(heatLevel);
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.045F, 35, true), 0.06 * burstMult, 0.22 * burstMult);
}
}
@ -266,9 +266,9 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
0.0D);
}
private static Vec3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) {
private static Vector3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) {
if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE)
return new Vec3d(0,0,0);
return new Vector3d(0,0,0);
return ColorHelper.getRGB(heatParticleColors[heatLevel.ordinal()-1][(int) (Math.random()*4)]);
}
@ -287,7 +287,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
}
event.setCanceled(true);
event.getThrowable().setMotion(Vec3d.ZERO);
event.getThrowable().setMotion(Vector3d.ZERO);
event.getThrowable().remove();
BlazeBurnerTileEntity heater = (BlazeBurnerTileEntity) tile;

View file

@ -50,11 +50,6 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
attachKinetics();
}
@Override
public boolean hasFastRenderer() {
return false;
}
public static float getConveyedSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
boolean targetingController) {
if (!(speedControllerIn instanceof SpeedControllerTileEntity))

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -111,7 +112,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
}
@Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int hFontColor = 0xD3CBBE;
background.draw(this, guiLeft, guiTop);
@ -124,14 +125,14 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
SequencerInstructions def = instruction.instruction;
def.background.draw(guiLeft + 14, guiTop + 29 + yOffset);
label(32, 6 + yOffset, Lang.translate(def.translationKey));
label(matrixStack, 32, 6 + yOffset, Lang.translate(def.translationKey));
if (def.hasValueParameter) {
String text = def.formatValue(instruction.value);
int stringWidth = font.getStringWidth(text);
label(85 + (12 - stringWidth / 2), 6 + yOffset, text);
int stringWidth = textRenderer.getStringWidth(text);
label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text);
}
if (def.hasSpeedParameter)
label(120, 6 + yOffset, instruction.speedModifier.label);
label(matrixStack, 120, 6 + yOffset, instruction.speedModifier.label);
continue;
}
@ -139,7 +140,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
toDraw.draw(guiLeft + 14, guiTop + 29 + yOffset);
}
font.drawStringWithShadow(title, guiLeft - 3 + (background.width - font.getStringWidth(title)) / 2, guiTop + 10,
textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getStringWidth(title)) / 2, guiTop + 10,
hFontColor);
GuiGameElement.of(renderedItem)
@ -148,8 +149,8 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
.render();
}
private void label(int x, int y, String text) {
font.drawStringWithShadow(text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
private void label(MatrixStack matrixStack, int x, int y, String text) {
textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
}
public void sendPacket() {

View file

@ -110,10 +110,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
return AllItems.BELT_CONNECTOR.asStack();
}
/* FIXME
@Override
public Material getMaterial(BlockState state) {
return state.get(CASING) ? Material.WOOD : Material.WOOL;
}
} */
@SuppressWarnings("deprecation")
@Override
@ -142,7 +143,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
@Override
public void onLanded(IBlockReader worldIn, Entity entityIn) {
super.onLanded(worldIn, entityIn);
BlockPos entityPosition = entityIn.getPosition();
BlockPos entityPosition = entityIn.getBlockPos();
BlockPos beltPos = null;
if (AllBlocks.BELT.has(worldIn.getBlockState(entityPosition)))
@ -196,7 +197,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
return;
if (controller.passengers.containsKey(entityIn)) {
TransportedEntityInfo info = controller.passengers.get(entityIn);
if (info.getTicksSinceLastCollision() != 0 || pos.equals(entityIn.getPosition()))
if (info.getTicksSinceLastCollision() != 0 || pos.equals(entityIn.getBlockPos()))
info.refresh(pos, state);
} else {
controller.passengers.put(entityIn, new TransportedEntityInfo(pos, state));

View file

@ -63,8 +63,8 @@ public class BeltGenerator extends SpecialBlockStateGen {
slope = BeltSlope.SIDEWAYS;
String path = "block/" + (casing ? "belt_casing/" : "belt/");
String slopeName = slope.getName();
String partName = part.getName();
String slopeName = slope.getString();
String partName = part.getString();
if (diagonal)
slopeName = "diagonal";

View file

@ -49,7 +49,7 @@ public class BeltModel extends BakedModelWrapper<IBakedModel> {
TextureAtlasSprite original = quad.getSprite();
TextureAtlasSprite target = spriteShift.getTarget();
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
quad.getTintIndex(), quad.getFace(), target, quad.shouldApplyDiffuseLighting());
quad.getTintIndex(), quad.getFace(), target, quad.hasShade());
VertexFormat format = DefaultVertexFormats.BLOCK;
int[] vertexData = newQuad.getVertexData();

View file

@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.settings.GraphicsFanciness;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@ -207,7 +208,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
Random r = new Random(transported.angle);
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
if (Minecraft.getInstance().gameSettings.graphicsMode == GraphicsFanciness.FANCY) {
Vector3d shadowPos = Vector3d.of(te.getPos()).add(beltStartOffset.scale(1)
.add(offsetVec)
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
@ -217,9 +218,9 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
if (renderUpright) {
Entity renderViewEntity = Minecraft.getInstance().renderViewEntity;
if (renderViewEntity != null) {
Vec3d positionVec = renderViewEntity.getPositionVec();
Vec3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset);
Vec3d diff = vectorForOffset.subtract(positionVec);
Vector3d positionVec = renderViewEntity.getPositionVec();
Vector3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset);
Vector3d diff = vectorForOffset.subtract(positionVec);
float yRot = (float) MathHelper.atan2(diff.z, -diff.x);
ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2)));
}

View file

@ -154,11 +154,6 @@ public class BeltTileEntity extends KineticTileEntity {
itemHandler = LazyOptional.of(() -> handler);
}
@Override
public boolean hasFastRenderer() {
return !isController();
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {

View file

@ -8,6 +8,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@ -50,8 +51,7 @@ public class BeltConnectorHandler {
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
if (!world.getBlockState(first)
.has(BlockStateProperties.AXIS))
if (!BlockHelper.hasBlockStateProperty(world.getBlockState(first), BlockStateProperties.AXIS))
continue;
Axis axis = world.getBlockState(first)
.get(BlockStateProperties.AXIS);

View file

@ -6,6 +6,7 @@ import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -43,7 +44,7 @@ public class BeltFunnelInteractionHandler {
return blocking;
if (funnelState.get(BeltFunnelBlock.PUSHING))
return blocking;
if (funnelState.has(BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED))
if (BlockHelper.hasBlockStateProperty(funnelState, BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED))
return blocking;
TileEntity te = world.getTileEntity(funnelPos);

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