mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
Do some porty stuff
This commit is contained in:
parent
4beaab9b97
commit
83c64121eb
@ -31,6 +31,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -371,31 +372,26 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
|
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFastRenderer() {
|
public boolean addToTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking) {
|
|
||||||
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
|
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
|
||||||
|
|
||||||
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
|
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()
|
String hint = Lang.translate("gui.contraptions.network_overstressed", I18n.format(getBlockState().getBlock()
|
||||||
.getTranslationKey()));
|
.getTranslationKey()));
|
||||||
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
||||||
for (int i = 0; i < cutString.size(); i++)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notFastEnough) {
|
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()
|
String hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock()
|
||||||
.getTranslationKey()));
|
.getTranslationKey()));
|
||||||
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
||||||
for (int i = 0; i < cutString.size(); i++)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,23 +399,23 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
|
public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
float stressAtBase = calculateStressApplied();
|
float stressAtBase = calculateStressApplied();
|
||||||
|
|
||||||
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) {
|
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) {
|
||||||
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.goggles.kinetic_stats")));
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact"));
|
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact")));
|
||||||
|
|
||||||
float stressTotal = stressAtBase * Math.abs(getSpeed());
|
float stressTotal = stressAtBase * Math.abs(getSpeed());
|
||||||
|
|
||||||
String stressString =
|
String stressString =
|
||||||
spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
||||||
|
|
||||||
tooltip.add(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
|
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
|
||||||
Lang.translate("gui.goggles.base_value")));
|
Lang.translate("gui.goggles.base_value"))));
|
||||||
tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
|
tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
|
||||||
Lang.translate("gui.goggles.at_current_speed")));
|
Lang.translate("gui.goggles.at_current_speed"))));
|
||||||
|
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||||||
import com.simibubi.create.AllShapes;
|
import com.simibubi.create.AllShapes;
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
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) {
|
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||||
Direction direction = state.get(HORIZONTAL_FACING);
|
Direction direction = state.get(HORIZONTAL_FACING);
|
||||||
BlockPos offset = pos.offset(direction.getOpposite());
|
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
|
@Override
|
||||||
|
@ -6,7 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
|||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.SoundEvents;
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
public class BellMovementBehaviour extends MovementBehaviour {
|
public class BellMovementBehaviour extends MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
@ -15,7 +15,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) {
|
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
|
||||||
double dotProduct = oldMotion.dotProduct(motion);
|
double dotProduct = oldMotion.dotProduct(motion);
|
||||||
|
|
||||||
if (dotProduct <= 0 && (context.relativeMotion.length() != 0 || context.rotation.length() == 0)
|
if (dotProduct <= 0 && (context.relativeMotion.length() != 0 || context.rotation.length() == 0)
|
||||||
|
@ -135,7 +135,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockBroken(BlockState stateToBreak) {
|
public void onBlockBroken(BlockState stateToBreak) {
|
||||||
FluidState ifluidstate = world.getFluidState(breakingPos);
|
FluidState FluidState = world.getFluidState(breakingPos);
|
||||||
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak));
|
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak));
|
||||||
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null;
|
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null;
|
||||||
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
|
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
|
||||||
@ -149,9 +149,9 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||||||
world.addEntity(itementity);
|
world.addEntity(itementity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (world instanceof ServerWorld)
|
||||||
stateToBreak.spawnAdditionalDrops(world, breakingPos, ItemStack.EMPTY);
|
stateToBreak.spawnAdditionalDrops((ServerWorld) world, breakingPos, ItemStack.EMPTY);
|
||||||
world.setBlockState(breakingPos, ifluidstate.getBlockState(), 3);
|
world.setBlockState(breakingPos, FluidState.getBlockState(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getBreakSpeed() {
|
protected float getBreakSpeed() {
|
||||||
|
@ -10,9 +10,4 @@ public class HarvesterTileEntity extends SyncedTileEntity {
|
|||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasFastRenderer() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||||||
|
|
||||||
BlockRayTraceResult ray = world
|
BlockRayTraceResult ray = world
|
||||||
.rayTraceBlocks(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player));
|
.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;
|
return;
|
||||||
|
|
||||||
ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray);
|
ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray);
|
||||||
@ -83,7 +83,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PloughFakePlayer getPlayer(MovementContext context) {
|
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);
|
PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world);
|
||||||
player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
|
player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
|
||||||
context.temporaryData = player;
|
context.temporaryData = player;
|
||||||
|
@ -55,7 +55,7 @@ public class SeatBlock extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLanded(IBlockReader reader, Entity entity) {
|
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)) {
|
if (entity instanceof PlayerEntity || !(entity instanceof LivingEntity) || isSeatOccupied(entity.world, pos)) {
|
||||||
Blocks.PINK_BED.onLanded(reader, entity);
|
Blocks.PINK_BED.onLanded(reader, entity);
|
||||||
return;
|
return;
|
||||||
|
@ -13,7 +13,7 @@ import net.minecraft.network.PacketBuffer;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.World;
|
||||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||||
import net.minecraftforge.fml.network.NetworkHooks;
|
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) {
|
public void setPos(double x, double y, double z) {
|
||||||
super.setPos(x, y, z);
|
super.setPos(x, y, z);
|
||||||
AxisAlignedBB bb = getBoundingBox();
|
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));
|
setBoundingBox(bb.offset(diff));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMotion(Vec3d p_213317_1_) {}
|
public void setMotion(Vector3d p_213317_1_) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
boolean blockPresent = world.getBlockState(getPosition())
|
boolean blockPresent = world.getBlockState(getBlockPos())
|
||||||
.getBlock() instanceof SeatBlock;
|
.getBlock() instanceof SeatBlock;
|
||||||
if (isBeingRidden() && blockPresent)
|
if (isBeingRidden() && blockPresent)
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
|
|||||||
@Override
|
@Override
|
||||||
protected void removePassenger(Entity entity) {
|
protected void removePassenger(Entity entity) {
|
||||||
super.removePassenger(entity);
|
super.removePassenger(entity);
|
||||||
Vec3d pos = entity.getPositionVec();
|
Vector3d pos = entity.getPositionVec();
|
||||||
entity.setPosition(pos.x, pos.y + 0.85f, pos.z);
|
entity.setPosition(pos.x, pos.y + 0.85f, pos.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.state.properties.SlabType;
|
import net.minecraft.state.properties.SlabType;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
public class SeatMovementBehaviour extends MovementBehaviour {
|
public class SeatMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class SeatMovementBehaviour extends MovementBehaviour {
|
|||||||
}
|
}
|
||||||
if (toDismount != null) {
|
if (toDismount != null) {
|
||||||
toDismount.stopRiding();
|
toDismount.stopRiding();
|
||||||
Vec3d position = VecHelper.getCenterOf(pos)
|
Vector3d position = VecHelper.getCenterOf(pos)
|
||||||
.add(0, slab ? .5f : 1f, 0);
|
.add(0, slab ? .5f : 1f, 0);
|
||||||
toDismount.setPositionAndUpdate(position.x, position.y, position.z);
|
toDismount.setPositionAndUpdate(position.x, position.y, position.z);
|
||||||
toDismount.getPersistentData()
|
toDismount.getPersistentData()
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
//import net.minecraft.util.Direction;
|
//import net.minecraft.util.Direction;
|
||||||
//import net.minecraft.util.Direction.Axis;
|
//import net.minecraft.util.Direction.Axis;
|
||||||
//import net.minecraft.util.math.BlockPos;
|
//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.World;
|
||||||
//import net.minecraftforge.items.IItemHandlerModifiable;
|
//import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
//import net.minecraftforge.items.ItemHandlerHelper;
|
//import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
@ -31,8 +31,8 @@
|
|||||||
// private static final String _workingPos_ = "WorkingPos";
|
// private static final String _workingPos_ = "WorkingPos";
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public Vec3d getActiveAreaOffset(MovementContext context) {
|
// public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||||
// return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
|
// return new Vector3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
@ -149,7 +149,7 @@
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private Direction getCurrentFacing(MovementContext context) {
|
// 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);
|
// directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z);
|
||||||
// return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
|
// return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
|
||||||
// }
|
// }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.simibubi.create.content.contraptions.components.actors.dispenser;
|
package com.simibubi.create.content.contraptions.components.actors.dispenser;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.dispenser.IBlockSource;
|
import net.minecraft.dispenser.IBlockSource;
|
||||||
@ -8,7 +9,7 @@ import net.minecraft.state.properties.BlockStateProperties;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ public class ContraptionBlockSource implements IBlockSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState() {
|
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.with(BlockStateProperties.FACING, overrideFacing);
|
||||||
return context.state;
|
return context.state;
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ public class ContraptionBlockSource implements IBlockSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getWorld() {
|
public ServerWorld getWorld() {
|
||||||
return context.world;
|
return context.world;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -60,7 +60,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
|||||||
return;
|
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 = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
|
||||||
facingVec.normalize();
|
facingVec.normalize();
|
||||||
Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z);
|
Direction clostestFacing = Direction.getFacingFromVector(facingVec.x, facingVec.y, facingVec.z);
|
||||||
|
@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,7 +40,7 @@ public class DropperMovementBehaviour extends MovementBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTemporaryData(MovementContext context) {
|
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);
|
NonNullList<ItemStack> stacks = NonNullList.withSize(getInvSize(), ItemStack.EMPTY);
|
||||||
ItemStackHelper.loadAllItems(context.tileData, stacks);
|
ItemStackHelper.loadAllItems(context.tileData, stacks);
|
||||||
context.temporaryData = stacks;
|
context.temporaryData = stacks;
|
||||||
|
@ -7,9 +7,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.IBucketPickupHandler;
|
import net.minecraft.block.IBucketPickupHandler;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.IProjectile;
|
|
||||||
import net.minecraft.entity.SpawnReason;
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.entity.item.FireworkRocketEntity;
|
|
||||||
import net.minecraft.entity.item.TNTEntity;
|
import net.minecraft.entity.item.TNTEntity;
|
||||||
import net.minecraft.entity.projectile.*;
|
import net.minecraft.entity.projectile.*;
|
||||||
import net.minecraft.fluid.FlowingFluid;
|
import net.minecraft.fluid.FlowingFluid;
|
||||||
@ -26,7 +24,7 @@ import net.minecraft.util.SoundCategory;
|
|||||||
import net.minecraft.util.SoundEvents;
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -36,7 +34,7 @@ public interface IMovedDispenseItemBehaviour {
|
|||||||
static void init() {
|
static void init() {
|
||||||
MovedProjectileDispenserBehaviour movedPotionDispenseItemBehaviour = new MovedProjectileDispenserBehaviour() {
|
MovedProjectileDispenserBehaviour movedPotionDispenseItemBehaviour = new MovedProjectileDispenserBehaviour() {
|
||||||
@Override
|
@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));
|
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() {
|
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.TNT, new MovedDefaultDispenseItemBehaviour() {
|
||||||
@Override
|
@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 x = pos.getX() + facing.x * .7 + .5;
|
||||||
double y = pos.getY() + facing.y * .7 + .5;
|
double y = pos.getY() + facing.y * .7 + .5;
|
||||||
double z = pos.getZ() + facing.z * .7 + .5;
|
double z = pos.getZ() + facing.z * .7 + .5;
|
||||||
@ -70,7 +68,7 @@ public interface IMovedDispenseItemBehaviour {
|
|||||||
|
|
||||||
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.FIREWORK_ROCKET, new MovedDefaultDispenseItemBehaviour() {
|
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.FIREWORK_ROCKET, new MovedDefaultDispenseItemBehaviour() {
|
||||||
@Override
|
@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 x = pos.getX() + facing.x * .7 + .5;
|
||||||
double y = pos.getY() + facing.y * .7 + .5;
|
double y = pos.getY() + facing.y * .7 + .5;
|
||||||
double z = pos.getZ() + facing.z * .7 + .5;
|
double z = pos.getZ() + facing.z * .7 + .5;
|
||||||
@ -95,7 +93,7 @@ public interface IMovedDispenseItemBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
Random random = context.world.rand;
|
||||||
double x = pos.getX() + facing.x * .7 + .5;
|
double x = pos.getX() + facing.x * .7 + .5;
|
||||||
double y = pos.getY() + facing.y * .7 + .5;
|
double y = pos.getY() + facing.y * .7 + .5;
|
||||||
@ -110,16 +108,16 @@ public interface IMovedDispenseItemBehaviour {
|
|||||||
|
|
||||||
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.GLASS_BOTTLE, new MovedOptionalDispenseBehaviour() {
|
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.GLASS_BOTTLE, new MovedOptionalDispenseBehaviour() {
|
||||||
@Override
|
@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;
|
this.successful = false;
|
||||||
BlockPos interactAt = pos.offset(getClosestFacingDirection(facing));
|
BlockPos interactAt = pos.offset(getClosestFacingDirection(facing));
|
||||||
BlockState state = context.world.getBlockState(interactAt);
|
BlockState state = context.world.getBlockState(interactAt);
|
||||||
Block block = state.getBlock();
|
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);
|
((BeehiveBlock) block).takeHoney(context.world, state, interactAt, null, BeehiveTileEntity.State.BEE_RELEASED);
|
||||||
this.successful = true;
|
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)) {
|
} else if (context.world.getFluidState(interactAt).isTagged(FluidTags.WATER)) {
|
||||||
this.successful = true;
|
this.successful = true;
|
||||||
return placeItemInInventory(itemStack, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER), context, pos, facing);
|
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() {
|
DispenserMovementBehaviour.registerMovedDispenseItemBehaviour(Items.BUCKET, new MovedDefaultDispenseItemBehaviour() {
|
||||||
@Override
|
@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));
|
BlockPos interactAt = pos.offset(getClosestFacingDirection(facing));
|
||||||
BlockState state = context.world.getBlockState(interactAt);
|
BlockState state = context.world.getBlockState(interactAt);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
@ -146,7 +144,7 @@ public interface IMovedDispenseItemBehaviour {
|
|||||||
|
|
||||||
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
|
final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() {
|
||||||
@Override
|
@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))
|
if (!(itemStack.getItem() instanceof SpawnEggItem))
|
||||||
return super.dispenseStack(itemStack, context, pos, facing);
|
return super.dispenseStack(itemStack, context, pos, facing);
|
||||||
EntityType<?> entityType = ((SpawnEggItem) itemStack.getItem()).getType(itemStack.getTag());
|
EntityType<?> entityType = ((SpawnEggItem) itemStack.getItem()).getType(itemStack.getTag());
|
||||||
|
@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.HopperTileEntity;
|
import net.minecraft.tileentity.HopperTileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
@ -17,7 +17,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
|||||||
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
|
public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBehaviour {
|
||||||
private static final MovedDefaultDispenseItemBehaviour defaultInstance = new MovedDefaultDispenseItemBehaviour();
|
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 d0 = p_82486_4_.getX() + facing.x + .5;
|
||||||
double d1 = p_82486_4_.getY() + facing.y + .5;
|
double d1 = p_82486_4_.getY() + facing.y + .5;
|
||||||
double d2 = p_82486_4_.getZ() + facing.z + .5;
|
double d2 = p_82486_4_.getZ() + facing.z + .5;
|
||||||
@ -35,7 +35,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack dispense(ItemStack itemStack, MovementContext context, BlockPos pos) {
|
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 = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
|
||||||
facingVec.normalize();
|
facingVec.normalize();
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||||||
/**
|
/**
|
||||||
* Dispense the specified stack, play the dispense sound and spawn particles.
|
* 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);
|
ItemStack itemstack = itemStack.split(1);
|
||||||
doDispense(context.world, itemstack, 6, facing, pos, context);
|
doDispense(context.world, itemstack, 6, facing, pos, context);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
@ -71,7 +71,7 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||||||
/**
|
/**
|
||||||
* Order clients to display dispense particles from the specified block and facing.
|
* 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));
|
spawnDispenseParticles(world, pos, getClosestFacingDirection(facing));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +79,11 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||||||
world.playEvent(2000, pos, direction.getIndex());
|
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);
|
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);
|
consumedFrom.shrink(1);
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
|
ItemStack remainder = ItemHandlerHelper.insertItem(context.contraption.inventory, output.copy(), false);
|
||||||
if (!remainder.isEmpty())
|
if (!remainder.isEmpty())
|
||||||
|
@ -4,10 +4,10 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
|||||||
import net.minecraft.dispenser.IPosition;
|
import net.minecraft.dispenser.IPosition;
|
||||||
import net.minecraft.dispenser.ProjectileDispenseBehavior;
|
import net.minecraft.dispenser.ProjectileDispenseBehavior;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.IProjectile;
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||||
@ -18,16 +18,16 @@ import java.lang.reflect.Method;
|
|||||||
public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDispenseItemBehaviour {
|
public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDispenseItemBehaviour {
|
||||||
|
|
||||||
@Override
|
@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 x = pos.getX() + facing.x * .7 + .5;
|
||||||
double y = pos.getY() + facing.y * .7 + .5;
|
double y = pos.getY() + facing.y * .7 + .5;
|
||||||
double z = pos.getZ() + facing.z * .7 + .5;
|
double z = pos.getZ() + facing.z * .7 + .5;
|
||||||
IProjectile iprojectile = this.getProjectileEntity(context.world, x, y, z, itemStack.copy());
|
ProjectileEntity ProjectileEntity = this.getProjectileEntity(context.world, x, y, z, itemStack.copy());
|
||||||
if (iprojectile == null)
|
if (ProjectileEntity == null)
|
||||||
return itemStack;
|
return itemStack;
|
||||||
Vec3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion);
|
Vector3d effectiveMovementVec = facing.scale(getProjectileVelocity()).add(context.motion);
|
||||||
iprojectile.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy());
|
ProjectileEntity.shoot(effectiveMovementVec.x, effectiveMovementVec.y, effectiveMovementVec.z, (float) effectiveMovementVec.length(), this.getProjectileInaccuracy());
|
||||||
context.world.addEntity((Entity) iprojectile);
|
context.world.addEntity(ProjectileEntity);
|
||||||
itemStack.shrink(1);
|
itemStack.shrink(1);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@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() {
|
protected float getProjectileInaccuracy() {
|
||||||
return 6.0F;
|
return 6.0F;
|
||||||
@ -51,9 +51,9 @@ public abstract class MovedProjectileDispenserBehaviour extends MovedDefaultDisp
|
|||||||
public static MovedProjectileDispenserBehaviour of(ProjectileDispenseBehavior vanillaBehaviour) {
|
public static MovedProjectileDispenserBehaviour of(ProjectileDispenseBehavior vanillaBehaviour) {
|
||||||
return new MovedProjectileDispenserBehaviour() {
|
return new MovedProjectileDispenserBehaviour() {
|
||||||
@Override
|
@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 {
|
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) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -83,7 +83,7 @@ public class CuckooClockTileEntity extends KineticTileEntity {
|
|||||||
if (animationType == Animation.SURPRISE && animationProgress.value == 50) {
|
if (animationType == Animation.SURPRISE && animationProgress.value == 50) {
|
||||||
Vector3d center = VecHelper.getCenterOf(pos);
|
Vector3d center = VecHelper.getCenterOf(pos);
|
||||||
world.destroyBlock(pos, false);
|
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);
|
Explosion.Mode.BREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,7 @@
|
|||||||
package com.simibubi.create.content.contraptions.components.crafter;
|
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.AllBlocks;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
@ -29,11 +16,17 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
|||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
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 class ConnectedInputHandler {
|
||||||
|
|
||||||
public static boolean shouldConnect(World world, BlockPos pos, Direction face, Direction direction) {
|
public static boolean shouldConnect(World world, BlockPos pos, Direction face, Direction direction) {
|
||||||
BlockState refState = world.getBlockState(pos);
|
BlockState refState = world.getBlockState(pos);
|
||||||
if (!refState.has(HORIZONTAL_FACING))
|
if (!BlockHelper.hasBlockStateProperty(refState, HORIZONTAL_FACING))
|
||||||
return false;
|
return false;
|
||||||
Direction refDirection = refState.get(HORIZONTAL_FACING);
|
Direction refDirection = refState.get(HORIZONTAL_FACING);
|
||||||
if (direction.getAxis() == refDirection.getAxis())
|
if (direction.getAxis() == refDirection.getAxis())
|
||||||
@ -64,7 +57,7 @@ public class ConnectedInputHandler {
|
|||||||
MechanicalCrafterTileEntity controller = CrafterHelper.getCrafter(world, controllerPos1);
|
MechanicalCrafterTileEntity controller = CrafterHelper.getCrafter(world, controllerPos1);
|
||||||
|
|
||||||
Set<BlockPos> positions = controller.input.data.stream()
|
Set<BlockPos> positions = controller.input.data.stream()
|
||||||
.map(l -> controllerPos1.add(l))
|
.map(controllerPos1::add)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
List<BlockPos> frontier = new LinkedList<>();
|
List<BlockPos> frontier = new LinkedList<>();
|
||||||
List<BlockPos> splitGroup = new ArrayList<>();
|
List<BlockPos> splitGroup = new ArrayList<>();
|
||||||
@ -182,7 +175,7 @@ public class ConnectedInputHandler {
|
|||||||
|
|
||||||
List<IItemHandlerModifiable> list = data.stream()
|
List<IItemHandlerModifiable> list = data.stream()
|
||||||
.map(l -> CrafterHelper.getCrafter(world, pos.add(l)))
|
.map(l -> CrafterHelper.getCrafter(world, pos.add(l)))
|
||||||
.filter(Predicates.notNull())
|
.filter(Objects::nonNull)
|
||||||
.map(crafter -> crafter.inventory)
|
.map(crafter -> crafter.inventory)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return new CombinedInvWrapper(Arrays.copyOf(list.toArray(), list.size(), IItemHandlerModifiable[].class));
|
return new CombinedInvWrapper(Arrays.copyOf(list.toArray(), list.size(), IItemHandlerModifiable[].class));
|
||||||
|
@ -177,10 +177,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||||||
groupedItemsBeforeCraft = before;
|
groupedItemsBeforeCraft = before;
|
||||||
if (phaseBefore == Phase.EXPORTING && phase == Phase.WAITING) {
|
if (phaseBefore == Phase.EXPORTING && phase == Phase.WAITING) {
|
||||||
Direction facing = getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING);
|
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));
|
.add(VecHelper.getCenterOf(pos));
|
||||||
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(getBlockState());
|
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);
|
world.addParticle(ParticleTypes.CRIT, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||||||
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
||||||
try {
|
try {
|
||||||
CrushingWheelTileEntity te = getTileEntity(worldIn, pos);
|
CrushingWheelTileEntity te = getTileEntity(worldIn, pos);
|
||||||
if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.onGround)
|
if (entityIn.getY() < pos.getY() + 1.25f || !entityIn.isOnGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double x = 0;
|
double x = 0;
|
||||||
|
@ -84,7 +84,7 @@ public class CrushingWheelControllerBlock extends Block
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getPosition().down());
|
CrushingWheelControllerTileEntity te = getTileEntity(worldIn, entityIn.getBlockPos().down());
|
||||||
if (te.crushingspeed == 0)
|
if (te.crushingspeed == 0)
|
||||||
return;
|
return;
|
||||||
if (entityIn instanceof ItemEntity)
|
if (entityIn instanceof ItemEntity)
|
||||||
@ -116,11 +116,11 @@ public class CrushingWheelControllerBlock extends Block
|
|||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
||||||
BlockPos currentPos, BlockPos facingPos) {
|
BlockPos currentPos, BlockPos facingPos) {
|
||||||
updateSpeed(stateIn, worldIn.getWorld(), currentPos);
|
updateSpeed(stateIn, worldIn, currentPos);
|
||||||
return stateIn;
|
return stateIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSpeed(BlockState state, World world, BlockPos pos) {
|
public void updateSpeed(BlockState state, IWorld world, BlockPos pos) {
|
||||||
withTileEntityDo(world, pos, te -> {
|
withTileEntityDo(world, pos, te -> {
|
||||||
if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) {
|
if (!state.get(VALID) || CrushingWheelControllerTileEntity.isFrozen()) {
|
||||||
if (te.crushingspeed != 0) {
|
if (te.crushingspeed != 0) {
|
||||||
|
@ -217,7 +217,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||||||
@Override
|
@Override
|
||||||
public void write(CompoundNBT compound, boolean clientPacket) {
|
public void write(CompoundNBT compound, boolean clientPacket) {
|
||||||
if (hasEntity())
|
if (hasEntity())
|
||||||
compound.put("Entity", NBTUtil.writeUniqueId(entityUUID));
|
compound.put("Entity", NBTUtil.fromUuid(entityUUID));
|
||||||
compound.put("Inventory", inventory.serializeNBT());
|
compound.put("Inventory", inventory.serializeNBT());
|
||||||
compound.putFloat("Speed", crushingspeed);
|
compound.putFloat("Speed", crushingspeed);
|
||||||
super.write(compound, clientPacket);
|
super.write(compound, clientPacket);
|
||||||
|
@ -74,7 +74,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector3d getPositionVector() {
|
public Vector3d getPositionVec() {
|
||||||
return new Vector3d(getX(), getY(), getZ());
|
return new Vector3d(getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +94,9 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) {
|
public static void deployerHasEyesOnHisFeet(EntityEvent.Size event) {
|
||||||
if (event.getEntity() instanceof DeployerFakePlayer)
|
if (event.getEntity() instanceof DeployerFakePlayer)
|
||||||
event.setNewHeight(0);
|
event.setNewEyeHeight(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
|
@ -117,13 +117,13 @@ public class AirCurrent {
|
|||||||
} else {
|
} else {
|
||||||
switch (processingType) {
|
switch (processingType) {
|
||||||
case BLASTING:
|
case BLASTING:
|
||||||
if (!entity.isImmuneToFire()) {
|
if (!entity.isFireImmune()) {
|
||||||
entity.setFire(10);
|
entity.setFire(10);
|
||||||
entity.attackEntityFrom(damageSourceLava, 4);
|
entity.attackEntityFrom(damageSourceLava, 4);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SMOKING:
|
case SMOKING:
|
||||||
if (!entity.isImmuneToFire()) {
|
if (!entity.isFireImmune()) {
|
||||||
entity.setFire(2);
|
entity.setFire(2);
|
||||||
entity.attackEntityFrom(damageSourceFire, 2);
|
entity.attackEntityFrom(damageSourceFire, 2);
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public class AirCurrent {
|
|||||||
if (!entity.isBurning())
|
if (!entity.isBurning())
|
||||||
break;
|
break;
|
||||||
entity.extinguish();
|
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,
|
SoundCategory.NEUTRAL, 0.7F,
|
||||||
1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
|
1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
|
||||||
break;
|
break;
|
||||||
@ -168,7 +168,7 @@ public class AirCurrent {
|
|||||||
BlockPos start = source.getPos();
|
BlockPos start = source.getPos();
|
||||||
float max = this.maxDistance;
|
float max = this.maxDistance;
|
||||||
Direction facing = direction;
|
Direction facing = direction;
|
||||||
Vec3d directionVec = new Vec3d(facing.getDirectionVec());
|
Vector3d directionVec = Vector3d.of(facing.getDirectionVec());
|
||||||
maxDistance = getFlowLimit(world, start, max, facing);
|
maxDistance = getFlowLimit(world, start, max, facing);
|
||||||
|
|
||||||
// Determine segments with transported fluids/gases
|
// 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) {
|
public static float getFlowLimit(World world, BlockPos start, float max, Direction facing) {
|
||||||
Vec3d directionVec = new Vec3d(facing.getDirectionVec());
|
Vector3d directionVec = Vector3d.of(facing.getDirectionVec());
|
||||||
Vec3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec);
|
Vector3d planeVec = VecHelper.axisAlingedPlaneOf(directionVec);
|
||||||
|
|
||||||
// 4 Rays test for holes in the shapes blocking the flow
|
// 4 Rays test for holes in the shapes blocking the flow
|
||||||
float offsetDistance = .25f;
|
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),
|
planeVec.mul(offsetDistance, -offsetDistance, -offsetDistance),
|
||||||
planeVec.mul(-offsetDistance, offsetDistance, -offsetDistance), };
|
planeVec.mul(-offsetDistance, offsetDistance, -offsetDistance), };
|
||||||
@ -244,11 +244,11 @@ public class AirCurrent {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Vec3d offset : offsets) {
|
for (Vector3d offset : offsets) {
|
||||||
Vec3d rayStart = VecHelper.getCenterOf(currentPos)
|
Vector3d rayStart = VecHelper.getCenterOf(currentPos)
|
||||||
.subtract(directionVec.scale(.5f + 1 / 32f))
|
.subtract(directionVec.scale(.5f + 1 / 32f))
|
||||||
.add(offset);
|
.add(offset);
|
||||||
Vec3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
|
Vector3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
|
||||||
BlockRayTraceResult blockraytraceresult =
|
BlockRayTraceResult blockraytraceresult =
|
||||||
world.rayTraceBlocks(rayStart, rayEnd, currentPos, voxelshape, state);
|
world.rayTraceBlocks(rayStart, rayEnd, currentPos, voxelshape, state);
|
||||||
if (blockraytraceresult == null)
|
if (blockraytraceresult == null)
|
||||||
|
@ -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.AllConfigs;
|
||||||
import com.simibubi.create.foundation.config.CKinetics;
|
import com.simibubi.create.foundation.config.CKinetics;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
@ -78,11 +79,11 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity {
|
|||||||
.isIn(AllBlockTags.FAN_HEATERS.tag))
|
.isIn(AllBlockTags.FAN_HEATERS.tag))
|
||||||
return false;
|
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))
|
.isAtLeast(BlazeBurnerBlock.HeatLevel.FADING))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (checkState.has(BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT))
|
if (BlockHelper.hasBlockStateProperty(checkState, BlockStateProperties.LIT) && !checkState.get(BlockStateProperties.LIT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -25,7 +25,6 @@ public class FlywheelGenerator extends SpecialBlockStateGen {
|
|||||||
BlockState state) {
|
BlockState state) {
|
||||||
return prov.models()
|
return prov.models()
|
||||||
.getExistingFile(prov.modLoc("block/" + ctx.getName() + "/casing_" + state.get(FlywheelBlock.CONNECTION)
|
.getExistingFile(prov.modLoc("block/" + ctx.getName() + "/casing_" + state.get(FlywheelBlock.CONNECTION)
|
||||||
.getName()));
|
.getString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,6 @@ public class EngineTileEntity extends SmartTileEntity {
|
|||||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasFastRenderer() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return super.getRenderBoundingBox().grow(1.5f);
|
return super.getRenderBoundingBox().grow(1.5f);
|
||||||
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
|||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.AbstractFurnaceBlock;
|
import net.minecraft.block.AbstractFurnaceBlock;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
@ -26,7 +27,7 @@ public class FurnaceEngineTileEntity extends EngineTileEntity {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float modifier = state.getBlock() == Blocks.BLAST_FURNACE ? 2 : 1;
|
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 speed = active ? 16 * modifier : 0;
|
||||||
float capacity =
|
float capacity =
|
||||||
(float) (active ? AllConfigs.SERVER.kinetics.stressValues.getCapacityOf(AllBlocks.FURNACE_ENGINE.get())
|
(float) (active ? AllConfigs.SERVER.kinetics.stressValues.getCapacityOf(AllBlocks.FURNACE_ENGINE.get())
|
||||||
|
@ -95,7 +95,7 @@ public class MillstoneBlock extends KineticBlock implements ITE<MillstoneTileEnt
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
MillstoneTileEntity millstone = null;
|
MillstoneTileEntity millstone = null;
|
||||||
for (BlockPos pos : Iterate.hereAndBelow(entityIn.getPosition())) {
|
for (BlockPos pos : Iterate.hereAndBelow(entityIn.getBlockPos())) {
|
||||||
try {
|
try {
|
||||||
millstone = getTileEntity(worldIn, pos);
|
millstone = getTileEntity(worldIn, pos);
|
||||||
} catch (TileEntityException e) {
|
} catch (TileEntityException e) {
|
||||||
|
@ -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;
|
||||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||||
import com.simibubi.create.foundation.item.SmartInventory;
|
import com.simibubi.create.foundation.item.SmartInventory;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
@ -246,7 +247,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||||||
if (world == null)
|
if (world == null)
|
||||||
return HeatLevel.NONE;
|
return HeatLevel.NONE;
|
||||||
BlockState state = world.getBlockState(pos.down(3));
|
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 state.get(BlazeBurnerBlock.HEAT_LEVEL);
|
||||||
return AllTags.AllBlockTags.FAN_HEATERS.matches(state) ? HeatLevel.SMOULDERING : HeatLevel.NONE;
|
return AllTags.AllBlockTags.FAN_HEATERS.matches(state) ? HeatLevel.SMOULDERING : HeatLevel.NONE;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements ITE<SawTile
|
|||||||
if (entityIn.world.isRemote)
|
if (entityIn.world.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockPos pos = entityIn.getPosition();
|
BlockPos pos = entityIn.getBlockPos();
|
||||||
withTileEntityDo(entityIn.world, pos, te -> {
|
withTileEntityDo(entityIn.world, pos, te -> {
|
||||||
if (te.getSpeed() == 0)
|
if (te.getSpeed() == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -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.contraptions.components.structureMovement.pulley.PulleyTileEntity;
|
||||||
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock;
|
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.AbstractPressurePlateBlock;
|
||||||
import net.minecraft.block.AbstractRailBlock;
|
import net.minecraft.block.AbstractRailBlock;
|
||||||
import net.minecraft.block.BellBlock;
|
import net.minecraft.block.BellBlock;
|
||||||
@ -101,7 +102,7 @@ public class BlockMovementTraits {
|
|||||||
*/
|
*/
|
||||||
public static boolean isBrittle(BlockState state) {
|
public static boolean isBrittle(BlockState state) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (state.has(BlockStateProperties.HANGING))
|
if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HANGING))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (block instanceof LadderBlock)
|
if (block instanceof LadderBlock)
|
||||||
@ -161,7 +162,7 @@ public class BlockMovementTraits {
|
|||||||
if (attachFace == AttachFace.WALL)
|
if (attachFace == AttachFace.WALL)
|
||||||
return direction.getOpposite() == state.get(HorizontalFaceBlock.HORIZONTAL_FACING);
|
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);
|
return direction == (state.get(BlockStateProperties.HANGING) ? Direction.UP : Direction.DOWN);
|
||||||
if (block instanceof AbstractRailBlock)
|
if (block instanceof AbstractRailBlock)
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
|
@ -17,6 +17,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import org.apache.commons.lang3.tuple.MutablePair;
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
@ -472,7 +473,7 @@ public abstract class Contraption {
|
|||||||
tag.putInt("y", info.pos.getY());
|
tag.putInt("y", info.pos.getY());
|
||||||
tag.putInt("z", info.pos.getZ());
|
tag.putInt("z", info.pos.getZ());
|
||||||
|
|
||||||
TileEntity te = TileEntity.create(tag);
|
TileEntity te = TileEntity.createFromTag(info.state, tag);
|
||||||
if (te == null)
|
if (te == null)
|
||||||
return;
|
return;
|
||||||
te.setLocation(new WrappedWorld(world) {
|
te.setLocation(new WrappedWorld(world) {
|
||||||
@ -575,7 +576,7 @@ public abstract class Contraption {
|
|||||||
nbt.put("Seats", NBTHelper.writeCompoundList(getSeats(), NBTUtil::writeBlockPos));
|
nbt.put("Seats", NBTHelper.writeCompoundList(getSeats(), NBTUtil::writeBlockPos));
|
||||||
nbt.put("Passengers", NBTHelper.writeCompoundList(getSeatMapping().entrySet(), e -> {
|
nbt.put("Passengers", NBTHelper.writeCompoundList(getSeatMapping().entrySet(), e -> {
|
||||||
CompoundNBT tag = new CompoundNBT();
|
CompoundNBT tag = new CompoundNBT();
|
||||||
tag.put("Id", NBTUtil.writeUniqueId(e.getKey()));
|
tag.put("Id", NBTUtil.fromUuid(e.getKey()));
|
||||||
tag.putInt("Seat", e.getValue());
|
tag.putInt("Seat", e.getValue());
|
||||||
return tag;
|
return tag;
|
||||||
}));
|
}));
|
||||||
@ -603,7 +604,7 @@ public abstract class Contraption {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeBlocksFromWorld(IWorld world, BlockPos offset) {
|
public void removeBlocksFromWorld(World world, BlockPos offset) {
|
||||||
storage.values()
|
storage.values()
|
||||||
.forEach(MountedStorage::removeStorageFromWorld);
|
.forEach(MountedStorage::removeStorageFromWorld);
|
||||||
glueToRemove.forEach(SuperGlueEntity::remove);
|
glueToRemove.forEach(SuperGlueEntity::remove);
|
||||||
@ -623,14 +624,12 @@ public abstract class Contraption {
|
|||||||
Block blockIn = oldState.getBlock();
|
Block blockIn = oldState.getBlock();
|
||||||
if (block.state.getBlock() != blockIn)
|
if (block.state.getBlock() != blockIn)
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
world.getWorld()
|
world.removeTileEntity(add);
|
||||||
.removeTileEntity(add);
|
|
||||||
int flags = 67;
|
int flags = 67;
|
||||||
if (blockIn instanceof DoorBlock)
|
if (blockIn instanceof DoorBlock)
|
||||||
flags = flags | 32 | 16;
|
flags = flags | 32 | 16;
|
||||||
if (blockIn instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED)
|
if (blockIn instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(oldState, BlockStateProperties.WATERLOGGED)
|
||||||
&& oldState.get(BlockStateProperties.WATERLOGGED)
|
&& oldState.get(BlockStateProperties.WATERLOGGED)) {
|
||||||
.booleanValue()) {
|
|
||||||
world.setBlockState(add, Blocks.WATER.getDefaultState(), flags);
|
world.setBlockState(add, Blocks.WATER.getDefaultState(), flags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -671,10 +670,10 @@ public abstract class Contraption {
|
|||||||
Block.spawnDrops(state, world, targetPos, null);
|
Block.spawnDrops(state, world, targetPos, null);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (state.getBlock() instanceof IWaterLoggable && state.has(BlockStateProperties.WATERLOGGED)) {
|
if (state.getBlock() instanceof IWaterLoggable && BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED)) {
|
||||||
IFluidState ifluidstate = world.getFluidState(targetPos);
|
FluidState FluidState = world.getFluidState(targetPos);
|
||||||
state = state.with(BlockStateProperties.WATERLOGGED,
|
state = state.with(BlockStateProperties.WATERLOGGED,
|
||||||
Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
FluidState.getFluid() == Fluids.WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
world.destroyBlock(targetPos, true);
|
world.destroyBlock(targetPos, true);
|
||||||
@ -699,7 +698,7 @@ public abstract class Contraption {
|
|||||||
tag.remove("InitialOffset");
|
tag.remove("InitialOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity.read(tag);
|
tileEntity.fromTag(tileEntity.getBlockState(), tag);
|
||||||
|
|
||||||
if (storage.containsKey(block.pos)) {
|
if (storage.containsKey(block.pos)) {
|
||||||
MountedStorage mountedStorage = storage.get(block.pos);
|
MountedStorage mountedStorage = storage.get(block.pos);
|
||||||
|
@ -210,7 +210,7 @@ public class ContraptionCollider {
|
|||||||
Vector3d contactPointMotion = Vector3d.ZERO;
|
Vector3d contactPointMotion = Vector3d.ZERO;
|
||||||
if (surfaceCollision.isTrue()) {
|
if (surfaceCollision.isTrue()) {
|
||||||
entity.fallDistance = 0;
|
entity.fallDistance = 0;
|
||||||
entity.onGround = true;
|
entity.setOnGround(true);
|
||||||
contraptionEntity.collidingEntities.add(entity);
|
contraptionEntity.collidingEntities.add(entity);
|
||||||
if (!serverPlayer)
|
if (!serverPlayer)
|
||||||
contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition);
|
contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition);
|
||||||
@ -273,7 +273,7 @@ public class ContraptionCollider {
|
|||||||
boolean flag = movement.x != Vector3d.x;
|
boolean flag = movement.x != Vector3d.x;
|
||||||
boolean flag1 = movement.y != Vector3d.y;
|
boolean flag1 = movement.y != Vector3d.y;
|
||||||
boolean flag2 = movement.z != Vector3d.z;
|
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)) {
|
if (e.stepHeight > 0.0F && flag3 && (flag || flag2)) {
|
||||||
Vector3d Vector3d1 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, (double) e.stepHeight, movement.z),
|
Vector3d Vector3d1 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, (double) e.stepHeight, movement.z),
|
||||||
bb, world, ctx, reuseablestream);
|
bb, world, ctx, reuseablestream);
|
||||||
|
@ -11,6 +11,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import org.apache.commons.lang3.tuple.MutablePair;
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
|
|
||||||
import com.simibubi.create.AllEntityTypes;
|
import com.simibubi.create.AllEntityTypes;
|
||||||
@ -32,7 +33,7 @@ import net.minecraft.block.material.PushReaction;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
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.BoatEntity;
|
||||||
import net.minecraft.entity.item.HangingEntity;
|
import net.minecraft.entity.item.HangingEntity;
|
||||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||||
@ -344,7 +345,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||||||
if (coupling != null && coupling.areBothEndsPresent()) {
|
if (coupling != null && coupling.areBothEndsPresent()) {
|
||||||
boolean notOnMainCart = !coupling.getId()
|
boolean notOnMainCart = !coupling.getId()
|
||||||
.equals(riding.getUniqueID());
|
.equals(riding.getUniqueID());
|
||||||
Vec3d positionVec = coupling.asCouple()
|
Vector3d positionVec = coupling.asCouple()
|
||||||
.get(notOnMainCart)
|
.get(notOnMainCart)
|
||||||
.getPositionVec();
|
.getPositionVec();
|
||||||
prevYaw = yaw;
|
prevYaw = yaw;
|
||||||
@ -365,11 +366,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||||||
pauseWhileRotating = mountedContraption.rotationMode == CartMovementMode.ROTATE_PAUSED;
|
pauseWhileRotating = mountedContraption.rotationMode == CartMovementMode.ROTATE_PAUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d movementVector = riding.getMotion();
|
Vector3d movementVector = riding.getMotion();
|
||||||
if (!isOnCoupling) {
|
if (!isOnCoupling) {
|
||||||
if (riding instanceof BoatEntity)
|
if (riding instanceof BoatEntity)
|
||||||
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
|
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
|
||||||
Vec3d motion = movementVector.normalize();
|
Vector3d motion = movementVector.normalize();
|
||||||
|
|
||||||
if (!rotationLock) {
|
if (!rotationLock) {
|
||||||
if (motion.length() > 0) {
|
if (motion.length() > 0) {
|
||||||
@ -469,7 +470,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||||||
|
|
||||||
boolean newPosVisited = false;
|
boolean newPosVisited = false;
|
||||||
BlockPos gridPosition = new BlockPos(actorPosition);
|
BlockPos gridPosition = new BlockPos(actorPosition);
|
||||||
Vec3d oldMotion = context.motion;
|
Vector3d oldMotion = context.motion;
|
||||||
|
|
||||||
if (!context.stall) {
|
if (!context.stall) {
|
||||||
Vector3d previousPosition = context.position;
|
Vector3d previousPosition = context.position;
|
||||||
@ -486,7 +487,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||||||
BearingContraption bc = (BearingContraption) getContraption();
|
BearingContraption bc = (BearingContraption) getContraption();
|
||||||
Direction facing = bc.getFacing();
|
Direction facing = bc.getFacing();
|
||||||
Vector3d activeAreaOffset = actor.getActiveAreaOffset(context);
|
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)) {
|
.equals(Vector3d.ZERO)) {
|
||||||
if (VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) {
|
if (VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) {
|
||||||
context.motion = Vector3d.of(facing.getDirectionVec()).scale(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);
|
compound.putBoolean("Initialized", initialized);
|
||||||
|
|
||||||
if (getCouplingId() != null) {
|
if (getCouplingId() != null) {
|
||||||
compound.put("OnCoupling", NBTUtil.writeUniqueId(getCouplingId()));
|
compound.put("OnCoupling", NBTUtil.fromUuid(getCouplingId()));
|
||||||
compound.put("CoupledCart", NBTUtil.writeUniqueId(getCoupledCart()));
|
compound.put("CoupledCart", NBTUtil.fromUuid(getCoupledCart()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,7 +877,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||||||
return false;
|
return false;
|
||||||
if (e instanceof SeatEntity)
|
if (e instanceof SeatEntity)
|
||||||
return false;
|
return false;
|
||||||
if (e instanceof IProjectile)
|
if (e instanceof ProjectileEntity)
|
||||||
return false;
|
return false;
|
||||||
if (e.getRidingEntity() != null)
|
if (e.getRidingEntity() != null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
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.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.Constants.NBT;
|
import net.minecraftforge.common.util.Constants.NBT;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class ContraptionHandler {
|
|||||||
CompoundNBT data = entityLiving.getPersistentData();
|
CompoundNBT data = entityLiving.getPersistentData();
|
||||||
if (!data.contains("ContraptionDismountLocation"))
|
if (!data.contains("ContraptionDismountLocation"))
|
||||||
return;
|
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)
|
if (entityLiving.getRidingEntity() == null)
|
||||||
entityLiving.setPositionAndUpdate(position.x, position.y, position.z);
|
entityLiving.setPositionAndUpdate(position.x, position.y, position.z);
|
||||||
data.remove("ContraptionDismountLocation");
|
data.remove("ContraptionDismountLocation");
|
||||||
|
@ -14,7 +14,7 @@ import net.minecraft.util.Hand;
|
|||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
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.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@ -37,18 +37,18 @@ public class ContraptionInteractionHandler {
|
|||||||
return;
|
return;
|
||||||
if (!event.isUseItem())
|
if (!event.isUseItem())
|
||||||
return;
|
return;
|
||||||
Vec3d origin = RaycastHelper.getTraceOrigin(player);
|
Vector3d origin = RaycastHelper.getTraceOrigin(player);
|
||||||
|
|
||||||
double reach = mc.playerController.getBlockReachDistance();
|
double reach = mc.playerController.getBlockReachDistance();
|
||||||
if (mc.objectMouseOver != null && mc.objectMouseOver.getHitVec() != null)
|
if (mc.objectMouseOver != null && mc.objectMouseOver.getHitVec() != null)
|
||||||
reach = Math.min(mc.objectMouseOver.getHitVec().distanceTo(origin), reach);
|
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,
|
for (ContraptionEntity contraptionEntity : mc.world.getEntitiesWithinAABB(ContraptionEntity.class,
|
||||||
new AxisAlignedBB(origin, target))) {
|
new AxisAlignedBB(origin, target))) {
|
||||||
|
|
||||||
Vec3d localOrigin = contraptionEntity.toLocalVector(origin);
|
Vector3d localOrigin = contraptionEntity.toLocalVector(origin);
|
||||||
Vec3d localTarget = contraptionEntity.toLocalVector(target);
|
Vector3d localTarget = contraptionEntity.toLocalVector(target);
|
||||||
Contraption contraption = contraptionEntity.getContraption();
|
Contraption contraption = contraptionEntity.getContraption();
|
||||||
|
|
||||||
MutableObject<BlockRayTraceResult> mutableResult = new MutableObject<>();
|
MutableObject<BlockRayTraceResult> mutableResult = new MutableObject<>();
|
||||||
|
@ -55,7 +55,7 @@ public abstract class MovementBehaviour {
|
|||||||
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
IRenderTypeBuffer buffer) {}
|
IRenderTypeBuffer buffer) {}
|
||||||
|
|
||||||
public void onSpeedChanged(MovementContext context, Vec3d oldMotion, Vec3d motion) {
|
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.util.Constants.NBT;
|
import net.minecraftforge.common.util.Constants.NBT;
|
||||||
|
|
||||||
public class MovementContext {
|
public class MovementContext {
|
||||||
|
@ -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.components.structureMovement.chassis.AbstractChassisBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
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.DirectionHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
@ -69,10 +70,10 @@ public class StructureTransform {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3d apply(Vec3d localVec) {
|
public Vector3d apply(Vector3d localVec) {
|
||||||
Vec3d vec = localVec;
|
Vector3d vec = localVec;
|
||||||
vec = VecHelper.rotateCentered(vec, angle, rotationAxis);
|
vec = VecHelper.rotateCentered(vec, angle, rotationAxis);
|
||||||
vec = vec.add(new Vec3d(offset));
|
vec = vec.add(Vector3d.of(offset));
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,33 +147,33 @@ public class StructureTransform {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.has(FACING)) {
|
if (BlockHelper.hasBlockStateProperty(state, FACING)) {
|
||||||
Direction newFacing = transformFacing(state.get(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)
|
if (rotationAxis == newFacing.getAxis() && rotation.ordinal() % 2 == 1)
|
||||||
state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE);
|
state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||||
}
|
}
|
||||||
state = state.with(FACING, newFacing);
|
state = state.with(FACING, newFacing);
|
||||||
|
|
||||||
} else if (state.has(AXIS)) {
|
} else if (BlockHelper.hasBlockStateProperty(state, AXIS)) {
|
||||||
state = state.with(AXIS, transformAxis(state.get(AXIS)));
|
state = state.with(AXIS, transformAxis(state.get(AXIS)));
|
||||||
|
|
||||||
} else if (halfTurn) {
|
} else if (halfTurn) {
|
||||||
|
|
||||||
if (state.has(FACING)) {
|
if (BlockHelper.hasBlockStateProperty(state, FACING)) {
|
||||||
Direction stateFacing = state.get(FACING);
|
Direction stateFacing = state.get(FACING);
|
||||||
if (stateFacing.getAxis() == rotationAxis)
|
if (stateFacing.getAxis() == rotationAxis)
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.has(HORIZONTAL_FACING)) {
|
if (BlockHelper.hasBlockStateProperty(state, HORIZONTAL_FACING)) {
|
||||||
Direction stateFacing = state.get(HORIZONTAL_FACING);
|
Direction stateFacing = state.get(HORIZONTAL_FACING);
|
||||||
if (stateFacing.getAxis() == rotationAxis)
|
if (stateFacing.getAxis() == rotationAxis)
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = state.rotate(rotation);
|
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 = state.with(SlabBlock.TYPE,
|
||||||
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
|
state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM);
|
||||||
}
|
}
|
||||||
|
@ -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.ValueBoxTransform;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
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.Lang;
|
||||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||||
|
|
||||||
@ -269,7 +270,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||||||
BlockState blockState = getBlockState();
|
BlockState blockState = getBlockState();
|
||||||
if (!(contraption.getContraption() instanceof BearingContraption))
|
if (!(contraption.getContraption() instanceof BearingContraption))
|
||||||
return;
|
return;
|
||||||
if (!blockState.has(FACING))
|
if (!BlockHelper.hasBlockStateProperty(blockState, FACING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.movedContraption = contraption;
|
this.movedContraption = contraption;
|
||||||
|
@ -43,7 +43,7 @@ public class ChassisRangeDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Object getOutlineKey() {
|
protected Object getOutlineKey() {
|
||||||
return Pair.of(te.getPos(), new Integer(1));
|
return Pair.of(te.getPos(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<BlockPos> createSelection(ChassisTileEntity chassis) {
|
protected Set<BlockPos> createSelection(ChassisTileEntity chassis) {
|
||||||
|
@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gl
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import com.simibubi.create.AllEntityTypes;
|
import com.simibubi.create.AllEntityTypes;
|
||||||
@ -247,11 +248,11 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processInitialInteract(PlayerEntity player, Hand hand) {
|
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
triggerPlaceBlock(player, hand);
|
triggerPlaceBlock(player, hand);
|
||||||
});
|
});
|
||||||
return true;
|
return ActionResultType.CONSUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@ -367,7 +368,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStruckByLightning(LightningBoltEntity lightningBolt) {}
|
public void onStruckByLightning(ServerWorld world, LightningBoltEntity lightningBolt) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recalculateSize() {}
|
public void recalculateSize() {}
|
||||||
|
@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.RayTraceWorld;
|
|||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
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.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeMod;
|
||||||
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||||
@ -63,11 +65,11 @@ public class SuperGlueHandler {
|
|||||||
|
|
||||||
public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, PlayerEntity placer) {
|
public static void glueInOffHandAppliesOnBlockPlace(EntityPlaceEvent event, BlockPos pos, PlayerEntity placer) {
|
||||||
ItemStack itemstack = placer.getHeldItemOffhand();
|
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;
|
return;
|
||||||
|
|
||||||
double distance = placer.getAttribute(PlayerEntity.REACH_DISTANCE)
|
double distance = reachAttribute.getValue();
|
||||||
.getValue();
|
|
||||||
Vector3d start = placer.getEyePosition(1);
|
Vector3d start = placer.getEyePosition(1);
|
||||||
Vector3d look = placer.getLook(1);
|
Vector3d look = placer.getLook(1);
|
||||||
Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
||||||
|
@ -219,7 +219,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||||||
if (couplingFound) {
|
if (couplingFound) {
|
||||||
MinecartCouplingHandler.connectCarts(null, world, cart.getEntityId(),
|
MinecartCouplingHandler.connectCarts(null, world, cart.getEntityId(),
|
||||||
contraption.connectedCart.getEntityId());
|
contraption.connectedCart.getEntityId());
|
||||||
Vec3d diff = contraption.connectedCart.getPositionVec()
|
Vector3d diff = contraption.connectedCart.getPositionVec()
|
||||||
.subtract(cart.getPositionVec());
|
.subtract(cart.getPositionVec());
|
||||||
initialAngle = Direction.fromAngle(MathHelper.atan2(diff.z, diff.x) * 180 / Math.PI)
|
initialAngle = Direction.fromAngle(MathHelper.atan2(diff.z, diff.x) * 180 / Math.PI)
|
||||||
.getHorizontalAngle();
|
.getHorizontalAngle();
|
||||||
@ -304,10 +304,12 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||||||
return PushReaction.BLOCK;
|
return PushReaction.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Is there a 1.16 equivalent to be used? Or is this just removed?
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube(@Nonnull BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos) {
|
public boolean isNormalCube(@Nonnull BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<CartAssemblerTileEntity> getTileEntityClass() {
|
public Class<CartAssemblerTileEntity> getTileEntityClass() {
|
||||||
@ -338,10 +340,10 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@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_) {
|
@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)
|
return super.getDrops(state, (new LootContext.Builder(world)).withRandom(world.rand)
|
||||||
.withParameter(LootParameters.POSITION, p_220077_2_)
|
.withParameter(LootParameters.ORIGIN, Vector3d.of(pos))
|
||||||
.withParameter(LootParameters.TOOL, p_220077_5_)
|
.withParameter(LootParameters.TOOL, p_220077_5_)
|
||||||
.withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_)
|
.withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_)
|
||||||
.withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_));
|
.withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_));
|
||||||
@ -360,7 +362,8 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||||||
.forEach(itemStack -> {
|
.forEach(itemStack -> {
|
||||||
player.inventory.placeItemBackInInventory(world, 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));
|
world.setBlockState(pos, getRailBlock(state));
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import static com.simibubi.create.content.contraptions.components.structureMovem
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
@ -51,7 +52,7 @@ public class MountedContraption extends Contraption {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (!state.has(RAIL_SHAPE))
|
if (!BlockHelper.hasBlockStateProperty(state, RAIL_SHAPE))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
MountedContraption contraption = new MountedContraption();
|
MountedContraption contraption = new MountedContraption();
|
||||||
|
@ -15,7 +15,7 @@ import net.minecraftforge.client.model.generators.ModelFile;
|
|||||||
|
|
||||||
public class MechanicalPistonGenerator extends SpecialBlockStateGen {
|
public class MechanicalPistonGenerator extends SpecialBlockStateGen {
|
||||||
|
|
||||||
private PistonType type;
|
private final PistonType type;
|
||||||
|
|
||||||
public MechanicalPistonGenerator(PistonType type) {
|
public MechanicalPistonGenerator(PistonType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -43,7 +43,7 @@ public class MechanicalPistonGenerator extends SpecialBlockStateGen {
|
|||||||
PistonState pistonState = state.get(MechanicalPistonBlock.STATE);
|
PistonState pistonState = state.get(MechanicalPistonBlock.STATE);
|
||||||
|
|
||||||
String path = "block/mechanical_piston";
|
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";
|
String partial = facing.getAxis() == Axis.X ^ axisAlongFirst ? "block_rotated" : "block";
|
||||||
|
|
||||||
return prov.models()
|
return prov.models()
|
||||||
|
@ -107,7 +107,7 @@ public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
FluidState FluidState = context.getWorld().getFluidState(context.getPos());
|
||||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,9 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
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())
|
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
|
@Override
|
||||||
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllShapes;
|
|||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.IWaterLoggable;
|
import net.minecraft.block.IWaterLoggable;
|
||||||
@ -110,7 +111,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
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());
|
onRopeBroken(worldIn, pos.up());
|
||||||
if (!worldIn.isRemote) {
|
if (!worldIn.isRemote) {
|
||||||
BlockState above = worldIn.getBlockState(pos.up());
|
BlockState above = worldIn.getBlockState(pos.up());
|
||||||
@ -149,8 +150,8 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
FluidState FluidState = context.getWorld().getFluidState(context.getPos());
|
||||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.CenteredSideValueBoxTransform;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
|
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.IWaterLoggable;
|
import net.minecraft.block.IWaterLoggable;
|
||||||
@ -71,7 +72,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||||||
for (int i = ((int) offset); i > 0; i--) {
|
for (int i = ((int) offset); i > 0; i--) {
|
||||||
BlockPos offset = pos.down(i);
|
BlockPos offset = pos.down(i);
|
||||||
BlockState oldState = world.getBlockState(offset);
|
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);
|
world.setBlockState(offset, Blocks.WATER.getDefaultState(), 66);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -105,19 +106,19 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||||||
if (!removed) {
|
if (!removed) {
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
BlockPos magnetPos = pos.down((int) offset);
|
BlockPos magnetPos = pos.down((int) offset);
|
||||||
FluidState ifluidstate = world.getFluidState(magnetPos);
|
FluidState FluidState = world.getFluidState(magnetPos);
|
||||||
world.destroyBlock(magnetPos, world.getBlockState(magnetPos)
|
world.destroyBlock(magnetPos, world.getBlockState(magnetPos)
|
||||||
.getCollisionShape(world, magnetPos)
|
.getCollisionShape(world, magnetPos)
|
||||||
.isEmpty());
|
.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];
|
boolean[] waterlog = new boolean[(int) offset];
|
||||||
|
|
||||||
for (int i = 1; i <= ((int) offset) - 1; i++) {
|
for (int i = 1; i <= ((int) offset) - 1; i++) {
|
||||||
BlockPos ropePos = pos.down(i);
|
BlockPos ropePos = pos.down(i);
|
||||||
FluidState ifluidstate = world.getFluidState(ropePos);
|
FluidState FluidState = world.getFluidState(ropePos);
|
||||||
waterlog[i] = ifluidstate.getFluid() == Fluids.WATER;
|
waterlog[i] = FluidState.getFluid() == Fluids.WATER;
|
||||||
world.destroyBlock(ropePos, world.getBlockState(ropePos)
|
world.destroyBlock(ropePos, world.getBlockState(ropePos)
|
||||||
.getCollisionShape(world, ropePos)
|
.getCollisionShape(world, ropePos)
|
||||||
.isEmpty());
|
.isEmpty());
|
||||||
|
@ -6,21 +6,21 @@ import com.simibubi.create.foundation.networking.SimplePacketBase;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.network.PacketBuffer;
|
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;
|
import net.minecraftforge.fml.network.NetworkEvent.Context;
|
||||||
|
|
||||||
public class ClientMotionPacket extends SimplePacketBase {
|
public class ClientMotionPacket extends SimplePacketBase {
|
||||||
|
|
||||||
private Vec3d motion;
|
private Vector3d motion;
|
||||||
private boolean onGround;
|
private boolean onGround;
|
||||||
|
|
||||||
public ClientMotionPacket(Vec3d motion, boolean onGround) {
|
public ClientMotionPacket(Vector3d motion, boolean onGround) {
|
||||||
this.motion = motion;
|
this.motion = motion;
|
||||||
this.onGround = onGround;
|
this.onGround = onGround;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientMotionPacket(PacketBuffer buffer) {
|
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();
|
onGround = buffer.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class ClientMotionPacket extends SimplePacketBase {
|
|||||||
if (sender == null)
|
if (sender == null)
|
||||||
return;
|
return;
|
||||||
sender.setMotion(motion);
|
sender.setMotion(motion);
|
||||||
sender.onGround = onGround;
|
sender.setOnGround(onGround);
|
||||||
if (onGround) {
|
if (onGround) {
|
||||||
sender.handleFallDamage(sender.fallDistance, 1);
|
sender.handleFallDamage(sender.fallDistance, 1);
|
||||||
sender.fallDistance = 0;
|
sender.fallDistance = 0;
|
||||||
|
@ -16,7 +16,7 @@ import net.minecraft.particles.IParticleData;
|
|||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.particles.RedstoneParticleData;
|
import net.minecraft.particles.RedstoneParticleData;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
public class ClientMinecartCouplingHandler {
|
public class ClientMinecartCouplingHandler {
|
||||||
|
|
||||||
@ -54,11 +54,11 @@ public class ClientMinecartCouplingHandler {
|
|||||||
|
|
||||||
private static void spawnSelectionParticles(AxisAlignedBB axisAlignedBB, boolean highlight) {
|
private static void spawnSelectionParticles(AxisAlignedBB axisAlignedBB, boolean highlight) {
|
||||||
ClientWorld world = Minecraft.getInstance().world;
|
ClientWorld world = Minecraft.getInstance().world;
|
||||||
Vec3d center = axisAlignedBB.getCenter();
|
Vector3d center = axisAlignedBB.getCenter();
|
||||||
int amount = highlight ? 100 : 2;
|
int amount = highlight ? 100 : 2;
|
||||||
IParticleData particleData = highlight ? ParticleTypes.END_ROD : new RedstoneParticleData(1, 1, 1, 1);
|
IParticleData particleData = highlight ? ParticleTypes.END_ROD : new RedstoneParticleData(1, 1, 1, 1);
|
||||||
for (int i = 0; i < amount; i++) {
|
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;
|
double yOffset = v.y;
|
||||||
v = v.mul(1, 0, 1)
|
v = v.mul(1, 0, 1)
|
||||||
.normalize()
|
.normalize()
|
||||||
|
@ -15,14 +15,14 @@ import net.minecraft.block.Blocks;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.Vector3f;
|
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
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 {
|
public class MinecartCouplingRenderer {
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class MinecartCouplingRenderer {
|
|||||||
carts.map(c -> WorldRenderer.getLightmapCoordinates(world, new BlockPos(c.getBoundingBox()
|
carts.map(c -> WorldRenderer.getLightmapCoordinates(world, new BlockPos(c.getBoundingBox()
|
||||||
.getCenter())));
|
.getCenter())));
|
||||||
|
|
||||||
Vec3d center = carts.getFirst()
|
Vector3d center = carts.getFirst()
|
||||||
.getPositionVec()
|
.getPositionVec()
|
||||||
.add(carts.getSecond()
|
.add(carts.getSecond()
|
||||||
.getPositionVec())
|
.getPositionVec())
|
||||||
@ -49,12 +49,12 @@ public class MinecartCouplingRenderer {
|
|||||||
SuperByteBuffer ring = AllBlockPartials.COUPLING_RING.renderOn(renderState);
|
SuperByteBuffer ring = AllBlockPartials.COUPLING_RING.renderOn(renderState);
|
||||||
SuperByteBuffer connector = AllBlockPartials.COUPLING_CONNECTOR.renderOn(renderState);
|
SuperByteBuffer connector = AllBlockPartials.COUPLING_CONNECTOR.renderOn(renderState);
|
||||||
|
|
||||||
Vec3d zero = Vec3d.ZERO;
|
Vector3d zero = Vector3d.ZERO;
|
||||||
Vec3d firstEndpoint = transforms.getFirst()
|
Vector3d firstEndpoint = transforms.getFirst()
|
||||||
.apply(zero);
|
.apply(zero);
|
||||||
Vec3d secondEndpoint = transforms.getSecond()
|
Vector3d secondEndpoint = transforms.getSecond()
|
||||||
.apply(zero);
|
.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 connectorYaw = -Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI;
|
||||||
double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.mul(1, 0, 1)
|
double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.mul(1, 0, 1)
|
||||||
.length()) * 180 / Math.PI;
|
.length()) * 180 / Math.PI;
|
||||||
@ -89,7 +89,7 @@ public class MinecartCouplingRenderer {
|
|||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vec3d centerOfCoupling) {
|
private static CartEndpoint getSuitableCartEndpoint(AbstractMinecartEntity cart, Vector3d centerOfCoupling) {
|
||||||
long i = cart.getEntityId() * 493286711L;
|
long i = cart.getEntityId() * 493286711L;
|
||||||
i = i * i * 4392167121L + i * 98761L;
|
i = i * i * 4392167121L + i * 98761L;
|
||||||
float x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
float x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
|
||||||
@ -112,11 +112,11 @@ public class MinecartCouplingRenderer {
|
|||||||
rollAmplifier = 0.0F;
|
rollAmplifier = 0.0F;
|
||||||
roll = roll > 0 ? MathHelper.sin(roll) * roll * rollAmplifier / 10.0F * cart.getRollingDirection() : 0;
|
roll = roll > 0 ? MathHelper.sin(roll) * roll * rollAmplifier / 10.0F * cart.getRollingDirection() : 0;
|
||||||
|
|
||||||
Vec3d positionVec = new Vec3d(xIn, yIn, zIn);
|
Vector3d positionVec = new Vector3d(xIn, yIn, zIn);
|
||||||
Vec3d frontVec = positionVec.add(VecHelper.rotate(new Vec3d(.5, 0, 0), 180 - yaw, Axis.Y));
|
Vector3d frontVec = positionVec.add(VecHelper.rotate(new Vector3d(.5, 0, 0), 180 - yaw, Axis.Y));
|
||||||
Vec3d backVec = positionVec.add(VecHelper.rotate(new Vec3d(-.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;
|
boolean flip = false;
|
||||||
|
|
||||||
if (railVecOfPos != null) {
|
if (railVecOfPos != null) {
|
||||||
@ -131,7 +131,7 @@ public class MinecartCouplingRenderer {
|
|||||||
y += (frontVec.y + backVec.y) / 2;
|
y += (frontVec.y + backVec.y) / 2;
|
||||||
z += railVecOfPos.z;
|
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) {
|
if (endPointDiff.length() != 0.0D) {
|
||||||
endPointDiff = endPointDiff.normalize();
|
endPointDiff = endPointDiff.normalize();
|
||||||
yaw = (float) (Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI);
|
yaw = (float) (Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI);
|
||||||
@ -174,7 +174,7 @@ public class MinecartCouplingRenderer {
|
|||||||
this.flip = flip;
|
this.flip = flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3d apply(Vec3d vec) {
|
public Vector3d apply(Vector3d vec) {
|
||||||
vec = vec.add(offset, 0, 0);
|
vec = vec.add(offset, 0, 0);
|
||||||
vec = VecHelper.rotate(vec, roll, Axis.X);
|
vec = VecHelper.rotate(vec, roll, Axis.X);
|
||||||
vec = VecHelper.rotate(vec, pitch, Axis.Z);
|
vec = VecHelper.rotate(vec, pitch, Axis.Z);
|
||||||
|
@ -32,7 +32,7 @@ public class MinecartCouplingSerializer {
|
|||||||
|
|
||||||
private static CompoundNBT createCouplingTag(boolean main, MinecartCoupling coupling) {
|
private static CompoundNBT createCouplingTag(boolean main, MinecartCoupling coupling) {
|
||||||
CompoundNBT nbt = new CompoundNBT();
|
CompoundNBT nbt = new CompoundNBT();
|
||||||
nbt.put("Id", NBTUtil.writeUniqueId(coupling.getId()));
|
nbt.put("Id", NBTUtil.fromUuid(coupling.getId()));
|
||||||
nbt.putBoolean("Main", main);
|
nbt.putBoolean("Main", main);
|
||||||
nbt.putDouble("Length", coupling.length);
|
nbt.putDouble("Length", coupling.length);
|
||||||
return nbt;
|
return nbt;
|
||||||
|
@ -19,21 +19,21 @@ import net.minecraft.util.Direction;
|
|||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.vector.Vector3i;
|
||||||
|
|
||||||
public class MinecartSim2020 {
|
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_) -> {
|
Util.make(Maps.newEnumMap(RailShape.class), (p_226574_0_) -> {
|
||||||
Vec3i vec3i = Direction.WEST.getDirectionVec();
|
Vector3i vec3i = Direction.WEST.getDirectionVec();
|
||||||
Vec3i vec3i1 = Direction.EAST.getDirectionVec();
|
Vector3i vec3i1 = Direction.EAST.getDirectionVec();
|
||||||
Vec3i vec3i2 = Direction.NORTH.getDirectionVec();
|
Vector3i vec3i2 = Direction.NORTH.getDirectionVec();
|
||||||
Vec3i vec3i3 = Direction.SOUTH.getDirectionVec();
|
Vector3i vec3i3 = Direction.SOUTH.getDirectionVec();
|
||||||
Vec3i vec3i4 = vec3i.down();
|
Vector3i vec3i4 = vec3i.down();
|
||||||
Vec3i vec3i5 = vec3i1.down();
|
Vector3i vec3i5 = vec3i1.down();
|
||||||
Vec3i vec3i6 = vec3i2.down();
|
Vector3i vec3i6 = vec3i2.down();
|
||||||
Vec3i vec3i7 = vec3i3.down();
|
Vector3i vec3i7 = vec3i3.down();
|
||||||
p_226574_0_.put(RailShape.NORTH_SOUTH, Pair.of(vec3i2, vec3i3));
|
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.EAST_WEST, Pair.of(vec3i, vec3i1));
|
||||||
p_226574_0_.put(RailShape.ASCENDING_EAST, Pair.of(vec3i4, 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));
|
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) {
|
if (cart instanceof FurnaceMinecartEntity) {
|
||||||
return cart.getPositionVec()
|
return cart.getPositionVec()
|
||||||
.subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ);
|
.subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ);
|
||||||
@ -83,13 +83,13 @@ public class MinecartSim2020 {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vec3d forcedMovement, BlockPos cartPos,
|
public static void moveCartAlongTrack(AbstractMinecartEntity cart, Vector3d forcedMovement, BlockPos cartPos,
|
||||||
BlockState trackState) {
|
BlockState trackState) {
|
||||||
|
|
||||||
if (forcedMovement.equals(Vec3d.ZERO))
|
if (forcedMovement.equals(Vector3d.ZERO))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vec3d previousMotion = cart.getMotion();
|
Vector3d previousMotion = cart.getMotion();
|
||||||
cart.fallDistance = 0.0F;
|
cart.fallDistance = 0.0F;
|
||||||
|
|
||||||
double x = cart.getX();
|
double x = cart.getX();
|
||||||
@ -100,7 +100,7 @@ public class MinecartSim2020 {
|
|||||||
double actualY = y;
|
double actualY = y;
|
||||||
double actualZ = z;
|
double actualZ = z;
|
||||||
|
|
||||||
Vec3d actualVec = cart.getPos(actualX, actualY, actualZ);
|
Vector3d actualVec = cart.getPos(actualX, actualY, actualZ);
|
||||||
actualY = cartPos.getY() + 1;
|
actualY = cartPos.getY() + 1;
|
||||||
|
|
||||||
AbstractRailBlock abstractrailblock = (AbstractRailBlock) trackState.getBlock();
|
AbstractRailBlock abstractrailblock = (AbstractRailBlock) trackState.getBlock();
|
||||||
@ -125,9 +125,9 @@ public class MinecartSim2020 {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Vec3i, Vec3i> pair = MATRIX.get(railshape);
|
Pair<Vector3i, Vector3i> pair = MATRIX.get(railshape);
|
||||||
Vec3i vec3i = pair.getFirst();
|
Vector3i vec3i = pair.getFirst();
|
||||||
Vec3i vec3i1 = pair.getSecond();
|
Vector3i vec3i1 = pair.getSecond();
|
||||||
double d4 = (double) (vec3i1.getX() - vec3i.getX());
|
double d4 = (double) (vec3i1.getX() - vec3i.getX());
|
||||||
double d5 = (double) (vec3i1.getZ() - vec3i.getZ());
|
double d5 = (double) (vec3i1.getZ() - vec3i.getZ());
|
||||||
// double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
// double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
||||||
@ -177,16 +177,16 @@ public class MinecartSim2020 {
|
|||||||
y = cart.getY();
|
y = cart.getY();
|
||||||
z = cart.getZ();
|
z = cart.getZ();
|
||||||
|
|
||||||
Vec3d vec3d3 = cart.getPos(x, y, z);
|
Vector3d Vector3d3 = cart.getPos(x, y, z);
|
||||||
if (vec3d3 != null && actualVec != null) {
|
if (Vector3d3 != null && actualVec != null) {
|
||||||
double d17 = (actualVec.y - vec3d3.y) * 0.05D;
|
double d17 = (actualVec.y - Vector3d3.y) * 0.05D;
|
||||||
Vec3d vec3d4 = cart.getMotion();
|
Vector3d Vector3d4 = cart.getMotion();
|
||||||
double d18 = Math.sqrt(horizontalMag(vec3d4));
|
double d18 = Math.sqrt(horizontalMag(Vector3d4));
|
||||||
if (d18 > 0.0D) {
|
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();
|
x = cart.getX();
|
||||||
@ -196,24 +196,24 @@ public class MinecartSim2020 {
|
|||||||
int j = MathHelper.floor(x);
|
int j = MathHelper.floor(x);
|
||||||
int i = MathHelper.floor(z);
|
int i = MathHelper.floor(z);
|
||||||
if (j != cartPos.getX() || i != cartPos.getZ()) {
|
if (j != cartPos.getX() || i != cartPos.getZ()) {
|
||||||
Vec3d vec3d5 = cart.getMotion();
|
Vector3d Vector3d5 = cart.getMotion();
|
||||||
double d26 = Math.sqrt(horizontalMag(vec3d5));
|
double d26 = Math.sqrt(horizontalMag(Vector3d5));
|
||||||
cart.setMotion(d26 * (double) (j - cartPos.getX()), vec3d5.y, d26 * (double) (i - cartPos.getZ()));
|
cart.setMotion(d26 * (double) (j - cartPos.getX()), Vector3d5.y, d26 * (double) (i - cartPos.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
cart.setMotion(previousMotion);
|
cart.setMotion(previousMotion);
|
||||||
|
|
||||||
if (cart instanceof FurnaceMinecartEntity) {
|
if (cart instanceof FurnaceMinecartEntity) {
|
||||||
// FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart;
|
// FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart;
|
||||||
// Vec3d vec3d = cart.getMotion();
|
// Vector3d Vector3d = cart.getMotion();
|
||||||
// double d2 = horizontalMag(vec3d);
|
// double d2 = horizontalMag(Vector3d);
|
||||||
// double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ;
|
// double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ;
|
||||||
// if (d3 > 1.0E-4D && d2 > 0.001D) {
|
// if (d3 > 1.0E-4D && d2 > 0.001D) {
|
||||||
// double d40 = (double) MathHelper.sqrt(d2);
|
// double d40 = (double) MathHelper.sqrt(d2);
|
||||||
// double d50 = (double) MathHelper.sqrt(d3);
|
// double d50 = (double) MathHelper.sqrt(d3);
|
||||||
// furnaceCart.pushX = vec3d.x / d40 * d50;
|
// furnaceCart.pushX = Vector3d.x / d40 * d50;
|
||||||
// furnaceCart.pushZ = vec3d.z / d40 * d50;
|
// furnaceCart.pushZ = Vector3d.z / d40 * d50;
|
||||||
// furnaceCart.setMotion(vec3d.mul(0.8D, 0.0D, 0.8D)
|
// furnaceCart.setMotion(Vector3d.mul(0.8D, 0.0D, 0.8D)
|
||||||
// .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ));
|
// .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
|||||||
import net.minecraft.state.properties.RailShape;
|
import net.minecraft.state.properties.RailShape;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class MinecartTrain {
|
public class MinecartTrain {
|
||||||
@ -201,7 +201,7 @@ public class MinecartTrain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void hardCollisionStep(World world, Couple<AbstractMinecartEntity> carts, double couplingLength) {
|
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);
|
Couple<Float> maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail);
|
||||||
boolean firstLoop = true;
|
boolean firstLoop = true;
|
||||||
for (boolean current : new boolean[] { true, false, true }) {
|
for (boolean current : new boolean[] { true, false, true }) {
|
||||||
@ -220,9 +220,9 @@ public class MinecartTrain {
|
|||||||
shape = block.getRailDirection(railState, world, railPosition, cart);
|
shape = block.getRailDirection(railState, world, railPosition, cart);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d correction = Vec3d.ZERO;
|
Vector3d correction = Vector3d.ZERO;
|
||||||
Vec3d pos = cart.getPositionVec();
|
Vector3d pos = cart.getPositionVec();
|
||||||
Vec3d link = otherCart.getPositionVec()
|
Vector3d link = otherCart.getPositionVec()
|
||||||
.subtract(pos);
|
.subtract(pos);
|
||||||
float correctionMagnitude = firstLoop ? -stress / 2f : -stress;
|
float correctionMagnitude = firstLoop ? -stress / 2f : -stress;
|
||||||
correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos)
|
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) {
|
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<Float> maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail);
|
||||||
Couple<Boolean> canAddmotion = carts.map(MinecartSim2020::canAddMotion);
|
Couple<Boolean> canAddmotion = carts.map(MinecartSim2020::canAddMotion);
|
||||||
|
|
||||||
@ -261,9 +261,9 @@ public class MinecartTrain {
|
|||||||
return block.getRailDirection(railState, world, railPosition, current);
|
return block.getRailDirection(railState, world, railPosition, current);
|
||||||
});
|
});
|
||||||
|
|
||||||
Couple<Vec3d> motions = carts.map(MinecartSim2020::predictMotionOf);
|
Couple<Vector3d> motions = carts.map(MinecartSim2020::predictMotionOf);
|
||||||
Couple<Vec3d> nextPositions = positions.copy();
|
Couple<Vector3d> nextPositions = positions.copy();
|
||||||
nextPositions.replaceWithParams(Vec3d::add, motions);
|
nextPositions.replaceWithParams(Vector3d::add, motions);
|
||||||
|
|
||||||
float futureStress = (float) (couplingLength - nextPositions.getFirst()
|
float futureStress = (float) (couplingLength - nextPositions.getFirst()
|
||||||
.distanceTo(nextPositions.getSecond()));
|
.distanceTo(nextPositions.getSecond()));
|
||||||
@ -271,9 +271,9 @@ public class MinecartTrain {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (boolean current : Iterate.trueAndFalse) {
|
for (boolean current : Iterate.trueAndFalse) {
|
||||||
Vec3d correction = Vec3d.ZERO;
|
Vector3d correction = Vector3d.ZERO;
|
||||||
Vec3d pos = nextPositions.get(current);
|
Vector3d pos = nextPositions.get(current);
|
||||||
Vec3d link = nextPositions.get(!current)
|
Vector3d link = nextPositions.get(!current)
|
||||||
.subtract(pos);
|
.subtract(pos);
|
||||||
float correctionMagnitude = -futureStress / 2f;
|
float correctionMagnitude = -futureStress / 2f;
|
||||||
|
|
||||||
@ -293,16 +293,16 @@ public class MinecartTrain {
|
|||||||
carts.forEachWithParams(Entity::setMotion, motions);
|
carts.forEachWithParams(Entity::setMotion, motions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec3d followLinkOnRail(Vec3d link, Vec3d cart, float diffToReduce, RailShape shape) {
|
public static Vector3d followLinkOnRail(Vector3d link, Vector3d cart, float diffToReduce, RailShape shape) {
|
||||||
Vec3d railAxis = getRailVec(shape);
|
Vector3d railAxis = getRailVec(shape);
|
||||||
double dotProduct = railAxis.dotProduct(link);
|
double dotProduct = railAxis.dotProduct(link);
|
||||||
if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0)
|
if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0)
|
||||||
return cart;
|
return cart;
|
||||||
|
|
||||||
Vec3d axis = railAxis.scale(-Math.signum(dotProduct));
|
Vector3d axis = railAxis.scale(-Math.signum(dotProduct));
|
||||||
Vec3d center = cart.add(link);
|
Vector3d center = cart.add(link);
|
||||||
double radius = link.length() - diffToReduce;
|
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
|
// Cannot satisfy on current rail vector
|
||||||
if (intersectSphere == null)
|
if (intersectSphere == null)
|
||||||
@ -311,24 +311,24 @@ public class MinecartTrain {
|
|||||||
return intersectSphere;
|
return intersectSphere;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vec3d getRailVec(RailShape shape) {
|
private static Vector3d getRailVec(RailShape shape) {
|
||||||
switch (shape) {
|
switch (shape) {
|
||||||
case ASCENDING_NORTH:
|
case ASCENDING_NORTH:
|
||||||
case ASCENDING_SOUTH:
|
case ASCENDING_SOUTH:
|
||||||
case NORTH_SOUTH:
|
case NORTH_SOUTH:
|
||||||
return new Vec3d(0, 0, 1);
|
return new Vector3d(0, 0, 1);
|
||||||
case ASCENDING_EAST:
|
case ASCENDING_EAST:
|
||||||
case ASCENDING_WEST:
|
case ASCENDING_WEST:
|
||||||
case EAST_WEST:
|
case EAST_WEST:
|
||||||
return new Vec3d(1, 0, 0);
|
return new Vector3d(1, 0, 0);
|
||||||
case NORTH_EAST:
|
case NORTH_EAST:
|
||||||
case SOUTH_WEST:
|
case SOUTH_WEST:
|
||||||
return new Vec3d(1, 0, 1).normalize();
|
return new Vector3d(1, 0, 1).normalize();
|
||||||
case NORTH_WEST:
|
case NORTH_WEST:
|
||||||
case SOUTH_EAST:
|
case SOUTH_EAST:
|
||||||
return new Vec3d(1, 0, -1).normalize();
|
return new Vector3d(1, 0, -1).normalize();
|
||||||
default:
|
default:
|
||||||
return new Vec3d(0, 1, 0);
|
return new Vector3d(0, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,9 +345,9 @@ public class MinecartTrain {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int yOffset = 1;
|
int yOffset = 1;
|
||||||
Vec3d mainCenter = mainCart.getPositionVec()
|
Vector3d mainCenter = mainCart.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
Vec3d connectedCenter = connectedCart.getPositionVec()
|
Vector3d connectedCenter = connectedCart.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
|
|
||||||
int color = ColorHelper.mixColors(0xabf0e9, 0xee8572,
|
int color = ColorHelper.mixColors(0xabf0e9, 0xee8572,
|
||||||
@ -357,7 +357,7 @@ public class MinecartTrain {
|
|||||||
.colored(color)
|
.colored(color)
|
||||||
.lineWidth(1 / 8f);
|
.lineWidth(1 / 8f);
|
||||||
|
|
||||||
Vec3d point = mainCart.getPositionVec()
|
Vector3d point = mainCart.getPositionVec()
|
||||||
.add(0, yOffset, 0);
|
.add(0, yOffset, 0);
|
||||||
CreateClient.outliner.showLine(coupling.getId() + "" + index, point, point.add(0, 1 / 128f, 0))
|
CreateClient.outliner.showLine(coupling.getId() + "" + index, point, point.add(0, 1 / 128f, 0))
|
||||||
.colored(0xffffff)
|
.colored(0xffffff)
|
||||||
|
@ -108,10 +108,11 @@ public class ReinforcedRailBlock extends AbstractRailBlock {
|
|||||||
return PushReaction.BLOCK;
|
return PushReaction.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Same thing as before, does this still matter? If so, what is the new way of doing it?
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) {
|
public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) {
|
||||||
|
@ -47,7 +47,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity e) {
|
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity e) {
|
||||||
if (!e.onGround)
|
if (!e.isOnGround())
|
||||||
return;
|
return;
|
||||||
if (e.getMotion().y > 0)
|
if (e.getMotion().y > 0)
|
||||||
return;
|
return;
|
||||||
@ -61,7 +61,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
|
|||||||
|
|
||||||
World world = e.getEntityWorld();
|
World world = e.getEntityWorld();
|
||||||
if (world.isRemote && (e instanceof PlayerEntity)) {
|
if (world.isRemote && (e instanceof PlayerEntity)) {
|
||||||
if (worldIn.getBlockState(e.getPosition()) != state) {
|
if (worldIn.getBlockState(e.getBlockPos()) != state) {
|
||||||
Vector3d origin = VecHelper.getCenterOf(pos);
|
Vector3d origin = VecHelper.getCenterOf(pos);
|
||||||
Vector3d offset = e.getPositionVec()
|
Vector3d offset = e.getPositionVec()
|
||||||
.subtract(origin);
|
.subtract(origin);
|
||||||
|
@ -13,11 +13,11 @@ public class TurntableHandler {
|
|||||||
|
|
||||||
public static void gameRenderTick() {
|
public static void gameRenderTick() {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
BlockPos pos = mc.player.getPosition();
|
BlockPos pos = mc.player.getBlockPos();
|
||||||
|
|
||||||
if (!AllBlocks.TURNTABLE.has(mc.world.getBlockState(pos)))
|
if (!AllBlocks.TURNTABLE.has(mc.world.getBlockState(pos)))
|
||||||
return;
|
return;
|
||||||
if (!mc.player.onGround)
|
if (!mc.player.isOnGround())
|
||||||
return;
|
return;
|
||||||
if (mc.isGamePaused())
|
if (mc.isGamePaused())
|
||||||
return;
|
return;
|
||||||
|
@ -8,6 +8,7 @@ import com.simibubi.create.foundation.block.ITE;
|
|||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.BlockRenderType;
|
import net.minecraft.block.BlockRenderType;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
@ -24,6 +25,10 @@ import net.minecraft.world.IWorld;
|
|||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<WaterWheelTileEntity> {
|
public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<WaterWheelTileEntity> {
|
||||||
|
|
||||||
public WaterWheelBlock(Properties properties) {
|
public WaterWheelBlock(Properties properties) {
|
||||||
@ -61,10 +66,9 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
||||||
BlockPos currentPos, BlockPos facingPos) {
|
BlockPos currentPos, BlockPos facingPos) {
|
||||||
World world = worldIn.getWorld();
|
if (worldIn instanceof WrappedWorld)
|
||||||
if (world == null || worldIn instanceof WrappedWorld)
|
|
||||||
return stateIn;
|
return stateIn;
|
||||||
updateFlowAt(stateIn, world, currentPos, facing);
|
updateFlowAt(stateIn, worldIn, currentPos, facing);
|
||||||
updateWheelSpeed(worldIn, currentPos);
|
updateWheelSpeed(worldIn, currentPos);
|
||||||
return stateIn;
|
return stateIn;
|
||||||
}
|
}
|
||||||
@ -80,7 +84,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||||||
updateWheelSpeed(worldIn, pos);
|
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)
|
if (f.getAxis() == state.get(HORIZONTAL_FACING)
|
||||||
.getAxis())
|
.getAxis())
|
||||||
return;
|
return;
|
||||||
@ -113,7 +117,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||||||
flowStrength = flow.y > 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y;
|
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);
|
AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5);
|
||||||
if (fluid.getFluid() == Fluids.FLOWING_LAVA || fluid.getFluid() == Fluids.LAVA)
|
if (fluid.getFluid() == Fluids.FLOWING_LAVA || fluid.getFluid() == Fluids.LAVA)
|
||||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.LAVA_WHEEL, world, pos, 5);
|
AllTriggers.triggerForNearbyPlayers(AllTriggers.LAVA_WHEEL, world, pos, 5);
|
||||||
|
@ -29,7 +29,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
|
|||||||
if (compound.contains("Flows")) {
|
if (compound.contains("Flows")) {
|
||||||
for (Direction d : Direction.values())
|
for (Direction d : Direction.values())
|
||||||
setFlow(d, compound.getCompound("Flows")
|
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) {
|
public void write(CompoundNBT compound, boolean clientPacket) {
|
||||||
CompoundNBT flows = new CompoundNBT();
|
CompoundNBT flows = new CompoundNBT();
|
||||||
for (Direction d : Direction.values())
|
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);
|
compound.put("Flows", flows);
|
||||||
|
|
||||||
super.write(compound, clientPacket);
|
super.write(compound, clientPacket);
|
||||||
|
@ -7,13 +7,13 @@ import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ILightReader;
|
import net.minecraft.world.IBlockDisplayReader;
|
||||||
|
|
||||||
public class FluidPipeAttachmentBehaviour extends TileEntityBehaviour {
|
public class FluidPipeAttachmentBehaviour extends TileEntityBehaviour {
|
||||||
|
|
||||||
public static BehaviourType<FluidPipeAttachmentBehaviour> TYPE = new BehaviourType<>();
|
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))
|
if (!isPipeConnectedTowards(state, direction))
|
||||||
return AttachmentTypes.NONE;
|
return AttachmentTypes.NONE;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import net.minecraft.particles.ParticleTypes;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@ -296,15 +296,15 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float rimRadius = getRimRadius(state, side);
|
float rimRadius = getRimRadius(state, side);
|
||||||
Vec3d directionVec = new Vec3d(side.getDirectionVec());
|
Vector3d directionVec = Vector3d.of(side.getDirectionVec());
|
||||||
|
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, 1)
|
Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, 1)
|
||||||
.normalize();
|
.normalize();
|
||||||
vec = VecHelper.clampComponentWise(vec, rimRadius)
|
vec = VecHelper.clampComponentWise(vec, rimRadius)
|
||||||
.mul(VecHelper.axisAlingedPlaneOf(directionVec))
|
.mul(VecHelper.axisAlingedPlaneOf(directionVec))
|
||||||
.add(directionVec.scale(.45 + r.nextFloat() / 16f));
|
.add(directionVec.scale(.45 + r.nextFloat() / 16f));
|
||||||
Vec3d m = vec;
|
Vector3d m = vec;
|
||||||
vec = vec.add(VecHelper.getCenterOf(pos));
|
vec = vec.add(VecHelper.getCenterOf(pos));
|
||||||
|
|
||||||
world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z);
|
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()
|
.getDefaultState()
|
||||||
.getBlockState());
|
.getBlockState());
|
||||||
float rimRadius = getRimRadius(state, side);
|
float rimRadius = getRimRadius(state, side);
|
||||||
Vec3d directionVec = new Vec3d(side.getDirectionVec());
|
Vector3d directionVec = Vector3d.of(side.getDirectionVec());
|
||||||
|
|
||||||
Couple<PipeFlows> couple = allFlows.get(side);
|
Couple<PipeFlows> couple = allFlows.get(side);
|
||||||
if (couple == null)
|
if (couple == null)
|
||||||
@ -326,11 +326,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
|
|||||||
if (flow.progress == null)
|
if (flow.progress == null)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < amount; i++) {
|
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))
|
vec = vec.mul(VecHelper.axisAlingedPlaneOf(directionVec))
|
||||||
.add(directionVec.scale(.5 + r.nextFloat() / 4f));
|
.add(directionVec.scale(.5 + r.nextFloat() / 4f));
|
||||||
Vec3d m = vec;
|
Vector3d m = vec;
|
||||||
Vec3d centerOf = VecHelper.getCenterOf(tileEntity.getPos());
|
Vector3d centerOf = VecHelper.getCenterOf(tileEntity.getPos());
|
||||||
vec = vec.add(centerOf);
|
vec = vec.add(centerOf);
|
||||||
if (inbound) {
|
if (inbound) {
|
||||||
vec = vec.add(m);
|
vec = vec.add(m);
|
||||||
@ -350,7 +350,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
|
|||||||
.getRenderViewEntity();
|
.getRenderViewEntity();
|
||||||
if (renderViewEntity == null)
|
if (renderViewEntity == null)
|
||||||
return false;
|
return false;
|
||||||
Vec3d center = VecHelper.getCenterOf(tileEntity.getPos());
|
Vector3d center = VecHelper.getCenterOf(tileEntity.getPos());
|
||||||
if (renderViewEntity.getPositionVec()
|
if (renderViewEntity.getPositionVec()
|
||||||
.distanceTo(center) > MAX_PARTICLE_RENDER_DISTANCE)
|
.distanceTo(center) > MAX_PARTICLE_RENDER_DISTANCE)
|
||||||
return false;
|
return false;
|
||||||
@ -411,7 +411,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
|
|||||||
return;
|
return;
|
||||||
for (Entry<Direction, Couple<PipeFlows>> entry : allFlows.entrySet()) {
|
for (Entry<Direction, Couple<PipeFlows>> entry : allFlows.entrySet()) {
|
||||||
Direction face = entry.getKey();
|
Direction face = entry.getKey();
|
||||||
Vec3d directionVec = new Vec3d(face.getDirectionVec());
|
Vector3d directionVec = Vector3d.of(face.getDirectionVec());
|
||||||
float size = 1 / 4f;
|
float size = 1 / 4f;
|
||||||
boolean extended = !isConnectedTo(tileEntity.getBlockState(), face.getOpposite());
|
boolean extended = !isConnectedTo(tileEntity.getBlockState(), face.getOpposite());
|
||||||
float length = extended ? .75f : .5f;
|
float length = extended ? .75f : .5f;
|
||||||
@ -421,11 +421,11 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
|
|||||||
if (flow.progress == null)
|
if (flow.progress == null)
|
||||||
return;
|
return;
|
||||||
float value = flow.progress.getValue();
|
float value = flow.progress.getValue();
|
||||||
Vec3d start = directionVec.scale(inbound ? .5 : .5f - length);
|
Vector3d start = directionVec.scale(inbound ? .5 : .5f - length);
|
||||||
Vec3d offset = directionVec.scale(length * (inbound ? -1 : 1))
|
Vector3d offset = directionVec.scale(length * (inbound ? -1 : 1))
|
||||||
.scale(value);
|
.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()))
|
.getOffset()))
|
||||||
.scale(size);
|
.scale(size);
|
||||||
AxisAlignedBB bb =
|
AxisAlignedBB bb =
|
||||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import org.apache.commons.lang3.mutable.MutableObject;
|
import org.apache.commons.lang3.mutable.MutableObject;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
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.Direction.AxisDirection;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IBlockReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -73,11 +74,11 @@ public class FluidPropagator {
|
|||||||
if (PumpBlock.isPump(connectedState) && connectedState.get(PumpBlock.FACING)
|
if (PumpBlock.isPump(connectedState) && connectedState.get(PumpBlock.FACING)
|
||||||
.getAxis() == side.getAxis())
|
.getAxis() == side.getAxis())
|
||||||
return false;
|
return false;
|
||||||
if (Block.hasSolidSide(connectedState, reader, connectedPos, side.getOpposite()))
|
if (BlockHelper.hasBlockSolidSide(connectedState, reader, connectedPos, side.getOpposite()))
|
||||||
return false;
|
return false;
|
||||||
if (!(connectedState.getMaterial()
|
if (!(connectedState.getMaterial()
|
||||||
.isReplaceable() && connectedState.getBlockHardness(reader, connectedPos) != -1)
|
.isReplaceable() && connectedState.getBlockHardness(reader, connectedPos) != -1)
|
||||||
&& !connectedState.has(BlockStateProperties.WATERLOGGED))
|
&& !BlockHelper.hasBlockStateProperty(connectedState, BlockStateProperties.WATERLOGGED))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -139,14 +140,14 @@ public class FluidPropagator {
|
|||||||
public static OutlineParams showBlockFace(BlockFace face) {
|
public static OutlineParams showBlockFace(BlockFace face) {
|
||||||
MutableObject<OutlineParams> params = new MutableObject<>(new OutlineParams());
|
MutableObject<OutlineParams> params = new MutableObject<>(new OutlineParams());
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
Vec3d directionVec = new Vec3d(face.getFace()
|
Vector3d directionVec = Vector3d.of(face.getFace()
|
||||||
.getDirectionVec());
|
.getDirectionVec());
|
||||||
Vec3d scaleVec = directionVec.scale(-.25f * face.getFace()
|
Vector3d scaleVec = directionVec.scale(-.25f * face.getFace()
|
||||||
.getAxisDirection()
|
.getAxisDirection()
|
||||||
.getOffset());
|
.getOffset());
|
||||||
directionVec = directionVec.scale(.5f);
|
directionVec = directionVec.scale(.5f);
|
||||||
params.setValue(CreateClient.outliner.showAABB(face,
|
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(scaleVec.x, scaleVec.y, scaleVec.z)
|
||||||
.grow(1 / 16f)));
|
.grow(1 / 16f)));
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@ import com.simibubi.create.foundation.utility.BlockHelper;
|
|||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@ -21,7 +21,7 @@ public class FluidReactions {
|
|||||||
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
|
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 pf = FluidHelper.convertToStill(pipeFluid);
|
||||||
Fluid wf = worldFluid.getFluid();
|
Fluid wf = worldFluid.getFluid();
|
||||||
if (pf == Fluids.WATER && wf == Fluids.LAVA)
|
if (pf == Fluids.WATER && wf == Fluids.LAVA)
|
||||||
|
@ -3,13 +3,14 @@ package com.simibubi.create.content.contraptions.fluids;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.BlockFace;
|
import com.simibubi.create.foundation.utility.BlockFace;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.FlowingFluidBlock;
|
import net.minecraft.block.FlowingFluidBlock;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@ -44,8 +45,8 @@ public class OpenEndedPipe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockState state = world.getBlockState(outputPos);
|
BlockState state = world.getBlockState(outputPos);
|
||||||
IFluidState fluidState = state.getFluidState();
|
FluidState fluidState = state.getFluidState();
|
||||||
boolean waterlog = state.has(BlockStateProperties.WATERLOGGED);
|
boolean waterlog = BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED);
|
||||||
|
|
||||||
if (!waterlog && !state.getMaterial()
|
if (!waterlog && !state.getMaterial()
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
@ -128,14 +129,14 @@ public class OpenEndedPipe {
|
|||||||
if (resource.isEmpty())
|
if (resource.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
BlockState state = world.getBlockState(outputPos);
|
BlockState state = world.getBlockState(outputPos);
|
||||||
IFluidState fluidState = state.getFluidState();
|
FluidState fluidState = state.getFluidState();
|
||||||
if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) {
|
if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) {
|
||||||
FluidReactions.handlePipeSpillCollision(world, outputPos, resource.getFluid(), fluidState);
|
FluidReactions.handlePipeSpillCollision(world, outputPos, resource.getFluid(), fluidState);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (fluidState.isSource())
|
if (fluidState.isSource())
|
||||||
return 0;
|
return 0;
|
||||||
if (!(state.has(BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER)
|
if (!(BlockHelper.hasBlockStateProperty(state, BlockStateProperties.WATERLOGGED) && resource.getFluid() == Fluids.WATER)
|
||||||
&& !state.getMaterial()
|
&& !state.getMaterial()
|
||||||
.isReplaceable())
|
.isReplaceable())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -17,7 +17,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
|||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IModelData;
|
||||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||||
import net.minecraftforge.client.model.data.ModelProperty;
|
import net.minecraftforge.client.model.data.ModelProperty;
|
||||||
@ -31,7 +31,7 @@ public class PipeAttachmentModel extends WrappedBakedModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
PipeModelData data = new PipeModelData();
|
||||||
FluidPipeAttachmentBehaviour attachmentBehaviour =
|
FluidPipeAttachmentBehaviour attachmentBehaviour =
|
||||||
TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE);
|
TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE);
|
||||||
|
@ -153,10 +153,10 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
FluidState ifluidstate = context.getWorld()
|
FluidState FluidState = context.getWorld()
|
||||||
.getFluidState(context.getPos());
|
.getFluidState(context.getPos());
|
||||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED,
|
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) {
|
public static boolean isPump(BlockState state) {
|
||||||
|
@ -25,7 +25,7 @@ import net.minecraft.nbt.ListNBT;
|
|||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.common.util.Constants.NBT;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
@ -368,7 +368,7 @@ public class PumpTileEntity extends KineticTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
|
||||||
if (attachment == AttachmentTypes.RIM)
|
if (attachment == AttachmentTypes.RIM)
|
||||||
return AttachmentTypes.NONE;
|
return AttachmentTypes.NONE;
|
||||||
|
@ -27,7 +27,7 @@ import net.minecraft.particles.ParticleTypes;
|
|||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
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.capabilities.Capability;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@ -228,7 +228,7 @@ public class SpoutTileEntity extends SmartTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void spawnProcessingParticles(FluidStack fluid) {
|
protected void spawnProcessingParticles(FluidStack fluid) {
|
||||||
Vec3d vec = VecHelper.getCenterOf(pos);
|
Vector3d vec = VecHelper.getCenterOf(pos);
|
||||||
vec = vec.subtract(0, 8 / 16f, 0);
|
vec = vec.subtract(0, 8 / 16f, 0);
|
||||||
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
|
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
|
||||||
.getDefaultState()
|
.getDefaultState()
|
||||||
@ -239,14 +239,14 @@ public class SpoutTileEntity extends SmartTileEntity {
|
|||||||
protected static int SPLASH_PARTICLE_COUNT = 20;
|
protected static int SPLASH_PARTICLE_COUNT = 20;
|
||||||
|
|
||||||
protected void spawnSplash(FluidStack fluid) {
|
protected void spawnSplash(FluidStack fluid) {
|
||||||
Vec3d vec = VecHelper.getCenterOf(pos);
|
Vector3d vec = VecHelper.getCenterOf(pos);
|
||||||
vec = vec.subtract(0, 2 - 5 / 16f, 0);
|
vec = vec.subtract(0, 2 - 5 / 16f, 0);
|
||||||
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
|
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
|
||||||
.getDefaultState()
|
.getDefaultState()
|
||||||
.getBlockState());
|
.getBlockState());
|
||||||
for (int i = 0; i < SPLASH_PARTICLE_COUNT; i++) {
|
for (int i = 0; i < SPLASH_PARTICLE_COUNT; i++) {
|
||||||
Vec3d m = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, 0.25f);
|
Vector3d m = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, 0.25f);
|
||||||
m = new Vec3d(m.x, Math.abs(m.y), m.z);
|
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);
|
world.addOptionalParticle(particle, vec.x, vec.y, vec.z, m.x, m.y, m.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import net.minecraft.block.IWaterLoggable;
|
|||||||
import net.minecraft.block.SixWayBlock;
|
import net.minecraft.block.SixWayBlock;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.item.BlockItemUseContext;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.network.DebugPacketSender;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.ILightReader;
|
import net.minecraft.world.IBlockDisplayReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.TickPriority;
|
import net.minecraft.world.TickPriority;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -140,7 +140,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
return state.getBlock() instanceof FluidPipeBlock;
|
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))
|
if (isPipe(neighbour) || FluidPropagator.hasFluidCapability(neighbour, world, pos, blockFace))
|
||||||
return true;
|
return true;
|
||||||
FluidPipeAttachmentBehaviour attachmentBehaviour =
|
FluidPipeAttachmentBehaviour attachmentBehaviour =
|
||||||
@ -150,7 +150,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
return attachmentBehaviour.isPipeConnectedTowards(neighbour, blockFace);
|
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);
|
BlockPos offsetPos = pos.offset(direction);
|
||||||
BlockState facingState = world.getBlockState(offsetPos);
|
BlockState facingState = world.getBlockState(offsetPos);
|
||||||
if (!isPipe(facingState))
|
if (!isPipe(facingState))
|
||||||
@ -170,11 +170,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
return state.get(FACING_TO_PROPERTY_MAP.get(direction));
|
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);
|
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))
|
if (!isPipe(state))
|
||||||
return false;
|
return false;
|
||||||
for (Axis axis : Iterate.axes) {
|
for (Axis axis : Iterate.axes) {
|
||||||
@ -196,11 +196,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
IFluidState ifluidstate = context.getWorld()
|
FluidState FluidState = context.getWorld()
|
||||||
.getFluidState(context.getPos());
|
.getFluidState(context.getPos());
|
||||||
return updateBlockState(getDefaultState(), context.getNearestLookingDirection(), null, context.getWorld(),
|
return updateBlockState(getDefaultState(), context.getNearestLookingDirection(), null, context.getWorld(),
|
||||||
context.getPos()).with(BlockStateProperties.WATERLOGGED,
|
context.getPos()).with(BlockStateProperties.WATERLOGGED,
|
||||||
Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
Boolean.valueOf(FluidState.getFluid() == Fluids.WATER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -214,7 +214,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockState updateBlockState(BlockState state, Direction preferredDirection, @Nullable Direction ignore,
|
public BlockState updateBlockState(BlockState state, Direction preferredDirection, @Nullable Direction ignore,
|
||||||
ILightReader world, BlockPos pos) {
|
IBlockDisplayReader world, BlockPos pos) {
|
||||||
// Update sides that are not ignored
|
// Update sides that are not ignored
|
||||||
for (Direction d : Iterate.directions)
|
for (Direction d : Iterate.directions)
|
||||||
if (d != ignore)
|
if (d != ignore)
|
||||||
@ -241,7 +241,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWren
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFluidState getFluidState(BlockState state) {
|
public FluidState getFluidState(BlockState state) {
|
||||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
|
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false)
|
||||||
: Fluids.EMPTY.getDefaultState();
|
: Fluids.EMPTY.getDefaultState();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ILightReader;
|
import net.minecraft.world.IBlockDisplayReader;
|
||||||
|
|
||||||
public class FluidPipeTileEntity extends SmartTileEntity {
|
public class FluidPipeTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class FluidPipeTileEntity extends SmartTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
|
||||||
|
|
||||||
BlockPos offsetPos = pos.offset(direction);
|
BlockPos offsetPos = pos.offset(direction);
|
||||||
|
@ -12,7 +12,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ILightReader;
|
import net.minecraft.world.IBlockDisplayReader;
|
||||||
|
|
||||||
public class StraightPipeTileEntity extends SmartTileEntity {
|
public class StraightPipeTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class StraightPipeTileEntity extends SmartTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
|
||||||
BlockState otherState = world.getBlockState(pos.offset(direction));
|
BlockState otherState = world.getBlockState(pos.offset(direction));
|
||||||
if (state.getBlock() instanceof AxisPipeBlock && otherState.getBlock() instanceof AxisPipeBlock) {
|
if (state.getBlock() instanceof AxisPipeBlock && otherState.getBlock() instanceof AxisPipeBlock) {
|
||||||
|
@ -31,7 +31,7 @@ import net.minecraft.util.SoundEvents;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.MathHelper;
|
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.IBlockReader;
|
||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -171,10 +171,10 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
|
|||||||
if (reversed)
|
if (reversed)
|
||||||
level = 1 - level;
|
level = 1 - level;
|
||||||
|
|
||||||
Vec3d vec = ray.getHitVec();
|
Vector3d vec = ray.getHitVec();
|
||||||
vec = new Vec3d(vec.x, controllerTE.getPos()
|
vec = new Vector3d(vec.x, controllerTE.getPos()
|
||||||
.getY() + level * (controllerTE.height - .5f) + .25f, vec.z);
|
.getY() + level * (controllerTE.height - .5f) + .25f, vec.z);
|
||||||
Vec3d motion = player.getPositionVec()
|
Vector3d motion = player.getPositionVec()
|
||||||
.subtract(vec)
|
.subtract(vec)
|
||||||
.scale(1 / 20f);
|
.scale(1 / 20f);
|
||||||
vec = vec.add(motion);
|
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;
|
PLAIN, WINDOW, WINDOW_NW, WINDOW_SW, WINDOW_NE, WINDOW_SE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return Lang.asId(name());
|
return Lang.asId(name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ILightReader;
|
import net.minecraft.world.IBlockDisplayReader;
|
||||||
|
|
||||||
public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
|
public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
Direction face) {
|
||||||
return state.getBlock() == other.getBlock() && FluidTankConnectivityHandler.isConnected(reader, pos, otherPos);
|
return state.getBlock() == other.getBlock() && FluidTankConnectivityHandler.isConnected(reader, pos, otherPos);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class FluidTankGenerator extends SpecialBlockStateGen {
|
|||||||
shapeName = "bottom";
|
shapeName = "bottom";
|
||||||
|
|
||||||
return AssetLookup.partialBaseModel(ctx, prov,
|
return AssetLookup.partialBaseModel(ctx, prov,
|
||||||
shapeName + (shape == Shape.PLAIN ? "" : "_" + shape.getName()));
|
shapeName + (shape == Shape.PLAIN ? "" : "_" + shape.getString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
|||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.IModelData;
|
||||||
import net.minecraftforge.client.model.data.ModelProperty;
|
import net.minecraftforge.client.model.data.ModelProperty;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class FluidTankModel extends CTModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
CullData cullData = new CullData();
|
||||||
for (Direction d : Iterate.horizontalDirections)
|
for (Direction d : Iterate.horizontalDirections)
|
||||||
cullData.setCulled(d, FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(d)));
|
cullData.setCulled(d, FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(d)));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.simibubi.create.content.contraptions.goggles;
|
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.AllItems;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
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 com.simibubi.create.foundation.utility.Lang;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -17,22 +18,22 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||||||
|
|
||||||
private int offsetX;
|
private int offsetX;
|
||||||
private int offsetY;
|
private int offsetY;
|
||||||
private final List<String> tooltip;
|
private final List<ITextComponent> tooltip;
|
||||||
|
|
||||||
public GoggleConfigScreen() {
|
public GoggleConfigScreen() {
|
||||||
String spacing = " ";
|
String spacing = " ";
|
||||||
tooltip = new ArrayList<>();
|
tooltip = new ArrayList<>();
|
||||||
tooltip.add(spacing + Lang.translate("gui.config.overlay1"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay1")));
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2"));
|
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2")));
|
||||||
tooltip.add("");
|
tooltip.add(ITextComponent.of(""));
|
||||||
tooltip.add(spacing + Lang.translate("gui.config.overlay3"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay3")));
|
||||||
tooltip.add(spacing + Lang.translate("gui.config.overlay4"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay4")));
|
||||||
tooltip.add("");
|
tooltip.add(ITextComponent.of(""));
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5"));
|
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5")));
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6"));
|
tooltip.add(ITextComponent.of(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6")));
|
||||||
tooltip.add("");
|
tooltip.add(ITextComponent.of(""));
|
||||||
tooltip.add(spacing + Lang.translate("gui.config.overlay7"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay7")));
|
||||||
tooltip.add(spacing + Lang.translate("gui.config.overlay8"));
|
tooltip.add(ITextComponent.of(spacing + Lang.translate("gui.config.overlay8")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,16 +72,16 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
RenderSystem.pushMatrix();
|
ms.push();
|
||||||
int posX = this.width / 2 + offsetX;
|
int posX = this.width / 2 + offsetX;
|
||||||
int posY = this.height / 2 + offsetY;
|
int posY = this.height / 2 + offsetY;
|
||||||
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
||||||
renderTooltip(tooltip, posX, posY);
|
renderTooltip(ms, tooltip, posX, posY);
|
||||||
|
|
||||||
ItemStack item = AllItems.GOGGLES.asStack();
|
ItemStack item = AllItems.GOGGLES.asStack();
|
||||||
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
|
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
|
||||||
GuiGameElement.of(item).at(posX + 10, posY - 16).render();
|
GuiGameElement.of(item).at(posX + 10, posY - 16).render();
|
||||||
RenderSystem.popMatrix();
|
ms.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.simibubi.create.content.contraptions.goggles;
|
package com.simibubi.create.content.contraptions.goggles;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
@ -29,6 +30,7 @@ public class GoggleOverlayRenderer {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
||||||
|
MatrixStack ms = event.getMatrixStack();
|
||||||
if (event.getType() != ElementType.HOTBAR)
|
if (event.getType() != ElementType.HOTBAR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ public class GoggleOverlayRenderer {
|
|||||||
if (!goggleInformation && !hoveringInformation)
|
if (!goggleInformation && !hoveringInformation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<String> tooltip = new ArrayList<>();
|
List<ITextComponent> tooltip = new ArrayList<>();
|
||||||
|
|
||||||
if (goggleInformation && AllItems.GOGGLES.isIn(goggles)) {
|
if (goggleInformation && AllItems.GOGGLES.isIn(goggles)) {
|
||||||
IHaveGoggleInformation gte = (IHaveGoggleInformation) te;
|
IHaveGoggleInformation gte = (IHaveGoggleInformation) te;
|
||||||
@ -60,7 +62,7 @@ public class GoggleOverlayRenderer {
|
|||||||
if (hoveringInformation) {
|
if (hoveringInformation) {
|
||||||
boolean goggleAddedInformation = !tooltip.isEmpty();
|
boolean goggleAddedInformation = !tooltip.isEmpty();
|
||||||
if (goggleAddedInformation)
|
if (goggleAddedInformation)
|
||||||
tooltip.add("");
|
tooltip.add(ITextComponent.of(""));
|
||||||
IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
|
IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
|
||||||
if (!hte.addToTooltip(tooltip, mc.player.isSneaking()))
|
if (!hte.addToTooltip(tooltip, mc.player.isSneaking()))
|
||||||
hoveringInformation = false;
|
hoveringInformation = false;
|
||||||
@ -79,7 +81,7 @@ public class GoggleOverlayRenderer {
|
|||||||
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
|
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
|
||||||
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
|
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
|
||||||
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
//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();
|
ItemStack item = AllItems.GOGGLES.asStack();
|
||||||
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
|
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
|
||||||
@ -95,9 +97,9 @@ public class GoggleOverlayRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Minecraft mc, int width, int height) {
|
public void init(Minecraft mc, int width, int height) {
|
||||||
this.minecraft = mc;
|
this.client = mc;
|
||||||
this.itemRenderer = mc.getItemRenderer();
|
this.itemRenderer = mc.getItemRenderer();
|
||||||
this.font = mc.fontRenderer;
|
this.textRenderer = mc.fontRenderer;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.simibubi.create.content.contraptions.goggles;
|
package com.simibubi.create.content.contraptions.goggles;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ public interface IHaveGoggleInformation {
|
|||||||
* @return {{@code true}} if the tooltip creation was successful and should be displayed,
|
* @return {{@code true}} if the tooltip creation was successful and should be displayed,
|
||||||
* or {{@code false}} if the overlay should not 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.simibubi.create.content.contraptions.goggles;
|
package com.simibubi.create.content.contraptions.goggles;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7,7 +9,7 @@ import java.util.List;
|
|||||||
* */
|
* */
|
||||||
public interface IHaveHoveringInformation {
|
public interface IHaveHoveringInformation {
|
||||||
|
|
||||||
default boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking){
|
default boolean addToTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleRenderType;
|
|||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.particles.BlockParticleData;
|
import net.minecraft.particles.BlockParticleData;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -25,7 +26,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||||||
|
|
||||||
private EncasedFanTileEntity source;
|
private EncasedFanTileEntity source;
|
||||||
|
|
||||||
protected AirFlowParticle(World world, EncasedFanTileEntity source, double x, double y, double z,
|
protected AirFlowParticle(ClientWorld world, EncasedFanTileEntity source, double x, double y, double z,
|
||||||
IAnimatedSprite sprite) {
|
IAnimatedSprite sprite) {
|
||||||
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
|
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
|
||||||
this.source = source;
|
this.source = source;
|
||||||
@ -159,7 +160,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||||||
this.spriteSet = animatedSprite;
|
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) {
|
double xSpeed, double ySpeed, double zSpeed) {
|
||||||
TileEntity te = worldIn.getTileEntity(new BlockPos(data.posX, data.posY, data.posZ));
|
TileEntity te = worldIn.getTileEntity(new BlockPos(data.posX, data.posY, data.posZ));
|
||||||
if (!(te instanceof EncasedFanTileEntity))
|
if (!(te instanceof EncasedFanTileEntity))
|
||||||
|
@ -9,10 +9,11 @@ import net.minecraft.client.particle.IParticleRenderType;
|
|||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class AirParticle extends SimpleAnimatedParticle {
|
public class AirParticle extends SimpleAnimatedParticle {
|
||||||
@ -24,7 +25,7 @@ public class AirParticle extends SimpleAnimatedParticle {
|
|||||||
private float twirlRadius, twirlAngleOffset;
|
private float twirlRadius, twirlAngleOffset;
|
||||||
private Axis twirlAxis;
|
private Axis twirlAxis;
|
||||||
|
|
||||||
protected AirParticle(World world, AirParticleData data, double x, double y, double z, double dx, double dy,
|
protected AirParticle(ClientWorld world, AirParticleData data, double x, double y, double z, double dx, double dy,
|
||||||
double dz, IAnimatedSprite sprite) {
|
double dz, IAnimatedSprite sprite) {
|
||||||
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
|
super(world, x, y, z, sprite, world.rand.nextFloat() * .5f);
|
||||||
particleScale *= 0.75F;
|
particleScale *= 0.75F;
|
||||||
@ -44,7 +45,7 @@ public class AirParticle extends SimpleAnimatedParticle {
|
|||||||
twirlAxis = Create.random.nextBoolean() ? Axis.X : Axis.Z;
|
twirlAxis = Create.random.nextBoolean() ? Axis.X : Axis.Z;
|
||||||
|
|
||||||
// speed in m/ticks
|
// 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);
|
selectSprite(7);
|
||||||
setAlphaF(.25f);
|
setAlphaF(.25f);
|
||||||
}
|
}
|
||||||
@ -65,7 +66,7 @@ public class AirParticle extends SimpleAnimatedParticle {
|
|||||||
|
|
||||||
float progress = (float) Math.pow(((float) age) / maxAge, drag);
|
float progress = (float) Math.pow(((float) age) / maxAge, drag);
|
||||||
float angle = (progress * 2 * 360 + twirlAngleOffset) % 360;
|
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 x = (float) (MathHelper.lerp(progress, originX, targetX) + twirl.x);
|
||||||
float y = (float) (MathHelper.lerp(progress, originY, targetY) + twirl.y);
|
float y = (float) (MathHelper.lerp(progress, originY, targetY) + twirl.y);
|
||||||
@ -95,7 +96,7 @@ public class AirParticle extends SimpleAnimatedParticle {
|
|||||||
this.spriteSet = animatedSprite;
|
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) {
|
double ySpeed, double zSpeed) {
|
||||||
return new AirParticle(worldIn, data, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
return new AirParticle(worldIn, data, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.simibubi.create.content.contraptions.particle;
|
package com.simibubi.create.content.contraptions.particle;
|
||||||
|
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
@ -84,7 +85,7 @@ public class CubeParticle extends Particle {
|
|||||||
protected float scale;
|
protected float scale;
|
||||||
protected boolean hot;
|
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);
|
super(world, x, y, z);
|
||||||
this.motionX = motionX;
|
this.motionX = motionX;
|
||||||
this.motionY = motionY;
|
this.motionY = motionY;
|
||||||
@ -113,9 +114,9 @@ public class CubeParticle extends Particle {
|
|||||||
if (this.hot && this.age > 0) {
|
if (this.hot && this.age > 0) {
|
||||||
if (this.prevPosY == this.posY) {
|
if (this.prevPosY == this.posY) {
|
||||||
billowing = true;
|
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) {
|
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.motionX = -diff.x * 0.1;
|
||||||
this.motionZ = -diff.z * 0.1;
|
this.motionZ = -diff.z * 0.1;
|
||||||
}
|
}
|
||||||
@ -170,7 +171,7 @@ public class CubeParticle extends Particle {
|
|||||||
public Factory() {}
|
public Factory() {}
|
||||||
|
|
||||||
@Override
|
@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) {
|
double motionY, double motionZ) {
|
||||||
CubeParticle particle = new CubeParticle(world, x, y, z, motionX, motionY, motionZ);
|
CubeParticle particle = new CubeParticle(world, x, y, z, motionX, motionY, motionZ);
|
||||||
particle.setColor(data.r, data.g, data.b);
|
particle.setColor(data.r, data.g, data.b);
|
||||||
|
@ -8,6 +8,7 @@ import net.minecraft.client.particle.IParticleFactory;
|
|||||||
import net.minecraft.client.particle.IParticleRenderType;
|
import net.minecraft.client.particle.IParticleRenderType;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ public class HeaterParticle extends SimpleAnimatedParticle {
|
|||||||
|
|
||||||
private final IAnimatedSprite animatedSprite;
|
private final IAnimatedSprite animatedSprite;
|
||||||
|
|
||||||
public HeaterParticle(World worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy,
|
public HeaterParticle(ClientWorld worldIn, float r, float g, float b, double x, double y, double z, double vx, double vy,
|
||||||
double vz, IAnimatedSprite spriteSet) {
|
double vz, IAnimatedSprite spriteSet) {
|
||||||
super(worldIn, x, y, z, spriteSet, worldIn.rand.nextFloat() * .5f);
|
super(worldIn, x, y, z, spriteSet, worldIn.rand.nextFloat() * .5f);
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ public class HeaterParticle extends SimpleAnimatedParticle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
double vy, double vz) {
|
||||||
return new HeaterParticle(worldIn, data.r, data.g, data.b, x, y, z, vx, vy, vz, this.spriteSet);
|
return new HeaterParticle(worldIn, data.r, data.g, data.b, x, y, z, vx, vy, vz, this.spriteSet);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.client.particle.IParticleFactory;
|
|||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -28,7 +29,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||||||
protected Vector3d offset;
|
protected Vector3d offset;
|
||||||
protected boolean isVisible;
|
protected boolean isVisible;
|
||||||
|
|
||||||
private RotationIndicatorParticle(World world, double x, double y, double z, int color, float radius1,
|
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) {
|
float radius2, float speed, Axis axis, int lifeSpan, boolean isVisible, IAnimatedSprite sprite) {
|
||||||
super(world, x, y, z, sprite, 0);
|
super(world, x, y, z, sprite, 0);
|
||||||
this.motionX = 0;
|
this.motionX = 0;
|
||||||
@ -82,7 +83,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||||||
this.spriteSet = animatedSprite;
|
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) {
|
double xSpeed, double ySpeed, double zSpeed) {
|
||||||
ClientPlayerEntity player = Minecraft.getInstance().player;
|
ClientPlayerEntity player = Minecraft.getInstance().player;
|
||||||
boolean visible = player != null && GogglesItem.canSeeParticles(player);
|
boolean visible = player != null && GogglesItem.canSeeParticles(player);
|
||||||
|
@ -75,21 +75,21 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
|
|||||||
@Override
|
@Override
|
||||||
public void onLanded(IBlockReader worldIn, Entity entityIn) {
|
public void onLanded(IBlockReader worldIn, Entity entityIn) {
|
||||||
super.onLanded(worldIn, entityIn);
|
super.onLanded(worldIn, entityIn);
|
||||||
if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getPosition())))
|
if (!AllBlocks.BASIN.has(worldIn.getBlockState(entityIn.getBlockPos())))
|
||||||
return;
|
return;
|
||||||
if (!(entityIn instanceof ItemEntity))
|
if (!(entityIn instanceof ItemEntity))
|
||||||
return;
|
return;
|
||||||
if (!entityIn.isAlive())
|
if (!entityIn.isAlive())
|
||||||
return;
|
return;
|
||||||
ItemEntity itemEntity = (ItemEntity) entityIn;
|
ItemEntity itemEntity = (ItemEntity) entityIn;
|
||||||
withTileEntityDo(worldIn, entityIn.getPosition(), te -> {
|
withTileEntityDo(worldIn, entityIn.getBlockPos(), te -> {
|
||||||
ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputInventory, itemEntity.getItem()
|
ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputInventory, itemEntity.getItem()
|
||||||
.copy(), false);
|
.copy(), false);
|
||||||
if (insertItem.isEmpty()) {
|
if (insertItem.isEmpty()) {
|
||||||
itemEntity.remove();
|
itemEntity.remove();
|
||||||
if (!itemEntity.world.isRemote)
|
if (!itemEntity.world.isRemote)
|
||||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world,
|
AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world,
|
||||||
itemEntity.getPosition(), 3);
|
itemEntity.getBlockPos(), 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import net.minecraft.tileentity.ITickableTileEntity;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
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.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
@ -54,7 +54,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||||||
@Override
|
@Override
|
||||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||||
behaviours.add(new DirectBeltInputBehaviour(this));
|
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)
|
.withCallback(newFilter -> contentsChanged = true)
|
||||||
.forRecipes();
|
.forRecipes();
|
||||||
behaviours.add(filtering);
|
behaviours.add(filtering);
|
||||||
@ -145,7 +145,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||||||
class BasinValueBox extends ValueBoxTransform.Sided {
|
class BasinValueBox extends ValueBoxTransform.Sided {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Vec3d getSouthLocation() {
|
protected Vector3d getSouthLocation() {
|
||||||
return VecHelper.voxelSpace(8, 12, 16);
|
return VecHelper.voxelSpace(8, 12, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import net.minecraft.util.SoundCategory;
|
|||||||
import net.minecraft.util.SoundEvents;
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraft.util.WeightedSpawnerEntity;
|
import net.minecraft.util.WeightedSpawnerEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.World;
|
||||||
import net.minecraft.world.spawner.AbstractSpawner;
|
import net.minecraft.world.spawner.AbstractSpawner;
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||||
@ -115,20 +115,20 @@ public class BlazeBurnerBlockItem extends BlockItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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())
|
if (hasCapturedBlaze())
|
||||||
return false;
|
return ActionResultType.PASS;
|
||||||
if (!(entity instanceof BlazeEntity))
|
if (!(entity instanceof BlazeEntity))
|
||||||
return false;
|
return ActionResultType.PASS;
|
||||||
|
|
||||||
World world = player.world;
|
World world = player.world;
|
||||||
spawnCaptureEffects(world, entity.getPositionVec());
|
spawnCaptureEffects(world, entity.getPositionVec());
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return true;
|
return ActionResultType.FAIL;
|
||||||
|
|
||||||
giveBurnerItemTo(player, heldItem, hand);
|
giveBurnerItemTo(player, heldItem, hand);
|
||||||
entity.remove();
|
entity.remove();
|
||||||
return true;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void giveBurnerItemTo(PlayerEntity player, ItemStack heldItem, Hand hand) {
|
protected void giveBurnerItemTo(PlayerEntity player, ItemStack heldItem, Hand hand) {
|
||||||
@ -142,12 +142,12 @@ public class BlazeBurnerBlockItem extends BlockItem {
|
|||||||
player.inventory.placeItemBackInInventory(player.world, filled);
|
player.inventory.placeItemBackInInventory(player.world, filled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnCaptureEffects(World world, Vec3d vec) {
|
private void spawnCaptureEffects(World world, Vector3d vec) {
|
||||||
if (world.isRemote) {
|
if (world.isRemote) {
|
||||||
for (int i = 0; i < 40; i++) {
|
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);
|
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()
|
.normalize()
|
||||||
.scale(.5f);
|
.scale(.5f);
|
||||||
world.addParticle(ParticleTypes.SMOKE, circle.x, vec.y, circle.z, 0, -0.125, 0);
|
world.addParticle(ParticleTypes.SMOKE, circle.x, vec.y, circle.z, 0, -0.125, 0);
|
||||||
|
@ -25,7 +25,7 @@ import net.minecraft.util.SoundCategory;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
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.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||||
@ -232,22 +232,22 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
|||||||
if (r.nextDouble() > 0.25)
|
if (r.nextDouble() > 0.25)
|
||||||
return;
|
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);
|
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) {
|
} else if (heatLevel == BlazeBurnerBlock.HeatLevel.FADING) {
|
||||||
if (r.nextDouble() > 0.5)
|
if (r.nextDouble() > 0.5)
|
||||||
return;
|
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);
|
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) {
|
} 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);
|
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) {
|
}else if (heatLevel == BlazeBurnerBlock.HeatLevel.SEETHING) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (r.nextDouble() > 0.6)
|
if (r.nextDouble() > 0.6)
|
||||||
return;
|
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);
|
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);
|
0.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vec3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) {
|
private static Vector3d randomColor(BlazeBurnerBlock.HeatLevel heatLevel) {
|
||||||
if (heatLevel == BlazeBurnerBlock.HeatLevel.NONE)
|
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)]);
|
return ColorHelper.getRGB(heatParticleColors[heatLevel.ordinal()-1][(int) (Math.random()*4)]);
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
event.getThrowable().setMotion(Vec3d.ZERO);
|
event.getThrowable().setMotion(Vector3d.ZERO);
|
||||||
event.getThrowable().remove();
|
event.getThrowable().remove();
|
||||||
|
|
||||||
BlazeBurnerTileEntity heater = (BlazeBurnerTileEntity) tile;
|
BlazeBurnerTileEntity heater = (BlazeBurnerTileEntity) tile;
|
||||||
|
@ -50,11 +50,6 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
|||||||
attachKinetics();
|
attachKinetics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasFastRenderer() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getConveyedSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
|
public static float getConveyedSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
|
||||||
boolean targetingController) {
|
boolean targetingController) {
|
||||||
if (!(speedControllerIn instanceof SpeedControllerTileEntity))
|
if (!(speedControllerIn instanceof SpeedControllerTileEntity))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
|
package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||||
@ -111,7 +112,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||||
int hFontColor = 0xD3CBBE;
|
int hFontColor = 0xD3CBBE;
|
||||||
background.draw(this, guiLeft, guiTop);
|
background.draw(this, guiLeft, guiTop);
|
||||||
|
|
||||||
@ -124,14 +125,14 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||||||
SequencerInstructions def = instruction.instruction;
|
SequencerInstructions def = instruction.instruction;
|
||||||
def.background.draw(guiLeft + 14, guiTop + 29 + yOffset);
|
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) {
|
if (def.hasValueParameter) {
|
||||||
String text = def.formatValue(instruction.value);
|
String text = def.formatValue(instruction.value);
|
||||||
int stringWidth = font.getStringWidth(text);
|
int stringWidth = textRenderer.getStringWidth(text);
|
||||||
label(85 + (12 - stringWidth / 2), 6 + yOffset, text);
|
label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text);
|
||||||
}
|
}
|
||||||
if (def.hasSpeedParameter)
|
if (def.hasSpeedParameter)
|
||||||
label(120, 6 + yOffset, instruction.speedModifier.label);
|
label(matrixStack, 120, 6 + yOffset, instruction.speedModifier.label);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||||||
toDraw.draw(guiLeft + 14, guiTop + 29 + yOffset);
|
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);
|
hFontColor);
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
@ -148,8 +149,8 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||||||
.render();
|
.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void label(int x, int y, String text) {
|
private void label(MatrixStack matrixStack, int x, int y, String text) {
|
||||||
font.drawStringWithShadow(text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
|
textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket() {
|
public void sendPacket() {
|
||||||
|
@ -110,10 +110,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||||||
return AllItems.BELT_CONNECTOR.asStack();
|
return AllItems.BELT_CONNECTOR.asStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME
|
||||||
@Override
|
@Override
|
||||||
public Material getMaterial(BlockState state) {
|
public Material getMaterial(BlockState state) {
|
||||||
return state.get(CASING) ? Material.WOOD : Material.WOOL;
|
return state.get(CASING) ? Material.WOOD : Material.WOOL;
|
||||||
}
|
} */
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
@ -142,7 +143,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||||||
@Override
|
@Override
|
||||||
public void onLanded(IBlockReader worldIn, Entity entityIn) {
|
public void onLanded(IBlockReader worldIn, Entity entityIn) {
|
||||||
super.onLanded(worldIn, entityIn);
|
super.onLanded(worldIn, entityIn);
|
||||||
BlockPos entityPosition = entityIn.getPosition();
|
BlockPos entityPosition = entityIn.getBlockPos();
|
||||||
BlockPos beltPos = null;
|
BlockPos beltPos = null;
|
||||||
|
|
||||||
if (AllBlocks.BELT.has(worldIn.getBlockState(entityPosition)))
|
if (AllBlocks.BELT.has(worldIn.getBlockState(entityPosition)))
|
||||||
@ -196,7 +197,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||||||
return;
|
return;
|
||||||
if (controller.passengers.containsKey(entityIn)) {
|
if (controller.passengers.containsKey(entityIn)) {
|
||||||
TransportedEntityInfo info = controller.passengers.get(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);
|
info.refresh(pos, state);
|
||||||
} else {
|
} else {
|
||||||
controller.passengers.put(entityIn, new TransportedEntityInfo(pos, state));
|
controller.passengers.put(entityIn, new TransportedEntityInfo(pos, state));
|
||||||
|
@ -63,8 +63,8 @@ public class BeltGenerator extends SpecialBlockStateGen {
|
|||||||
slope = BeltSlope.SIDEWAYS;
|
slope = BeltSlope.SIDEWAYS;
|
||||||
|
|
||||||
String path = "block/" + (casing ? "belt_casing/" : "belt/");
|
String path = "block/" + (casing ? "belt_casing/" : "belt/");
|
||||||
String slopeName = slope.getName();
|
String slopeName = slope.getString();
|
||||||
String partName = part.getName();
|
String partName = part.getString();
|
||||||
|
|
||||||
if (diagonal)
|
if (diagonal)
|
||||||
slopeName = "diagonal";
|
slopeName = "diagonal";
|
||||||
|
@ -49,7 +49,7 @@ public class BeltModel extends BakedModelWrapper<IBakedModel> {
|
|||||||
TextureAtlasSprite original = quad.getSprite();
|
TextureAtlasSprite original = quad.getSprite();
|
||||||
TextureAtlasSprite target = spriteShift.getTarget();
|
TextureAtlasSprite target = spriteShift.getTarget();
|
||||||
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
|
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;
|
VertexFormat format = DefaultVertexFormats.BLOCK;
|
||||||
int[] vertexData = newQuad.getVertexData();
|
int[] vertexData = newQuad.getVertexData();
|
||||||
|
@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.ItemRenderer;
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.settings.GraphicsFanciness;
|
||||||
import net.minecraft.util.math.vector.Vector3f;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
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;
|
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
|
||||||
Random r = new Random(transported.angle);
|
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)
|
Vector3d shadowPos = Vector3d.of(te.getPos()).add(beltStartOffset.scale(1)
|
||||||
.add(offsetVec)
|
.add(offsetVec)
|
||||||
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
||||||
@ -217,9 +218,9 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||||||
if (renderUpright) {
|
if (renderUpright) {
|
||||||
Entity renderViewEntity = Minecraft.getInstance().renderViewEntity;
|
Entity renderViewEntity = Minecraft.getInstance().renderViewEntity;
|
||||||
if (renderViewEntity != null) {
|
if (renderViewEntity != null) {
|
||||||
Vec3d positionVec = renderViewEntity.getPositionVec();
|
Vector3d positionVec = renderViewEntity.getPositionVec();
|
||||||
Vec3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset);
|
Vector3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset);
|
||||||
Vec3d diff = vectorForOffset.subtract(positionVec);
|
Vector3d diff = vectorForOffset.subtract(positionVec);
|
||||||
float yRot = (float) MathHelper.atan2(diff.z, -diff.x);
|
float yRot = (float) MathHelper.atan2(diff.z, -diff.x);
|
||||||
ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2)));
|
ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2)));
|
||||||
}
|
}
|
||||||
|
@ -154,11 +154,6 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||||||
itemHandler = LazyOptional.of(() -> handler);
|
itemHandler = LazyOptional.of(() -> handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasFastRenderer() {
|
|
||||||
return !isController();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
|
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
|
||||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
|
@ -8,6 +8,7 @@ import com.simibubi.create.AllItems;
|
|||||||
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -50,8 +51,7 @@ public class BeltConnectorHandler {
|
|||||||
|
|
||||||
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
BlockPos first = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||||
|
|
||||||
if (!world.getBlockState(first)
|
if (!BlockHelper.hasBlockStateProperty(world.getBlockState(first), BlockStateProperties.AXIS))
|
||||||
.has(BlockStateProperties.AXIS))
|
|
||||||
continue;
|
continue;
|
||||||
Axis axis = world.getBlockState(first)
|
Axis axis = world.getBlockState(first)
|
||||||
.get(BlockStateProperties.AXIS);
|
.get(BlockStateProperties.AXIS);
|
||||||
|
@ -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.filtering.FilteringBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -43,7 +44,7 @@ public class BeltFunnelInteractionHandler {
|
|||||||
return blocking;
|
return blocking;
|
||||||
if (funnelState.get(BeltFunnelBlock.PUSHING))
|
if (funnelState.get(BeltFunnelBlock.PUSHING))
|
||||||
return blocking;
|
return blocking;
|
||||||
if (funnelState.has(BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED))
|
if (BlockHelper.hasBlockStateProperty(funnelState, BeltFunnelBlock.POWERED) && funnelState.get(BeltFunnelBlock.POWERED))
|
||||||
return blocking;
|
return blocking;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(funnelPos);
|
TileEntity te = world.getTileEntity(funnelPos);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user