mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Actually port
This commit is contained in:
parent
08562d2689
commit
716f79872c
8 changed files with 31 additions and 30 deletions
|
@ -77,10 +77,6 @@ public class AssemblyException extends Exception {
|
|||
return new AssemblyException("noPistonPoles");
|
||||
}
|
||||
|
||||
public String getFormattedText() {
|
||||
return component.getFormattedText();
|
||||
}
|
||||
|
||||
public boolean hasPosition() {
|
||||
return position != null;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||
|
||||
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -9,17 +12,17 @@ import java.util.List;
|
|||
|
||||
public interface IDisplayAssemblyExceptions {
|
||||
|
||||
default boolean addExceptionToTooltip(List<String> tooltip) {
|
||||
default boolean addExceptionToTooltip(List<ITextComponent> tooltip) {
|
||||
AssemblyException e = getLastAssemblyException();
|
||||
if (e == null)
|
||||
return false;
|
||||
|
||||
if (!tooltip.isEmpty())
|
||||
tooltip.add("");
|
||||
tooltip.add(StringTextComponent.EMPTY);
|
||||
|
||||
tooltip.add(IHaveGoggleInformation.spacing + TextFormatting.GOLD + Lang.translate("gui.assembly.exception"));
|
||||
String text = e.getFormattedText();
|
||||
Arrays.stream(text.split("\n")).forEach(l -> tooltip.add(IHaveGoggleInformation.spacing + TextFormatting.GRAY + l));
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(Lang.translate("gui.assembly.exception").formatted(TextFormatting.GOLD)));
|
||||
String text = TooltipHelper.getUnformattedDeepText(e.component);
|
||||
Arrays.stream(text.split("\n")).forEach(l -> tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(new StringTextComponent(l).setStyle(e.component.getStyle()).formatted(TextFormatting.GRAY))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -183,10 +183,10 @@ public class SailBlock extends ProperDirectionalBlock {
|
|||
}
|
||||
|
||||
private void bounce(Entity p_226860_1_) {
|
||||
Vector3d vec3d = p_226860_1_.getMotion();
|
||||
if (vec3d.y < 0.0D) {
|
||||
Vector3d Vector3d = p_226860_1_.getMotion();
|
||||
if (Vector3d.y < 0.0D) {
|
||||
double d0 = p_226860_1_ instanceof LivingEntity ? 1.0D : 0.8D;
|
||||
p_226860_1_.setMotion(vec3d.x, -vec3d.y * (double) 0.26F * d0, vec3d.z);
|
||||
p_226860_1_.setMotion(Vector3d.x, -Vector3d.y * (double) 0.26F * d0, Vector3d.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -109,9 +109,9 @@ public class GantryPinionTileEntity extends KineticTileEntity implements IDispla
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOpt
|
|||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -55,9 +56,9 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -424,12 +424,12 @@ public class PipeConnection {
|
|||
// if (inbound)
|
||||
// return;
|
||||
//
|
||||
// Vec3d directionVec = new Vec3d(side.getDirectionVec());
|
||||
// Vec3d scaleVec = directionVec.scale(-.25f * side.getAxisDirection()
|
||||
// Vector3d directionVec = new Vector3d(side.getDirectionVec());
|
||||
// Vector3d scaleVec = directionVec.scale(-.25f * side.getAxisDirection()
|
||||
// .getOffset());
|
||||
// directionVec = directionVec.scale(inbound ? .35f : .45f);
|
||||
// CreateClient.outliner.chaseAABB("pressure" + pos.toShortString() + side.getName() + String.valueOf(inbound),
|
||||
// FluidPropagator.smallCenter.offset(directionVec.add(new Vec3d(pos)))
|
||||
// FluidPropagator.smallCenter.offset(directionVec.add(new Vector3d(pos)))
|
||||
// .grow(scaleVec.x, scaleVec.y, scaleVec.z)
|
||||
// .expand(0, pressure / 64f, 0)
|
||||
// .grow(1 / 64f));
|
||||
|
@ -440,7 +440,7 @@ public class PipeConnection {
|
|||
// if (!hasFlow())
|
||||
// return;
|
||||
//
|
||||
// Vec3d directionVec = new Vec3d(side.getDirectionVec());
|
||||
// Vector3d directionVec = new Vector3d(side.getDirectionVec());
|
||||
// float size = 1 / 4f;
|
||||
// float length = .5f;
|
||||
// Flow flow = this.flow.get();
|
||||
|
@ -450,11 +450,11 @@ public class PipeConnection {
|
|||
// if (flow.progress == null)
|
||||
// return;
|
||||
// float value = flow.progress.getValue();
|
||||
// Vec3d start = directionVec.scale(inbound ? .5 : .5f - length);
|
||||
// Vec3d offset = directionVec.scale(length * (inbound ? -1 : 1))
|
||||
// Vector3d start = directionVec.scale(inbound ? .5 : .5f - length);
|
||||
// Vector3d offset = directionVec.scale(length * (inbound ? -1 : 1))
|
||||
// .scale(value);
|
||||
//
|
||||
// Vec3d scale = new Vec3d(1, 1, 1).subtract(directionVec.scale(side.getAxisDirection()
|
||||
// Vector3d scale = new Vector3d(1, 1, 1).subtract(directionVec.scale(side.getAxisDirection()
|
||||
// .getOffset()))
|
||||
// .scale(size);
|
||||
// AxisAlignedBB bb = new AxisAlignedBB(start, start.add(offset)).offset(VecHelper.getCenterOf(pos))
|
||||
|
|
|
@ -48,7 +48,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
|
|||
|
||||
// if (!funnelFacing.getAxis()
|
||||
// .isHorizontal()) {
|
||||
// Vec3d southLocation = VecHelper.voxelSpace(8, funnelFacing == Direction.DOWN ? 3 : 13, 15.5f);
|
||||
// Vector3d southLocation = VecHelper.voxelSpace(8, funnelFacing == Direction.DOWN ? 3 : 13, 15.5f);
|
||||
// return VecHelper.rotateCentered(southLocation, horizontalAngle, Axis.Y);
|
||||
// }
|
||||
//
|
||||
|
@ -61,7 +61,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
|
|||
// boolean alongX = funnelFacing.getAxis() == Axis.X;
|
||||
// float zRotLast = alongX ^ funnelFacing.getAxisDirection() == AxisDirection.POSITIVE ? 180 : 0;
|
||||
//
|
||||
// Vec3d vec = VecHelper.voxelSpace(8, 13, .5f);
|
||||
// Vector3d vec = VecHelper.voxelSpace(8, 13, .5f);
|
||||
// vec = vec.subtract(.5, .5, .5);
|
||||
// vec = VecHelper.rotate(vec, zRotLast, Axis.Z);
|
||||
// vec = VecHelper.rotate(vec, yRot, Axis.Y);
|
||||
|
|
|
@ -9,12 +9,13 @@ import net.minecraft.command.CommandSource;
|
|||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.command.arguments.BlockPosArgument;
|
||||
import net.minecraft.command.arguments.EntityArgument;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.fml.network.PacketDistributor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -65,10 +66,10 @@ public class HighlightCommand {
|
|||
}
|
||||
|
||||
private static int highlightAssemblyExceptionFor(ServerPlayerEntity player, CommandSource source) {
|
||||
double distance = player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue();
|
||||
Vec3d start = player.getEyePosition(1);
|
||||
Vec3d look = player.getLook(1);
|
||||
Vec3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
||||
double distance = player.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue();
|
||||
Vector3d start = player.getEyePosition(1);
|
||||
Vector3d look = player.getLook(1);
|
||||
Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
||||
World world = player.world;
|
||||
|
||||
BlockRayTraceResult ray = world.rayTraceBlocks(new RayTraceContext(start, end, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player));
|
||||
|
|
Loading…
Reference in a new issue