mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 03:53:12 +01:00
Prospective 1.16 port start - only find/replace fixes so far
This commit is contained in:
parent
f5af1cd81e
commit
c1f68ab830
232 changed files with 1173 additions and 1162 deletions
|
@ -29,7 +29,7 @@ archivesBaseName = 'create'
|
|||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: '20200301-mixed-1.15.2'
|
||||
mappings channel: 'snapshot', version: '20200722-mixed-1.16.1'
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
runs {
|
||||
|
|
|
@ -5,12 +5,12 @@ org.gradle.daemon=false
|
|||
|
||||
# mod version info
|
||||
mod_version=0.3
|
||||
minecraft_version=1.15.2
|
||||
forge_version=31.2.31
|
||||
minecraft_version=1.16.1
|
||||
forge_version=32.0.70
|
||||
|
||||
# dependency versions
|
||||
registrate_version=0.0.4.18
|
||||
jei_version=6.0.0.2
|
||||
registrate_version=1.0.0-beta.1
|
||||
jei_version=7.0.0.6
|
||||
|
||||
# curseforge information
|
||||
projectId=328085
|
||||
|
|
|
@ -111,7 +111,7 @@ public class AllBlockPartials {
|
|||
|
||||
private static void populateMaps() {
|
||||
for (Direction d : Iterate.directions) {
|
||||
PIPE_RIMS.put(d, get("fluid_pipe/rim/" + d.getName()));
|
||||
PIPE_RIMS.put(d, get("fluid_pipe/rim/" + d.getString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ import com.simibubi.create.foundation.worldgen.OxidizingBlock;
|
|||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.SoundType;
|
||||
|
@ -212,7 +213,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
|
||||
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
|
@ -221,7 +222,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
|
@ -230,7 +231,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
|
@ -239,7 +240,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
|
@ -249,7 +250,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<EncasedBeltBlock> ENCASED_BELT =
|
||||
REGISTRATE.block("encased_belt", EncasedBeltBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
|
||||
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
|
||||
|
@ -260,7 +261,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_PULLEY =
|
||||
REGISTRATE.block("adjustable_pulley", AdjustablePulleyBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
|
||||
String powered = state.get(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
|
||||
|
@ -295,7 +296,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.horizontalWheelProvider(false))
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.transform(StressConfigDefaults.setCapacity(16.0))
|
||||
|
@ -359,7 +360,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL =
|
||||
REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.transform(StressConfigDefaults.setImpact(8.0))
|
||||
|
@ -379,7 +380,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS =
|
||||
REGISTRATE.block("mechanical_press", MechanicalPressBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||
.transform(StressConfigDefaults.setImpact(8.0))
|
||||
.item(BasinOperatorBlockItem::new)
|
||||
|
@ -389,7 +390,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER =
|
||||
REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.transform(StressConfigDefaults.setImpact(4.0))
|
||||
|
@ -464,7 +465,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(new FluidTankGenerator()::generate)
|
||||
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::new))
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
|
@ -541,7 +542,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER =
|
||||
REGISTRATE.block("cart_assembler", CartAssemblerBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.cartAssembler())
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.tag(BlockTags.RAILS)
|
||||
|
@ -552,7 +553,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL =
|
||||
REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.reinforcedRail())
|
||||
.addLayer(() -> RenderType::getCutoutMipped)
|
||||
.tag(BlockTags.RAILS)
|
||||
|
@ -679,7 +680,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER =
|
||||
REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate(BlockStateGen.horizontalBlockProvider(true))
|
||||
.transform(StressConfigDefaults.setImpact(2.0))
|
||||
.onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour()))
|
||||
|
@ -691,7 +692,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<SequencedGearshiftBlock> SEQUENCED_GEARSHIFT =
|
||||
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
|
||||
.initialProperties(SharedProperties::stone)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new SequencedGearshiftGenerator()::generate)
|
||||
.item()
|
||||
|
@ -700,7 +701,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.transform(StressConfigDefaults.setNoImpact())
|
||||
.blockstate(new FlywheelGenerator()::generate)
|
||||
.item()
|
||||
|
@ -851,7 +852,7 @@ public class AllBlocks {
|
|||
public static final BlockEntry<PackagerBlock> PACKAGER = REGISTRATE.block("packager", PackagerBlock::new)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.transform(StressConfigDefaults.setImpact(4.0))
|
||||
.properties(Block.Properties::nonOpaque)
|
||||
.properties(AbstractBlock.Properties::nonOpaque)
|
||||
.blockstate((c, p) -> p.getVariantBuilder(c.get())
|
||||
.forAllStates(s -> ConfiguredModel.builder()
|
||||
.modelFile(AssetLookup.partialBaseModel(c, p))
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.GrassColors;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraft.world.biome.BiomeColors;
|
||||
|
||||
public class AllColorHandlers {
|
||||
|
@ -92,7 +92,7 @@ public class AllColorHandlers {
|
|||
|
||||
@FunctionalInterface
|
||||
interface Function {
|
||||
int apply(BlockState state, ILightReader world, BlockPos pos, int layer);
|
||||
int apply(BlockState state, IBlockDisplayReader world, BlockPos pos, int layer);
|
||||
}
|
||||
|
||||
public BlockColor(Function function) {
|
||||
|
@ -100,7 +100,7 @@ public class AllColorHandlers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getColor(BlockState state, ILightReader world, BlockPos pos, int layer) {
|
||||
public int getColor(BlockState state, IBlockDisplayReader world, BlockPos pos, int layer) {
|
||||
return function.apply(state, world, pos, layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,9 @@ public enum AllKeys {
|
|||
return keybind.isKeyDown();
|
||||
}
|
||||
|
||||
// TODO this should return ITextComponent
|
||||
public String getBoundKey() {
|
||||
return keybind.getLocalizedName().toUpperCase();
|
||||
return keybind.getBoundKeyLocalizedText().getUnformattedComponentText().toUpperCase();
|
||||
}
|
||||
|
||||
public int getBoundCode() {
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.client.renderer.ActiveRenderInfo;
|
|||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
|
||||
|
@ -65,7 +65,7 @@ public class ClientEvents {
|
|||
public static void onRenderWorld(RenderWorldLastEvent event) {
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getActiveRenderInfo();
|
||||
Vec3d view = info.getProjectedView();
|
||||
Vector3d view = info.getProjectedView();
|
||||
|
||||
ms.push();
|
||||
ms.translate(-view.getX(), -view.getY(), -view.getZ());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ScreenResourceWrapper implements IDrawable {
|
|||
@Override
|
||||
public void draw(int xOffset, int yOffset) {
|
||||
resource.bind();
|
||||
AbstractGui.blit(xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256,
|
||||
AbstractGui.drawTexture(xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256,
|
||||
256);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.Direction.AxisDirection;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -44,9 +44,9 @@ public class KineticDebugger {
|
|||
|
||||
if (state.getBlock() instanceof IRotate) {
|
||||
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
||||
Vec3d vec = new Vec3d(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
||||
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
||||
.getDirectionVec());
|
||||
Vec3d center = VecHelper.getCenterOf(te.getPos());
|
||||
Vector3d center = VecHelper.getCenterOf(te.getPos());
|
||||
CreateClient.outliner.showLine("rotationAxis", center.add(vec), center.subtract(vec))
|
||||
.lineWidth(1 / 16f);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -16,7 +16,7 @@ import net.minecraft.world.IWorldReader;
|
|||
|
||||
public abstract class HorizontalAxisKineticBlock extends KineticBlock {
|
||||
|
||||
public static final IProperty<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS;
|
||||
public static final Property<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS;
|
||||
|
||||
public HorizontalAxisKineticBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -12,7 +12,7 @@ import net.minecraft.util.Rotation;
|
|||
|
||||
public abstract class HorizontalKineticBlock extends KineticBlock {
|
||||
|
||||
public static final IProperty<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
public static final Property<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
public HorizontalKineticBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.particles.IParticleData;
|
|||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
@ -66,8 +66,8 @@ public class KineticEffectHandler {
|
|||
return;
|
||||
Random r = world.rand;
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, r, maxMotion);
|
||||
Vec3d position = VecHelper.getCenterOf(kte.getPos());
|
||||
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, r, maxMotion);
|
||||
Vector3d position = VecHelper.getCenterOf(kte.getPos());
|
||||
world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class KineticEffectHandler {
|
|||
return;
|
||||
|
||||
char axisChar = axis.name().charAt(0);
|
||||
Vec3d vec = VecHelper.getCenterOf(pos);
|
||||
Vector3d vec = VecHelper.getCenterOf(pos);
|
||||
SpeedLevel speedLevel = SpeedLevel.of(speed);
|
||||
int color = speedLevel.getColor();
|
||||
int particleSpeed = speedLevel.getParticleSpeed();
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.block.AirBlock;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
@ -17,7 +17,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
@ -135,17 +135,17 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
public void onBlockBroken(BlockState stateToBreak) {
|
||||
IFluidState ifluidstate = world.getFluidState(breakingPos);
|
||||
FluidState ifluidstate = world.getFluidState(breakingPos);
|
||||
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak));
|
||||
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null;
|
||||
Vec3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
|
||||
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f);
|
||||
|
||||
Block.getDrops(stateToBreak, (ServerWorld) world, breakingPos, tileentity).forEach((stack) -> {
|
||||
if (!stack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)
|
||||
&& !world.restoringBlockSnapshots) {
|
||||
ItemEntity itementity = new ItemEntity(world, vec.x, vec.y, vec.z, stack);
|
||||
itementity.setDefaultPickupDelay();
|
||||
itementity.setMotion(Vec3d.ZERO);
|
||||
itementity.setMotion(Vector3d.ZERO);
|
||||
world.addEntity(itementity);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
||||
|
@ -64,7 +64,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
|||
if (damageSource != null && !world.isRemote)
|
||||
entity.attackEntityFrom(damageSource, damage);
|
||||
if (throwsEntities() && (world.isRemote == (entity instanceof PlayerEntity))) {
|
||||
Vec3d motionBoost = context.motion.add(0, context.motion.length() / 4f, 0);
|
||||
Vector3d motionBoost = context.motion.add(0, context.motion.length() / 4f, 0);
|
||||
int maxBoost = 4;
|
||||
if (motionBoost.length() > maxBoost) {
|
||||
motionBoost = motionBoost.subtract(motionBoost.normalize().scale(motionBoost.length() - maxBoost));
|
||||
|
@ -131,7 +131,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
|||
return;
|
||||
if (!data.contains("BreakingPos"))
|
||||
return;
|
||||
if (context.relativeMotion.equals(Vec3d.ZERO)) {
|
||||
if (context.relativeMotion.equals(Vector3d.ZERO)) {
|
||||
context.stall = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -22,8 +22,8 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(DrillBlock.FACING)
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(DrillBlock.FACING)
|
||||
.getDirectionVec()).scale(.65f);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ import net.minecraft.block.KelpBlock;
|
|||
import net.minecraft.block.SugarCaneBlock;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
|
@ -41,8 +41,8 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(HORIZONTAL_FACING)
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(HORIZONTAL_FACING)
|
||||
.getDirectionVec()).scale(.45);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
}
|
||||
if (state.getCollisionShape(world, pos)
|
||||
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
|
||||
for (IProperty<?> property : state.getProperties()) {
|
||||
for (Property<?> property : state.getProperties()) {
|
||||
if (!(property instanceof IntegerProperty))
|
||||
continue;
|
||||
if (!property.getName()
|
||||
|
@ -109,7 +109,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
if (state.getCollisionShape(world, pos)
|
||||
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
|
||||
for (IProperty<?> property : state.getProperties()) {
|
||||
for (Property<?> property : state.getProperties()) {
|
||||
if (!(property instanceof IntegerProperty))
|
||||
continue;
|
||||
if (!property.getName()
|
||||
|
@ -141,7 +141,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
}
|
||||
if (state.getCollisionShape(world, pos)
|
||||
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
|
||||
for (IProperty<?> property : state.getProperties()) {
|
||||
for (Property<?> property : state.getProperties()) {
|
||||
if (!(property instanceof IntegerProperty))
|
||||
continue;
|
||||
if (!property.getName()
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> {
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
|
|||
float time = AnimationTickHolder.getRenderTick() / 20;
|
||||
float angle = (time * speed) % 360;
|
||||
float originOffset = 1 / 16f;
|
||||
Vec3d rotOffset = new Vec3d(0, -2 * originOffset, originOffset).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||
Vector3d rotOffset = new Vector3d(0, -2 * originOffset, originOffset).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||
|
||||
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
||||
.translate(rotOffset.x, rotOffset.y, rotOffset.z)
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.math.RayTraceContext;
|
|||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
if (!world.isBlockPresent(below))
|
||||
return;
|
||||
|
||||
Vec3d vec = VecHelper.getCenterOf(pos);
|
||||
Vector3d vec = VecHelper.getCenterOf(pos);
|
||||
PloughFakePlayer player = getPlayer(context);
|
||||
|
||||
if (player == null)
|
||||
|
@ -57,8 +57,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(HORIZONTAL_FACING)
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(HORIZONTAL_FACING)
|
||||
.getDirectionVec()).scale(.45);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
|
@ -26,8 +26,8 @@ public class SawMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(SawBlock.FACING).getDirectionVec()).scale(.65f);
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(SawBlock.FACING).getDirectionVec()).scale(.65f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +55,7 @@ public class SawMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
return;
|
||||
|
||||
World world = context.world;
|
||||
Vec3d dropPos = VecHelper.getCenterOf(pos);
|
||||
Vector3d dropPos = VecHelper.getCenterOf(pos);
|
||||
float distance = (float) dropPos.distanceTo(context.position);
|
||||
ItemEntity entity = new ItemEntity(world, dropPos.x, dropPos.y, dropPos.z, remainder);
|
||||
entity.setMotion(context.relativeMotion.scale(distance / 20f));
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
@ -31,8 +31,8 @@ public class StorageInterfaceMovement extends MovementBehaviour {
|
|||
private static final String _workingPos_ = "WorkingPos";
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class StorageInterfaceMovement extends MovementBehaviour {
|
|||
}
|
||||
|
||||
private Direction getCurrentFacing(MovementContext context) {
|
||||
Vec3d directionVec = new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec());
|
||||
Vector3d directionVec = Vector3d.of(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec());
|
||||
directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z);
|
||||
return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.Explosion;
|
||||
|
||||
public class CuckooClockTileEntity extends KineticTileEntity {
|
||||
|
@ -81,7 +81,7 @@ public class CuckooClockTileEntity extends KineticTileEntity {
|
|||
animationType = Animation.NONE;
|
||||
|
||||
if (animationType == Animation.SURPRISE && animationProgress.value == 50) {
|
||||
Vec3d center = VecHelper.getCenterOf(pos);
|
||||
Vector3d center = VecHelper.getCenterOf(pos);
|
||||
world.destroyBlock(pos, false);
|
||||
world.createExplosion(null, CUCKOO_SURPRISE, center.x, center.y, center.z, 3, false,
|
||||
Explosion.Mode.BREAK);
|
||||
|
@ -114,7 +114,7 @@ public class CuckooClockTileEntity extends KineticTileEntity {
|
|||
playSound(SoundEvents.BLOCK_NOTE_BLOCK_CHIME, 2, 0.793701f);
|
||||
|
||||
if (value > 30 && isSurprise) {
|
||||
Vec3d pos = VecHelper.offsetRandomly(VecHelper.getCenterOf(this.pos), world.rand, .5f);
|
||||
Vector3d pos = VecHelper.offsetRandomly(VecHelper.getCenterOf(this.pos), world.rand, .5f);
|
||||
world.addParticle(ParticleTypes.LARGE_SMOKE, pos.x, pos.y, pos.z, 0, 0, 0);
|
||||
}
|
||||
if (value == 40 && isSurprise)
|
||||
|
@ -163,7 +163,7 @@ public class CuckooClockTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
private void playSound(SoundEvent sound, float volume, float pitch) {
|
||||
Vec3d vec = VecHelper.getCenterOf(pos);
|
||||
Vector3d vec = VecHelper.getCenterOf(pos);
|
||||
world.playSound(vec.x, vec.y, vec.z, sound, SoundCategory.BLOCKS, volume, pitch, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
public class CrafterCTBehaviour extends ConnectedTextureBehaviour {
|
||||
|
||||
@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) {
|
||||
if (state.getBlock() != other.getBlock())
|
||||
return false;
|
||||
|
|
|
@ -2,18 +2,18 @@ package com.simibubi.create.content.contraptions.components.crafter;
|
|||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
public class CrafterHelper {
|
||||
|
||||
public static MechanicalCrafterTileEntity getCrafter(ILightReader reader, BlockPos pos) {
|
||||
public static MechanicalCrafterTileEntity getCrafter(IBlockDisplayReader reader, BlockPos pos) {
|
||||
TileEntity te = reader.getTileEntity(pos);
|
||||
if (!(te instanceof MechanicalCrafterTileEntity))
|
||||
return null;
|
||||
return (MechanicalCrafterTileEntity) te;
|
||||
}
|
||||
|
||||
public static ConnectedInputHandler.ConnectedInput getInput(ILightReader reader, BlockPos pos) {
|
||||
public static ConnectedInputHandler.ConnectedInput getInput(IBlockDisplayReader reader, BlockPos pos) {
|
||||
MechanicalCrafterTileEntity crafter = getCrafter(reader, pos);
|
||||
return crafter == null ? null : crafter.input;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.util.Direction.AxisDirection;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -243,7 +243,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
|
|||
return Direction.UP;
|
||||
Direction facing = state.get(HORIZONTAL_FACING);
|
||||
Pointing point = state.get(POINTING);
|
||||
Vec3d targetVec = new Vec3d(0, 1, 0);
|
||||
Vector3d targetVec = new Vector3d(0, 1, 0);
|
||||
targetVec = VecHelper.rotate(targetVec, -point.getXRotation(), Axis.Z);
|
||||
targetVec = VecHelper.rotate(targetVec, AngleHelper.horizontalAngle(facing), Axis.Y);
|
||||
return Direction.getFacingFromVector(targetVec.x, targetVec.y, targetVec.z);
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<MechanicalCrafterTileEntity> {
|
||||
|
||||
|
@ -42,14 +42,14 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
|||
ms.push();
|
||||
Direction facing = te.getBlockState()
|
||||
.get(HORIZONTAL_FACING);
|
||||
Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.58)
|
||||
Vector3d vec = Vector3d.of(facing.getDirectionVec()).scale(.58)
|
||||
.add(.5, .5, .5);
|
||||
|
||||
if (te.phase == Phase.EXPORTING) {
|
||||
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(te.getBlockState());
|
||||
float progress =
|
||||
MathHelper.clamp((1000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f, 0, 1);
|
||||
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(progress * .75f));
|
||||
vec = vec.add(Vector3d.of(targetDirection.getDirectionVec()).scale(progress * .75f));
|
||||
}
|
||||
|
||||
ms.translate(vec.x, vec.y, vec.z);
|
||||
|
@ -90,8 +90,8 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
|||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||
|
||||
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
||||
Vec3d centering =
|
||||
new Vec3d(-items.minX + (-items.width + 1) / 2f, -items.minY + (-items.height + 1) / 2f, 0)
|
||||
Vector3d centering =
|
||||
new Vector3d(-items.minX + (-items.width + 1) / 2f, -items.minY + (-items.height + 1) / 2f, 0)
|
||||
.scale(earlyProgress);
|
||||
ms.translate(centering.x * .5f, centering.y * .5f, 0);
|
||||
distance += (-4 * (progress - .5f) * (progress - .5f) + 1) * .25f;
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -164,10 +164,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
groupedItemsBeforeCraft = before;
|
||||
if (phaseBefore == Phase.EXPORTING && phase == Phase.WAITING) {
|
||||
Direction facing = getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING);
|
||||
Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.75)
|
||||
Vector3d vec = Vector3d.of(facing.getDirectionVec()).scale(.75)
|
||||
.add(VecHelper.getCenterOf(pos));
|
||||
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(getBlockState());
|
||||
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(1));
|
||||
vec = vec.add(Vector3d.of(targetDirection.getDirectionVec()).scale(1));
|
||||
world.addParticle(ParticleTypes.CRIT, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -289,10 +289,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
if (world.isRemote) {
|
||||
Direction facing = getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING);
|
||||
float progress = countDown / 2000f;
|
||||
Vec3d facingVec = new Vec3d(facing.getDirectionVec());
|
||||
Vec3d vec = facingVec.scale(.65)
|
||||
Vector3d facingVec = Vector3d.of(facing.getDirectionVec());
|
||||
Vector3d vec = facingVec.scale(.65)
|
||||
.add(VecHelper.getCenterOf(pos));
|
||||
Vec3d offset = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .125f)
|
||||
Vector3d offset = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .125f)
|
||||
.mul(VecHelper.planeByNormal(facingVec))
|
||||
.normalize()
|
||||
.scale(progress * .5f)
|
||||
|
@ -306,11 +306,11 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
groupedItemsBeforeCraft = new GroupedItems();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Vec3d randVec = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .125f)
|
||||
Vector3d randVec = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .125f)
|
||||
.mul(VecHelper.planeByNormal(facingVec))
|
||||
.normalize()
|
||||
.scale(.25f);
|
||||
Vec3d offset2 = randVec.add(vec);
|
||||
Vector3d offset2 = randVec.add(vec);
|
||||
randVec = randVec.scale(.35f);
|
||||
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, stack), offset2.x, offset2.y,
|
||||
offset2.z, randVec.x, randVec.y, randVec.z);
|
||||
|
@ -390,9 +390,9 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
public void eject() {
|
||||
BlockState blockState = getBlockState();
|
||||
boolean present = AllBlocks.MECHANICAL_CRAFTER.has(blockState);
|
||||
Vec3d vec = present ? new Vec3d(blockState.get(HORIZONTAL_FACING)
|
||||
.getDirectionVec()).scale(.75f) : Vec3d.ZERO;
|
||||
Vec3d ejectPos = VecHelper.getCenterOf(pos)
|
||||
Vector3d vec = present ? Vector3d.of(blockState.get(HORIZONTAL_FACING)
|
||||
.getDirectionVec()).scale(.75f) : Vector3d.ZERO;
|
||||
Vector3d ejectPos = VecHelper.getCenterOf(pos)
|
||||
.add(vec);
|
||||
groupedItems.grid.forEach((pair, stack) -> dropItem(ejectPos, stack));
|
||||
if (!inventory.getStackInSlot(0)
|
||||
|
@ -404,7 +404,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
sendData();
|
||||
}
|
||||
|
||||
public void dropItem(Vec3d ejectPos, ItemStack stack) {
|
||||
public void dropItem(Vector3d ejectPos, ItemStack stack) {
|
||||
ItemEntity itemEntity = new ItemEntity(world, ejectPos.x, ejectPos.y, ejectPos.z, stack);
|
||||
itemEntity.setDefaultPickupDelay();
|
||||
world.addEntity(itemEntity);
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
@ -73,7 +73,7 @@ public class CrushingWheelControllerBlock extends Block
|
|||
return;
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
if (te.processingEntity == entityIn)
|
||||
entityIn.setMotionMultiplier(state, new Vec3d(0.25D, (double) 0.05F, 0.25D));
|
||||
entityIn.setMotionMultiplier(state, new Vector3d(0.25D, (double) 0.05F, 0.25D));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -87,7 +87,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
return;
|
||||
|
||||
float speed = crushingspeed * 4;
|
||||
Vec3d outPos = VecHelper.getCenterOf(pos);
|
||||
Vector3d outPos = VecHelper.getCenterOf(pos);
|
||||
|
||||
if (!hasEntity()) {
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
if (stack.isEmpty())
|
||||
continue;
|
||||
ItemEntity entityIn = new ItemEntity(world, outPos.x, outPos.y, outPos.z, stack);
|
||||
entityIn.setMotion(Vec3d.ZERO);
|
||||
entityIn.setMotion(Vector3d.ZERO);
|
||||
entityIn.getPersistentData()
|
||||
.put("BypassCrushingWheel", NBTUtil.writeBlockPos(pos));
|
||||
world.addEntity(entityIn);
|
||||
|
@ -137,7 +137,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
if (processingEntity.isSneaking())
|
||||
xMotion = zMotion = 0;
|
||||
|
||||
processingEntity.setMotion(new Vec3d(xMotion, Math.max(-speed / 4f, -.5f), zMotion));
|
||||
processingEntity.setMotion(new Vector3d(xMotion, Math.max(-speed / 4f, -.5f), zMotion));
|
||||
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.network.play.ServerPlayNetHandler;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -74,8 +74,8 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getPositionVector() {
|
||||
return new Vec3d(getX(), getY(), getZ());
|
||||
public Vector3d getPositionVector() {
|
||||
return new Vector3d(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,14 +9,14 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class DeployerFilterSlot extends ValueBoxTransform {
|
||||
|
||||
@Override
|
||||
protected Vec3d getLocalOffset(BlockState state) {
|
||||
protected Vector3d getLocalOffset(BlockState state) {
|
||||
Direction facing = state.get(DeployerBlock.FACING);
|
||||
Vec3d vec = VecHelper.voxelSpace(8f, 13.5f, 11.5f);
|
||||
Vector3d vec = VecHelper.voxelSpace(8f, 13.5f, 11.5f);
|
||||
|
||||
float yRot = AngleHelper.horizontalAngle(facing);
|
||||
float zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
|
|
|
@ -43,7 +43,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
|||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
@ -99,7 +99,7 @@ public class DeployerHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void activate(DeployerFakePlayer player, Vec3d vec, BlockPos clickedPos, Vec3d extensionVector, Mode mode) {
|
||||
static void activate(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, Vector3d extensionVector, Mode mode) {
|
||||
Multimap<String, AttributeModifier> attributeModifiers = player.getHeldItemMainhand()
|
||||
.getAttributeModifiers(EquipmentSlotType.MAINHAND);
|
||||
player.getAttributes()
|
||||
|
@ -109,11 +109,11 @@ public class DeployerHandler {
|
|||
.removeAttributeModifiers(attributeModifiers);
|
||||
}
|
||||
|
||||
private static void activateInner(DeployerFakePlayer player, Vec3d vec, BlockPos clickedPos, Vec3d extensionVector,
|
||||
private static void activateInner(DeployerFakePlayer player, Vector3d vec, BlockPos clickedPos, Vector3d extensionVector,
|
||||
Mode mode) {
|
||||
|
||||
Vec3d rayOrigin = vec.add(extensionVector.scale(3 / 2f + 1 / 64f));
|
||||
Vec3d rayTarget = vec.add(extensionVector.scale(5 / 2f - 1 / 64f));
|
||||
Vector3d rayOrigin = vec.add(extensionVector.scale(3 / 2f + 1 / 64f));
|
||||
Vector3d rayTarget = vec.add(extensionVector.scale(5 / 2f - 1 / 64f));
|
||||
player.setPosition(rayOrigin.x, rayOrigin.y, rayOrigin.z);
|
||||
BlockPos pos = new BlockPos(vec);
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
|
@ -21,15 +21,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return new Vec3d(context.state.get(DeployerBlock.FACING)
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.of(context.state.get(DeployerBlock.FACING)
|
||||
.getDirectionVec()).scale(2);
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,10 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
}
|
||||
|
||||
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
|
||||
Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING)
|
||||
Vector3d facingVec = Vector3d.of(context.state.get(DeployerBlock.FACING)
|
||||
.getDirectionVec());
|
||||
facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
|
||||
Vec3d vec = context.position.subtract(facingVec.scale(2));
|
||||
Vector3d vec = context.position.subtract(facingVec.scale(2));
|
||||
player.rotationYaw = ContraptionEntity.yawFromVector(facingVec);
|
||||
player.rotationPitch = ContraptionEntity.pitchFromVector(facingVec) - 90;
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
@ -34,7 +34,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity> {
|
||||
|
@ -54,7 +54,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
protected void renderItem(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
BlockState deployerState = te.getBlockState();
|
||||
Vec3d offset = getHandOffset(te, partialTicks, deployerState).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||
Vector3d offset = getHandOffset(te, partialTicks, deployerState).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||
ms.push();
|
||||
ms.translate(offset.x, offset.y, offset.z);
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
|
||||
BlockState blockState = te.getBlockState();
|
||||
BlockPos pos = te.getPos();
|
||||
Vec3d offset = getHandOffset(te, partialTicks, blockState);
|
||||
Vector3d offset = getHandOffset(te, partialTicks, blockState);
|
||||
|
||||
SuperByteBuffer pole = AllBlockPartials.DEPLOYER_POLE.renderOn(blockState);
|
||||
SuperByteBuffer hand = te.getHandPose()
|
||||
|
@ -118,7 +118,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
vb);
|
||||
}
|
||||
|
||||
protected Vec3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) {
|
||||
protected Vector3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) {
|
||||
float progress = 0;
|
||||
if (te.state == State.EXPANDING)
|
||||
progress = 1 - (te.timer - partialTicks * te.getTimerSpeed()) / 1000f;
|
||||
|
@ -128,7 +128,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
float handLength = te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
|
||||
: te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21 / 16f);
|
||||
Vec3d offset = new Vec3d(blockState.get(FACING)
|
||||
Vector3d offset = Vector3d.of(blockState.get(FACING)
|
||||
.getDirectionVec()).scale(distance);
|
||||
return offset;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
if (context.contraption.stalled || context.position == null || context.data.contains("StationaryTimer")) {
|
||||
factor = MathHelper.sin(AnimationTickHolder.getRenderTick() * .5f) * .25f + .25f;
|
||||
} else {
|
||||
Vec3d center = VecHelper.getCenterOf(new BlockPos(context.position));
|
||||
Vector3d center = VecHelper.getCenterOf(new BlockPos(context.position));
|
||||
double distance = context.position.distanceTo(center);
|
||||
double nextDistance = context.position.add(context.motion)
|
||||
.distanceTo(center);
|
||||
|
@ -182,7 +182,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
.getRenderPartialTicks(), distance, nextDistance), 0, 1);
|
||||
}
|
||||
|
||||
Vec3d offset = new Vec3d(blockState.get(FACING)
|
||||
Vector3d offset = Vector3d.of(blockState.get(FACING)
|
||||
.getDirectionVec()).scale(factor);
|
||||
|
||||
Matrix4f lighting = msLocal.peek()
|
||||
|
|
|
@ -39,7 +39,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
@ -106,7 +106,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
heldItem = player.getHeldItemMainhand();
|
||||
sendData();
|
||||
}
|
||||
Vec3d initialPos = VecHelper.getCenterOf(pos.offset(getBlockState().get(FACING)));
|
||||
Vector3d initialPos = VecHelper.getCenterOf(pos.offset(getBlockState().get(FACING)));
|
||||
player.setPosition(initialPos.x, initialPos.y, initialPos.z);
|
||||
}
|
||||
invHandler = LazyOptional.of(this::createHandler);
|
||||
|
@ -181,9 +181,9 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
return;
|
||||
|
||||
state = State.EXPANDING;
|
||||
Vec3d movementVector = getMovementVector();
|
||||
Vec3d rayOrigin = VecHelper.getCenterOf(pos).add(movementVector.scale(3 / 2f));
|
||||
Vec3d rayTarget = VecHelper.getCenterOf(pos).add(movementVector.scale(5 / 2f));
|
||||
Vector3d movementVector = getMovementVector();
|
||||
Vector3d rayOrigin = VecHelper.getCenterOf(pos).add(movementVector.scale(3 / 2f));
|
||||
Vector3d rayTarget = VecHelper.getCenterOf(pos).add(movementVector.scale(5 / 2f));
|
||||
RayTraceContext rayTraceContext =
|
||||
new RayTraceContext(rayOrigin, rayTarget, BlockMode.OUTLINE, FluidMode.NONE, player);
|
||||
BlockRayTraceResult result = world.rayTraceBlocks(rayTraceContext);
|
||||
|
@ -262,9 +262,9 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
protected void activate() {
|
||||
Vec3d movementVector = getMovementVector();
|
||||
Vector3d movementVector = getMovementVector();
|
||||
Direction direction = getBlockState().get(FACING);
|
||||
Vec3d center = VecHelper.getCenterOf(pos);
|
||||
Vector3d center = VecHelper.getCenterOf(pos);
|
||||
BlockPos clickedPos = pos.offset(direction, 2);
|
||||
player.rotationYaw = direction.getHorizontalAngle();
|
||||
player.rotationPitch = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0;
|
||||
|
@ -300,9 +300,9 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (noInv) {
|
||||
Vec3d offset = getMovementVector();
|
||||
Vec3d outPos = VecHelper.getCenterOf(pos).add(offset.scale(-.65f));
|
||||
Vec3d motion = offset.scale(-.25f);
|
||||
Vector3d offset = getMovementVector();
|
||||
Vector3d outPos = VecHelper.getCenterOf(pos).add(offset.scale(-.65f));
|
||||
Vector3d motion = offset.scale(-.25f);
|
||||
ItemEntity e = new ItemEntity(world, outPos.x, outPos.y, outPos.z, itemStack.copy());
|
||||
e.setMotion(motion);
|
||||
world.addEntity(e);
|
||||
|
@ -325,10 +325,10 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
return stack;
|
||||
}
|
||||
|
||||
protected Vec3d getMovementVector() {
|
||||
protected Vector3d getMovementVector() {
|
||||
if (!AllBlocks.DEPLOYER.has(getBlockState()))
|
||||
return Vec3d.ZERO;
|
||||
return new Vec3d(getBlockState().get(FACING).getDirectionVec());
|
||||
return Vector3d.ZERO;
|
||||
return Vector3d.of(getBlockState().get(FACING).getDirectionVec());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,8 +32,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
@ -67,8 +67,8 @@ public class AirCurrent {
|
|||
Direction facing = direction;
|
||||
if (world.isRemote) {
|
||||
float offset = pushing ? 0.5f : maxDistance + .5f;
|
||||
Vec3d pos = VecHelper.getCenterOf(source.getPos())
|
||||
.add(new Vec3d(facing.getDirectionVec()).scale(offset));
|
||||
Vector3d pos = VecHelper.getCenterOf(source.getPos())
|
||||
.add(Vector3d.of(facing.getDirectionVec()).scale(offset));
|
||||
if (world.rand.nextFloat() < AllConfigs.CLIENT.fanParticleDensity.get())
|
||||
world.addParticle(new AirFlowParticleData(source.getPos()), pos.x, pos.y, pos.z, 0, 0, 0);
|
||||
}
|
||||
|
@ -81,15 +81,15 @@ public class AirCurrent {
|
|||
continue;
|
||||
}
|
||||
|
||||
Vec3d center = VecHelper.getCenterOf(source.getPos());
|
||||
Vec3i flow = (pushing ? facing : facing.getOpposite()).getDirectionVec();
|
||||
Vector3d center = VecHelper.getCenterOf(source.getPos());
|
||||
Vector3i flow = (pushing ? facing : facing.getOpposite()).getDirectionVec();
|
||||
|
||||
float sneakModifier = entity.isSneaking() ? 4096f : 512f;
|
||||
float speed = Math.abs(source.getSpeed());
|
||||
double entityDistance = entity.getPositionVec()
|
||||
.distanceTo(center);
|
||||
float acceleration = (float) (speed / sneakModifier / (entityDistance / maxDistance));
|
||||
Vec3d previousMotion = entity.getMotion();
|
||||
Vector3d previousMotion = entity.getMotion();
|
||||
float maxAcceleration = 5;
|
||||
|
||||
double xIn =
|
||||
|
@ -99,7 +99,7 @@ public class AirCurrent {
|
|||
double zIn =
|
||||
MathHelper.clamp(flow.getZ() * acceleration - previousMotion.z, -maxAcceleration, maxAcceleration);
|
||||
|
||||
entity.setMotion(previousMotion.add(new Vec3d(xIn, yIn, zIn).scale(1 / 8f)));
|
||||
entity.setMotion(previousMotion.add(new Vector3d(xIn, yIn, zIn).scale(1 / 8f)));
|
||||
entity.fallDistance = 0;
|
||||
|
||||
if (entity instanceof ServerPlayerEntity)
|
||||
|
@ -166,12 +166,12 @@ public class AirCurrent {
|
|||
direction = source.getBlockState()
|
||||
.get(BlockStateProperties.FACING);
|
||||
pushing = source.getAirFlowDirection() == direction;
|
||||
Vec3d directionVec = new Vec3d(direction.getDirectionVec());
|
||||
Vec3d planeVec = VecHelper.planeByNormal(directionVec);
|
||||
Vector3d directionVec = Vector3d.of(direction.getDirectionVec());
|
||||
Vector3d planeVec = VecHelper.planeByNormal(directionVec);
|
||||
|
||||
// 4 Rays test for holes in the shapes blocking the flow
|
||||
float offsetDistance = .25f;
|
||||
Vec3d[] offsets = new Vec3d[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance),
|
||||
Vector3d[] offsets = Vector3d.of[] { planeVec.mul(offsetDistance, offsetDistance, offsetDistance),
|
||||
planeVec.mul(-offsetDistance, -offsetDistance, offsetDistance),
|
||||
planeVec.mul(offsetDistance, -offsetDistance, -offsetDistance),
|
||||
planeVec.mul(-offsetDistance, offsetDistance, -offsetDistance), };
|
||||
|
@ -195,11 +195,11 @@ public class AirCurrent {
|
|||
break;
|
||||
}
|
||||
|
||||
for (Vec3d offset : offsets) {
|
||||
Vec3d rayStart = VecHelper.getCenterOf(currentPos)
|
||||
for (Vector3d offset : offsets) {
|
||||
Vector3d rayStart = VecHelper.getCenterOf(currentPos)
|
||||
.subtract(directionVec.scale(.5f + 1 / 32f))
|
||||
.add(offset);
|
||||
Vec3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
|
||||
Vector3d rayEnd = rayStart.add(directionVec.scale(1 + 1 / 32f));
|
||||
BlockRayTraceResult blockraytraceresult =
|
||||
world.rayTraceBlocks(rayStart, rayEnd, currentPos, voxelshape, state);
|
||||
if (blockraytraceresult == null)
|
||||
|
@ -248,7 +248,7 @@ public class AirCurrent {
|
|||
bounds = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
else {
|
||||
float factor = maxDistance - 1;
|
||||
Vec3d scale = directionVec.scale(factor);
|
||||
Vector3d scale = directionVec.scale(factor);
|
||||
if (factor > 0)
|
||||
bounds = new AxisAlignedBB(start.offset(direction)).expand(scale);
|
||||
else {
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.Explosion.Mode;
|
||||
|
||||
public class NozzleTileEntity extends SmartTileEntity {
|
||||
|
@ -69,12 +69,12 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
if (this.range != range)
|
||||
setRange(range);
|
||||
|
||||
Vec3d center = VecHelper.getCenterOf(pos);
|
||||
Vector3d center = VecHelper.getCenterOf(pos);
|
||||
if (world.isRemote && range != 0) {
|
||||
if (world.rand.nextInt(
|
||||
MathHelper.clamp((AllConfigs.SERVER.kinetics.fanPushDistance.get() - (int) range), 1, 10)) == 0) {
|
||||
Vec3d start = VecHelper.offsetRandomly(center, world.rand, pushing ? 1 : range / 2);
|
||||
Vec3d motion = center.subtract(start).normalize()
|
||||
Vector3d start = VecHelper.offsetRandomly(center, world.rand, pushing ? 1 : range / 2);
|
||||
Vector3d motion = center.subtract(start).normalize()
|
||||
.scale(MathHelper.clamp(range * (pushing ? .025f : 1f), 0, .5f) * (pushing ? -1 : 1));
|
||||
world.addParticle(ParticleTypes.POOF, start.x, start.y, start.z, motion.x, motion.y, motion.z);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
|
||||
for (Iterator<Entity> iterator = pushingEntities.iterator(); iterator.hasNext();) {
|
||||
Entity entity = iterator.next();
|
||||
Vec3d diff = entity.getPositionVec().subtract(center);
|
||||
Vector3d diff = entity.getPositionVec().subtract(center);
|
||||
|
||||
if (!(entity instanceof PlayerEntity) && world.isRemote)
|
||||
continue;
|
||||
|
@ -98,7 +98,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
continue;
|
||||
|
||||
float factor = (entity instanceof ItemEntity) ? 1 / 128f : 1 / 32f;
|
||||
Vec3d pushVec = diff.normalize().scale((range - distance) * (pushing ? 1 : -1));
|
||||
Vector3d pushVec = diff.normalize().scale((range - distance) * (pushing ? 1 : -1));
|
||||
entity.setMotion(entity.getMotion().add(pushVec.scale(factor)));
|
||||
entity.fallDistance = 0;
|
||||
entity.velocityChanged = true;
|
||||
|
@ -136,11 +136,11 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
if (range == 0)
|
||||
return;
|
||||
|
||||
Vec3d center = VecHelper.getCenterOf(pos);
|
||||
Vector3d center = VecHelper.getCenterOf(pos);
|
||||
AxisAlignedBB bb = new AxisAlignedBB(center, center).grow(range / 2f);
|
||||
|
||||
for (Entity entity : world.getEntitiesWithinAABB(Entity.class, bb)) {
|
||||
Vec3d diff = entity.getPositionVec().subtract(center);
|
||||
Vector3d diff = entity.getPositionVec().subtract(center);
|
||||
|
||||
double distance = diff.length();
|
||||
if (distance > range || entity.isSneaking()
|
||||
|
|
|
@ -86,7 +86,7 @@ public class FlywheelBlock extends HorizontalKineticBlock {
|
|||
NONE, LEFT, RIGHT;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -106,11 +106,11 @@ public class MillstoneTileEntity extends KineticTileEntity {
|
|||
|
||||
ItemParticleData data = new ItemParticleData(ParticleTypes.ITEM, stackInSlot);
|
||||
float angle = world.rand.nextFloat() * 360;
|
||||
Vec3d offset = new Vec3d(0, 0, 0.5f);
|
||||
Vector3d offset = new Vector3d(0, 0, 0.5f);
|
||||
offset = VecHelper.rotate(offset, angle, Axis.Y);
|
||||
Vec3d target = VecHelper.rotate(offset, getSpeed() > 0 ? 25 : -25, Axis.Y);
|
||||
Vector3d target = VecHelper.rotate(offset, getSpeed() > 0 ? 25 : -25, Axis.Y);
|
||||
|
||||
Vec3d center = offset.add(VecHelper.getCenterOf(pos));
|
||||
Vector3d center = offset.add(VecHelper.getCenterOf(pos));
|
||||
target = VecHelper.offsetRandomly(target.subtract(offset), world.rand, 1 / 128f);
|
||||
world.addParticle(data, center.x, center.y, center.z, target.x, target.y, target.z);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.processing.HeaterBlock.getHeaterLevel;
|
||||
|
@ -58,7 +58,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||
.isHorizontal()) {
|
||||
|
||||
@Override
|
||||
protected Vec3d getSouthLocation() {
|
||||
protected Vector3d getSouthLocation() {
|
||||
return super.getSouthLocation().add(0, 4 / 16f, 0);
|
||||
}
|
||||
|
||||
|
@ -180,12 +180,12 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||
|
||||
ItemParticleData data = new ItemParticleData(ParticleTypes.ITEM, stackInSlot);
|
||||
float angle = world.rand.nextFloat() * 360;
|
||||
Vec3d offset = new Vec3d(0, 0, 0.25f);
|
||||
Vector3d offset = new Vector3d(0, 0, 0.25f);
|
||||
offset = VecHelper.rotate(offset, angle, Axis.Y);
|
||||
Vec3d target = VecHelper.rotate(offset, getSpeed() > 0 ? 25 : -25, Axis.Y)
|
||||
Vector3d target = VecHelper.rotate(offset, getSpeed() > 0 ? 25 : -25, Axis.Y)
|
||||
.add(0, .25f, 0);
|
||||
|
||||
Vec3d center = offset.add(VecHelper.getCenterOf(pos));
|
||||
Vector3d center = offset.add(VecHelper.getCenterOf(pos));
|
||||
target = VecHelper.offsetRandomly(target.subtract(offset), world.rand, 1 / 128f);
|
||||
world.addParticle(data, center.x, center.y - 2, center.z, target.x, target.y, target.z);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
@ -251,10 +251,10 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
pressedItems.clear();
|
||||
}
|
||||
|
||||
public void makePressingParticleEffect(Vec3d pos, ItemStack stack) {
|
||||
public void makePressingParticleEffect(Vector3d pos, ItemStack stack) {
|
||||
if (world != null && world.isRemote) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .125f)
|
||||
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .125f)
|
||||
.mul(1, 0, 1);
|
||||
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, stack), pos.x, pos.y - .25f, pos.z, motion.x,
|
||||
motion.y + .125f, motion.z);
|
||||
|
@ -262,10 +262,10 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
public void makeCompactingParticleEffect(Vec3d pos, ItemStack stack) {
|
||||
public void makeCompactingParticleEffect(Vector3d pos, ItemStack stack) {
|
||||
if (world != null && world.isRemote) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .175f)
|
||||
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .175f)
|
||||
.mul(1, 0, 1);
|
||||
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, stack), pos.x, pos.y, pos.z, motion.x,
|
||||
motion.y + .25f, motion.z);
|
||||
|
|
|
@ -7,16 +7,16 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class SawFilterSlot extends ValueBoxTransform {
|
||||
|
||||
@Override
|
||||
protected Vec3d getLocalOffset(BlockState state) {
|
||||
protected Vector3d getLocalOffset(BlockState state) {
|
||||
if (state.get(SawBlock.FACING) != Direction.UP)
|
||||
return null;
|
||||
Vec3d x = VecHelper.voxelSpace(8f, 12.5f, 12.25f);
|
||||
Vec3d z = VecHelper.voxelSpace(12.25f, 12.5f, 8f);
|
||||
Vector3d x = VecHelper.voxelSpace(8f, 12.5f, 12.25f);
|
||||
Vector3d z = VecHelper.voxelSpace(12.25f, 12.5f, 8f);
|
||||
return state.get(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? z : x;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
|
|
@ -47,7 +47,7 @@ import net.minecraft.tileentity.TileEntityType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -139,7 +139,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
return;
|
||||
}
|
||||
|
||||
Vec3d itemMovement = getItemMovementVec();
|
||||
Vector3d itemMovement = getItemMovementVec();
|
||||
Direction itemMovementFacing = Direction.getFacingFromVector(itemMovement.x, itemMovement.y, itemMovement.z);
|
||||
if (inventory.remainingTime > 0)
|
||||
return;
|
||||
|
@ -169,10 +169,10 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
}
|
||||
|
||||
// Eject Items
|
||||
Vec3d outPos = VecHelper.getCenterOf(pos)
|
||||
Vector3d outPos = VecHelper.getCenterOf(pos)
|
||||
.add(itemMovement.scale(.5f)
|
||||
.add(0, .5, 0));
|
||||
Vec3d outMotion = itemMovement.scale(.0625)
|
||||
Vector3d outMotion = itemMovement.scale(.0625)
|
||||
.add(0, .125, 0);
|
||||
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
|
@ -217,18 +217,18 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
}
|
||||
|
||||
Random r = world.rand;
|
||||
Vec3d vec = getItemMovementVec();
|
||||
Vec3d pos = VecHelper.getCenterOf(this.pos);
|
||||
Vector3d vec = getItemMovementVec();
|
||||
Vector3d pos = VecHelper.getCenterOf(this.pos);
|
||||
float offset = inventory.recipeDuration != 0 ? (float) (inventory.remainingTime) / inventory.recipeDuration : 0;
|
||||
offset -= .5f;
|
||||
world.addParticle(particleData, pos.getX() + -vec.x * offset, pos.getY() + .45f, pos.getZ() + -vec.z * offset,
|
||||
-vec.x * speed, r.nextFloat() * speed, -vec.z * speed);
|
||||
}
|
||||
|
||||
public Vec3d getItemMovementVec() {
|
||||
public Vector3d getItemMovementVec() {
|
||||
boolean alongX = !getBlockState().get(SawBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||
int offset = getSpeed() < 0 ? -1 : 1;
|
||||
return new Vec3d(offset * (alongX ? 1 : 0), 0, offset * (alongX ? 0 : -1));
|
||||
return new Vector3d(offset * (alongX ? 1 : 0), 0, offset * (alongX ? 0 : -1));
|
||||
}
|
||||
|
||||
private void applyRecipe() {
|
||||
|
@ -354,9 +354,9 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
|
||||
public void dropItemFromCutTree(BlockPos pos, ItemStack stack) {
|
||||
float distance = (float) Math.sqrt(pos.distanceSq(breakingPos));
|
||||
Vec3d dropPos = VecHelper.getCenterOf(pos);
|
||||
Vector3d dropPos = VecHelper.getCenterOf(pos);
|
||||
ItemEntity entity = new ItemEntity(world, dropPos.x, dropPos.y, dropPos.z, stack);
|
||||
entity.setMotion(new Vec3d(breakingPos.subtract(this.pos)).scale(distance / 20f));
|
||||
entity.setMotion(Vector3d.of(breakingPos.subtract(this.pos)).scale(distance / 20f));
|
||||
world.addEntity(entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
@ -72,7 +72,7 @@ import net.minecraft.util.Direction.AxisDirection;
|
|||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
|
@ -762,9 +762,9 @@ public abstract class Contraption {
|
|||
foreachActor(world, (behaviour, ctx) -> {
|
||||
behaviour.stopMoving(ctx);
|
||||
ctx.position = null;
|
||||
ctx.motion = Vec3d.ZERO;
|
||||
ctx.relativeMotion = Vec3d.ZERO;
|
||||
ctx.rotation = Vec3d.ZERO;
|
||||
ctx.motion = Vector3d.ZERO;
|
||||
ctx.relativeMotion = Vector3d.ZERO;
|
||||
ctx.rotation = Vector3d.ZERO;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -787,12 +787,12 @@ public abstract class Contraption {
|
|||
if (axis == Axis.Z)
|
||||
maxDiff = Math.max(maxXDiff, maxYDiff);
|
||||
|
||||
Vec3d vec = new Vec3d(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
||||
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)
|
||||
.getDirectionVec());
|
||||
Vec3d planeByNormal = VecHelper.planeByNormal(vec);
|
||||
Vec3d min = vec.mul(bb.minX, bb.minY, bb.minZ)
|
||||
Vector3d planeByNormal = VecHelper.planeByNormal(vec);
|
||||
Vector3d min = vec.mul(bb.minX, bb.minY, bb.minZ)
|
||||
.add(planeByNormal.scale(-maxDiff));
|
||||
Vec3d max = vec.mul(bb.maxX, bb.maxY, bb.maxZ)
|
||||
Vector3d max = vec.mul(bb.maxX, bb.maxY, bb.maxZ)
|
||||
.add(planeByNormal.scale(maxDiff + 1));
|
||||
bounds = new AxisAlignedBB(min, max);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import net.minecraft.util.Direction.AxisDirection;
|
|||
import net.minecraft.util.ReuseableStream;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
|
@ -117,7 +117,7 @@ public class ContraptionCollider {
|
|||
CompoundNBT data = entityLiving.getPersistentData();
|
||||
if (!data.contains("ContraptionDismountLocation"))
|
||||
return;
|
||||
Vec3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE));
|
||||
Vector3d position = VecHelper.readNBT(data.getList("ContraptionDismountLocation", NBT.TAG_DOUBLE));
|
||||
if (entityLiving.getRidingEntity() == null)
|
||||
entityLiving.setPositionAndUpdate(position.x, position.y, position.z);
|
||||
data.remove("ContraptionDismountLocation");
|
||||
|
@ -142,9 +142,9 @@ public class ContraptionCollider {
|
|||
World world = contraptionEntity.getEntityWorld();
|
||||
Contraption contraption = contraptionEntity.getContraption();
|
||||
AxisAlignedBB bounds = contraptionEntity.getBoundingBox();
|
||||
Vec3d contraptionPosition = contraptionEntity.getPositionVec();
|
||||
Vec3d contraptionRotation = contraptionEntity.getRotationVec();
|
||||
Vec3d contraptionMotion = contraptionEntity.stationary ? Vec3d.ZERO
|
||||
Vector3d contraptionPosition = contraptionEntity.getPositionVec();
|
||||
Vector3d contraptionRotation = contraptionEntity.getRotationVec();
|
||||
Vector3d contraptionMotion = contraptionEntity.stationary ? Vector3d.ZERO
|
||||
: contraptionPosition.subtract(contraptionEntity.getPrevPositionVec());
|
||||
contraptionEntity.collidingEntities.clear();
|
||||
|
||||
|
@ -153,12 +153,12 @@ public class ContraptionCollider {
|
|||
if (bounds == null)
|
||||
return;
|
||||
|
||||
Vec3d centerOfBlock = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
Vector3d centerOfBlock = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
double conRotX = contraptionRotation.x;
|
||||
double conRotY = contraptionRotation.y;
|
||||
double conRotZ = contraptionRotation.z;
|
||||
Vec3d contraptionCentreOffset = contraptionEntity.stationary ? centerOfBlock : Vec3d.ZERO.add(0, 0.5, 0);
|
||||
boolean axisAlignedCollision = contraptionRotation.equals(Vec3d.ZERO);
|
||||
Vector3d contraptionCentreOffset = contraptionEntity.stationary ? centerOfBlock : Vector3d.ZERO.add(0, 0.5, 0);
|
||||
boolean axisAlignedCollision = contraptionRotation.equals(Vector3d.ZERO);
|
||||
Matrix3d rotation = null;
|
||||
|
||||
for (Entity entity : world.getEntitiesWithinAABB((EntityType<?>) null, bounds.grow(2)
|
||||
|
@ -177,12 +177,12 @@ public class ContraptionCollider {
|
|||
}
|
||||
|
||||
// Transform entity position and motion to local space
|
||||
Vec3d entityPosition = entity.getPositionVec();
|
||||
Vector3d entityPosition = entity.getPositionVec();
|
||||
AxisAlignedBB entityBounds = entity.getBoundingBox();
|
||||
Vec3d centerY = new Vec3d(0, entityBounds.getYSize() / 2, 0);
|
||||
Vec3d motion = entity.getMotion();
|
||||
Vector3d centerY = new Vector3d(0, entityBounds.getYSize() / 2, 0);
|
||||
Vector3d motion = entity.getMotion();
|
||||
|
||||
Vec3d position = entityPosition.subtract(contraptionCentreOffset)
|
||||
Vector3d position = entityPosition.subtract(contraptionCentreOffset)
|
||||
.add(centerY);
|
||||
position = position.subtract(contraptionPosition);
|
||||
position = rotation.transform(position);
|
||||
|
@ -205,15 +205,15 @@ public class ContraptionCollider {
|
|||
motion = rotation.transform(motion);
|
||||
motion = motion.subtract(contraptionMotion);
|
||||
|
||||
// Vec3d visualizerOrigin = new Vec3d(10, 64, 0);
|
||||
// Vector3d visualizerOrigin = new Vector3d(10, 64, 0);
|
||||
// CollisionDebugger.OBB = obb.copy();
|
||||
// CollisionDebugger.OBB.move(visualizerOrigin);
|
||||
|
||||
MutableObject<Vec3d> collisionResponse = new MutableObject<>(Vec3d.ZERO);
|
||||
MutableObject<Vec3d> allowedMotion = new MutableObject<>(motion);
|
||||
MutableObject<Vector3d> collisionResponse = new MutableObject<>(Vector3d.ZERO);
|
||||
MutableObject<Vector3d> allowedMotion = new MutableObject<>(motion);
|
||||
MutableBoolean futureCollision = new MutableBoolean(false);
|
||||
MutableBoolean surfaceCollision = new MutableBoolean(false);
|
||||
Vec3d obbCenter = obb.getCenter();
|
||||
Vector3d obbCenter = obb.getCenter();
|
||||
|
||||
// Apply separation maths
|
||||
List<AxisAlignedBB> bbs = new ArrayList<>();
|
||||
|
@ -225,7 +225,7 @@ public class ContraptionCollider {
|
|||
for (boolean horizontalPass : Iterate.trueAndFalse) {
|
||||
|
||||
for (AxisAlignedBB bb : bbs) {
|
||||
Vec3d currentResponse = collisionResponse.getValue();
|
||||
Vector3d currentResponse = collisionResponse.getValue();
|
||||
obb.setCenter(obbCenter.add(currentResponse));
|
||||
ContinuousSeparationManifold intersect = obb.intersect(bb, allowedMotion.getValue());
|
||||
|
||||
|
@ -241,8 +241,8 @@ public class ContraptionCollider {
|
|||
continue;
|
||||
}
|
||||
|
||||
Vec3d separation = intersect.asSeparationVec(entity.stepHeight);
|
||||
if (separation != null && !separation.equals(Vec3d.ZERO))
|
||||
Vector3d separation = intersect.asSeparationVec(entity.stepHeight);
|
||||
if (separation != null && !separation.equals(Vector3d.ZERO))
|
||||
collisionResponse.setValue(currentResponse.add(separation));
|
||||
}
|
||||
|
||||
|
@ -264,10 +264,10 @@ public class ContraptionCollider {
|
|||
}
|
||||
|
||||
// Resolve collision
|
||||
Vec3d entityMotion = entity.getMotion();
|
||||
Vec3d totalResponse = collisionResponse.getValue();
|
||||
Vec3d motionResponse = allowedMotion.getValue();
|
||||
boolean hardCollision = !totalResponse.equals(Vec3d.ZERO);
|
||||
Vector3d entityMotion = entity.getMotion();
|
||||
Vector3d totalResponse = collisionResponse.getValue();
|
||||
Vector3d motionResponse = allowedMotion.getValue();
|
||||
boolean hardCollision = !totalResponse.equals(Vector3d.ZERO);
|
||||
|
||||
rotation.transpose();
|
||||
motionResponse = rotation.transform(motionResponse)
|
||||
|
@ -283,7 +283,7 @@ public class ContraptionCollider {
|
|||
}
|
||||
}
|
||||
|
||||
Vec3d contactPointMotion = Vec3d.ZERO;
|
||||
Vector3d contactPointMotion = Vector3d.ZERO;
|
||||
if (surfaceCollision.isTrue()) {
|
||||
entity.fallDistance = 0;
|
||||
entity.onGround = true;
|
||||
|
@ -318,7 +318,7 @@ public class ContraptionCollider {
|
|||
}
|
||||
|
||||
totalResponse = totalResponse.add(contactPointMotion);
|
||||
Vec3d allowedMovement = getAllowedMovement(totalResponse, entity);
|
||||
Vector3d allowedMovement = getAllowedMovement(totalResponse, entity);
|
||||
contraptionEntity.collidingEntities.add(entity);
|
||||
entity.velocityChanged = true;
|
||||
entity.setPosition(entityPosition.x + allowedMovement.x, entityPosition.y + allowedMovement.y,
|
||||
|
@ -332,7 +332,7 @@ public class ContraptionCollider {
|
|||
}
|
||||
|
||||
/** From Entity#getAllowedMovement **/
|
||||
static Vec3d getAllowedMovement(Vec3d movement, Entity e) {
|
||||
static Vector3d getAllowedMovement(Vector3d movement, Entity e) {
|
||||
AxisAlignedBB bb = e.getBoundingBox();
|
||||
ISelectionContext ctx = ISelectionContext.forEntity(e);
|
||||
World world = e.world;
|
||||
|
@ -344,39 +344,39 @@ public class ContraptionCollider {
|
|||
: Stream.of(voxelshape);
|
||||
Stream<VoxelShape> stream1 = world.getEmptyCollisionShapes(e, bb.expand(movement), ImmutableSet.of());
|
||||
ReuseableStream<VoxelShape> reuseablestream = new ReuseableStream<>(Stream.concat(stream1, stream));
|
||||
Vec3d vec3d = movement.lengthSquared() == 0.0D ? movement
|
||||
Vector3d Vector3d = movement.lengthSquared() == 0.0D ? movement
|
||||
: collideBoundingBoxHeuristically(e, movement, bb, world, ctx, reuseablestream);
|
||||
boolean flag = movement.x != vec3d.x;
|
||||
boolean flag1 = movement.y != vec3d.y;
|
||||
boolean flag2 = movement.z != vec3d.z;
|
||||
boolean flag = movement.x != Vector3d.x;
|
||||
boolean flag1 = movement.y != Vector3d.y;
|
||||
boolean flag2 = movement.z != Vector3d.z;
|
||||
boolean flag3 = e.onGround || flag1 && movement.y < 0.0D;
|
||||
if (e.stepHeight > 0.0F && flag3 && (flag || flag2)) {
|
||||
Vec3d vec3d1 = collideBoundingBoxHeuristically(e, new Vec3d(movement.x, (double) e.stepHeight, movement.z),
|
||||
Vector3d Vector3d1 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, (double) e.stepHeight, movement.z),
|
||||
bb, world, ctx, reuseablestream);
|
||||
Vec3d vec3d2 = collideBoundingBoxHeuristically(e, new Vec3d(0.0D, (double) e.stepHeight, 0.0D),
|
||||
Vector3d Vector3d2 = collideBoundingBoxHeuristically(e, new Vector3d(0.0D, (double) e.stepHeight, 0.0D),
|
||||
bb.expand(movement.x, 0.0D, movement.z), world, ctx, reuseablestream);
|
||||
if (vec3d2.y < (double) e.stepHeight) {
|
||||
Vec3d vec3d3 = collideBoundingBoxHeuristically(e, new Vec3d(movement.x, 0.0D, movement.z),
|
||||
bb.offset(vec3d2), world, ctx, reuseablestream).add(vec3d2);
|
||||
if (horizontalMag(vec3d3) > horizontalMag(vec3d1)) {
|
||||
vec3d1 = vec3d3;
|
||||
if (Vector3d2.y < (double) e.stepHeight) {
|
||||
Vector3d Vector3d3 = collideBoundingBoxHeuristically(e, new Vector3d(movement.x, 0.0D, movement.z),
|
||||
bb.offset(Vector3d2), world, ctx, reuseablestream).add(Vector3d2);
|
||||
if (horizontalMag(Vector3d3) > horizontalMag(Vector3d1)) {
|
||||
Vector3d1 = Vector3d3;
|
||||
}
|
||||
}
|
||||
|
||||
if (horizontalMag(vec3d1) > horizontalMag(vec3d)) {
|
||||
return vec3d1.add(collideBoundingBoxHeuristically(e, new Vec3d(0.0D, -vec3d1.y + movement.y, 0.0D),
|
||||
bb.offset(vec3d1), world, ctx, reuseablestream));
|
||||
if (horizontalMag(Vector3d1) > horizontalMag(Vector3d)) {
|
||||
return Vector3d1.add(collideBoundingBoxHeuristically(e, new Vector3d(0.0D, -Vector3d1.y + movement.y, 0.0D),
|
||||
bb.offset(Vector3d1), world, ctx, reuseablestream));
|
||||
}
|
||||
}
|
||||
|
||||
return vec3d;
|
||||
return Vector3d;
|
||||
}
|
||||
|
||||
public static void pushEntityOutOfShape(Entity entity, VoxelShape voxelShape, Vec3d positionOffset,
|
||||
Vec3d shapeMotion) {
|
||||
public static void pushEntityOutOfShape(Entity entity, VoxelShape voxelShape, Vector3d positionOffset,
|
||||
Vector3d shapeMotion) {
|
||||
AxisAlignedBB entityBB = entity.getBoundingBox()
|
||||
.offset(positionOffset);
|
||||
Vec3d entityMotion = entity.getMotion();
|
||||
Vector3d entityMotion = entity.getMotion();
|
||||
|
||||
if (!voxelShape.toBoundingBoxList()
|
||||
.stream()
|
||||
|
@ -394,7 +394,7 @@ public class ContraptionCollider {
|
|||
: axis == Axis.Y ? entityBB.getYSize() + shapeBB.getYSize() : entityBB.getZSize() + shapeBB.getZSize();
|
||||
d = d + .5f;
|
||||
|
||||
Vec3d nudge = new Vec3d(face.getDirectionVec()).scale(d);
|
||||
Vector3d nudge = Vector3d.of(face.getDirectionVec()).scale(d);
|
||||
AxisAlignedBB nudgedBB = entityBB.offset(nudge.getX(), nudge.getY(), nudge.getZ());
|
||||
double nudgeDistance = face.getAxisDirection() == AxisDirection.POSITIVE ? -d : d;
|
||||
double offset = voxelShape.getAllowedOffset(face.getAxis(), nudgedBB, nudgeDistance);
|
||||
|
@ -407,7 +407,7 @@ public class ContraptionCollider {
|
|||
}
|
||||
|
||||
if (bestOffset != 0) {
|
||||
entity.move(MoverType.SELF, new Vec3d(bestSide.getDirectionVec()).scale(finalOffset));
|
||||
entity.move(MoverType.SELF, Vector3d.of(bestSide.getDirectionVec()).scale(finalOffset));
|
||||
boolean positive = bestSide.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
|
||||
double clamped;
|
||||
|
@ -466,17 +466,17 @@ public class ContraptionCollider {
|
|||
return false;
|
||||
|
||||
World world = contraptionEntity.getEntityWorld();
|
||||
Vec3d motion = contraptionEntity.getMotion();
|
||||
Vector3d motion = contraptionEntity.getMotion();
|
||||
Contraption contraption = contraptionEntity.getContraption();
|
||||
AxisAlignedBB bounds = contraptionEntity.getBoundingBox();
|
||||
Vec3d position = contraptionEntity.getPositionVec();
|
||||
Vector3d position = contraptionEntity.getPositionVec();
|
||||
BlockPos gridPos = new BlockPos(position);
|
||||
|
||||
if (contraption == null)
|
||||
return false;
|
||||
if (bounds == null)
|
||||
return false;
|
||||
if (motion.equals(Vec3d.ZERO))
|
||||
if (motion.equals(Vector3d.ZERO))
|
||||
return false;
|
||||
|
||||
Direction movementDirection = Direction.getFacingFromVector(motion.x, motion.y, motion.z);
|
||||
|
@ -494,10 +494,10 @@ public class ContraptionCollider {
|
|||
if (!otherContraptionEntity.collisionEnabled())
|
||||
continue;
|
||||
|
||||
Vec3d otherMotion = otherContraptionEntity.getMotion();
|
||||
Vector3d otherMotion = otherContraptionEntity.getMotion();
|
||||
Contraption otherContraption = otherContraptionEntity.getContraption();
|
||||
AxisAlignedBB otherBounds = otherContraptionEntity.getBoundingBox();
|
||||
Vec3d otherPosition = otherContraptionEntity.getPositionVec();
|
||||
Vector3d otherPosition = otherContraptionEntity.getPositionVec();
|
||||
|
||||
if (otherContraption == null)
|
||||
return false;
|
||||
|
|
|
@ -50,7 +50,11 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -65,7 +69,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
protected float initialAngle;
|
||||
protected float forcedAngle;
|
||||
protected BlockPos controllerPos;
|
||||
protected Vec3d motionBeforeStall;
|
||||
protected Vector3d motionBeforeStall;
|
||||
protected boolean stationary;
|
||||
protected boolean initialized;
|
||||
final List<Entity> collidingEntities = new ArrayList<>();
|
||||
|
@ -88,7 +92,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
|
||||
public ContraptionEntity(EntityType<?> entityTypeIn, World worldIn) {
|
||||
super(entityTypeIn, worldIn);
|
||||
motionBeforeStall = Vec3d.ZERO;
|
||||
motionBeforeStall = Vector3d.ZERO;
|
||||
stationary = entityTypeIn == AllEntityTypes.STATIONARY_CONTRAPTION.get();
|
||||
forcedAngle = -1;
|
||||
}
|
||||
|
@ -172,7 +176,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
|
||||
@Override
|
||||
protected void removePassenger(Entity passenger) {
|
||||
Vec3d transformedVector = getPassengerPosition(passenger);
|
||||
Vector3d transformedVector = getPassengerPosition(passenger);
|
||||
super.removePassenger(passenger);
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
@ -189,19 +193,19 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
public void updatePassengerPosition(Entity passenger, IMoveCallback callback) {
|
||||
if (!isPassenger(passenger))
|
||||
return;
|
||||
Vec3d transformedVector = getPassengerPosition(passenger);
|
||||
Vector3d transformedVector = getPassengerPosition(passenger);
|
||||
if (transformedVector == null)
|
||||
return;
|
||||
callback.accept(passenger, transformedVector.x, transformedVector.y, transformedVector.z);
|
||||
}
|
||||
|
||||
protected Vec3d getPassengerPosition(Entity passenger) {
|
||||
protected Vector3d getPassengerPosition(Entity passenger) {
|
||||
AxisAlignedBB bb = passenger.getBoundingBox();
|
||||
double ySize = bb.getYSize();
|
||||
BlockPos seat = contraption.getSeat(passenger.getUniqueID());
|
||||
if (seat == null)
|
||||
return null;
|
||||
Vec3d transformedVector = toGlobalVector(new Vec3d(seat).add(.5, passenger.getYOffset() + ySize - .15f, .5))
|
||||
Vector3d transformedVector = toGlobalVector(Vector3d.of(seat).add(.5, passenger.getYOffset() + ySize - .15f, .5))
|
||||
.add(VecHelper.getCenterOf(BlockPos.ZERO))
|
||||
.subtract(0.5, ySize, 0.5);
|
||||
return transformedVector;
|
||||
|
@ -237,7 +241,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
}
|
||||
|
||||
if (toDismount != null && !world.isRemote) {
|
||||
Vec3d transformedVector = getPassengerPosition(toDismount);
|
||||
Vector3d transformedVector = getPassengerPosition(toDismount);
|
||||
toDismount.stopRiding();
|
||||
if (transformedVector != null)
|
||||
toDismount.setPositionAndUpdate(transformedVector.x, transformedVector.y, transformedVector.z);
|
||||
|
@ -249,8 +253,8 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
return true;
|
||||
}
|
||||
|
||||
public Vec3d toGlobalVector(Vec3d localVec) {
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
public Vector3d toGlobalVector(Vector3d localVec) {
|
||||
Vector3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
localVec = localVec.subtract(rotationOffset);
|
||||
localVec = VecHelper.rotate(localVec, getRotationVec());
|
||||
localVec = localVec.add(rotationOffset)
|
||||
|
@ -258,8 +262,8 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
return localVec;
|
||||
}
|
||||
|
||||
public Vec3d toLocalVector(Vec3d globalVec) {
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
public Vector3d toLocalVector(Vector3d globalVec) {
|
||||
Vector3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
globalVec = globalVec.subtract(getAnchorVec())
|
||||
.subtract(rotationOffset);
|
||||
globalVec = VecHelper.rotate(globalVec, getRotationVec().scale(-1));
|
||||
|
@ -286,7 +290,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
}
|
||||
|
||||
if (getMotion().length() < 1 / 4098f)
|
||||
setMotion(Vec3d.ZERO);
|
||||
setMotion(Vector3d.ZERO);
|
||||
|
||||
move(getMotion().x, getMotion().y, getMotion().z);
|
||||
if (ContraptionCollider.collideBlocks(this))
|
||||
|
@ -313,10 +317,10 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
Entity riding = e;
|
||||
while (riding.getRidingEntity() != null)
|
||||
riding = riding.getRidingEntity();
|
||||
Vec3d movementVector = riding.getMotion();
|
||||
Vector3d movementVector = riding.getMotion();
|
||||
if (riding instanceof BoatEntity)
|
||||
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
|
||||
Vec3d motion = movementVector.normalize();
|
||||
Vector3d motion = movementVector.normalize();
|
||||
boolean rotating = false;
|
||||
|
||||
if (!rotationLock) {
|
||||
|
@ -347,7 +351,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
|
||||
if (wasStalled && !isStalled()) {
|
||||
riding.setMotion(motionBeforeStall);
|
||||
motionBeforeStall = Vec3d.ZERO;
|
||||
motionBeforeStall = Vector3d.ZERO;
|
||||
}
|
||||
|
||||
if (!isStalled() && (riding instanceof FurnaceMinecartEntity)) {
|
||||
|
@ -389,10 +393,10 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
super.tick();
|
||||
}
|
||||
|
||||
public void tickActors(Vec3d movementVector) {
|
||||
Vec3d rotationVec = getRotationVec();
|
||||
Vec3d reversedRotationVec = rotationVec.scale(-1);
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
public void tickActors(Vector3d movementVector) {
|
||||
Vector3d rotationVec = getRotationVec();
|
||||
Vector3d reversedRotationVec = rotationVec.scale(-1);
|
||||
Vector3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
boolean stalledPreviously = contraption.stalled;
|
||||
|
||||
if (!world.isRemote)
|
||||
|
@ -403,7 +407,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
BlockInfo blockInfo = pair.left;
|
||||
MovementBehaviour actor = Contraption.getMovement(blockInfo.state);
|
||||
|
||||
Vec3d actorPosition = new Vec3d(blockInfo.pos);
|
||||
Vector3d actorPosition = Vector3d.of(blockInfo.pos);
|
||||
actorPosition = actorPosition.add(actor.getActiveAreaOffset(context));
|
||||
actorPosition = VecHelper.rotate(actorPosition, rotationVec);
|
||||
actorPosition = actorPosition.add(rotationOffset)
|
||||
|
@ -413,10 +417,10 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
BlockPos gridPosition = new BlockPos(actorPosition);
|
||||
|
||||
if (!context.stall) {
|
||||
Vec3d previousPosition = context.position;
|
||||
Vector3d previousPosition = context.position;
|
||||
if (previousPosition != null) {
|
||||
context.motion = actorPosition.subtract(previousPosition);
|
||||
Vec3d relativeMotion = context.motion;
|
||||
Vector3d relativeMotion = context.motion;
|
||||
relativeMotion = VecHelper.rotate(relativeMotion, reversedRotationVec);
|
||||
context.relativeMotion = relativeMotion;
|
||||
newPosVisited = !new BlockPos(previousPosition).equals(gridPosition)
|
||||
|
@ -426,11 +430,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
if (getContraption() instanceof BearingContraption) {
|
||||
BearingContraption bc = (BearingContraption) getContraption();
|
||||
Direction facing = bc.getFacing();
|
||||
Vec3d activeAreaOffset = actor.getActiveAreaOffset(context);
|
||||
if (activeAreaOffset.mul(VecHelper.planeByNormal(new Vec3d(facing.getDirectionVec())))
|
||||
.equals(Vec3d.ZERO)) {
|
||||
Vector3d activeAreaOffset = actor.getActiveAreaOffset(context);
|
||||
if (activeAreaOffset.mul(VecHelper.planeByNormal(Vector3d.of(facing.getDirectionVec())))
|
||||
.equals(Vector3d.ZERO)) {
|
||||
if (VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis())) {
|
||||
context.motion = new Vec3d(facing.getDirectionVec()).scale(facing.getAxis()
|
||||
context.motion = Vector3d.of(facing.getDirectionVec()).scale(facing.getAxis()
|
||||
.getCoordinate(roll - prevRoll, yaw - prevYaw, pitch - prevPitch));
|
||||
context.relativeMotion = context.motion;
|
||||
int timer = context.data.getInt("StationaryTimer");
|
||||
|
@ -459,7 +463,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
|
||||
if (!world.isRemote) {
|
||||
if (!stalledPreviously && contraption.stalled) {
|
||||
setMotion(Vec3d.ZERO);
|
||||
setMotion(Vector3d.ZERO);
|
||||
if (getController() != null)
|
||||
getController().onStall();
|
||||
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
|
||||
|
@ -475,9 +479,9 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
setPosition(x + getX(), getY() + y, getZ() + z);
|
||||
}
|
||||
|
||||
private Vec3d getAnchorVec() {
|
||||
private Vector3d getAnchorVec() {
|
||||
if (contraption != null && contraption.getType() == AllContraptionTypes.MOUNTED)
|
||||
return new Vec3d(getX() - .5, getY(), getZ() - .5);
|
||||
return new Vector3d(getX() - .5, getY(), getZ() - .5);
|
||||
return getPositionVec();
|
||||
}
|
||||
|
||||
|
@ -503,7 +507,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
if (contraption != null) {
|
||||
AxisAlignedBB cbox = contraption.getBoundingBox();
|
||||
if (cbox != null) {
|
||||
Vec3d actualVec = getAnchorVec();
|
||||
Vector3d actualVec = getAnchorVec();
|
||||
this.setBoundingBox(cbox.offset(actualVec));
|
||||
}
|
||||
}
|
||||
|
@ -517,11 +521,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
super.stopRiding();
|
||||
}
|
||||
|
||||
public static float yawFromVector(Vec3d vec) {
|
||||
public static float yawFromVector(Vector3d vec) {
|
||||
return (float) ((3 * Math.PI / 2 + Math.atan2(vec.z, vec.x)) / Math.PI * 180);
|
||||
}
|
||||
|
||||
public static float pitchFromVector(Vec3d vec) {
|
||||
public static float pitchFromVector(Vector3d vec) {
|
||||
return (float) ((Math.acos(vec.y)) / Math.PI * 180);
|
||||
}
|
||||
|
||||
|
@ -558,10 +562,10 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
dataManager.set(STALLED, compound.getBoolean("Stalled"));
|
||||
ListNBT vecNBT = compound.getList("CachedMotion", 6);
|
||||
if (!vecNBT.isEmpty()) {
|
||||
motionBeforeStall = new Vec3d(vecNBT.getDouble(0), vecNBT.getDouble(1), vecNBT.getDouble(2));
|
||||
if (!motionBeforeStall.equals(Vec3d.ZERO))
|
||||
motionBeforeStall = new Vector3d(vecNBT.getDouble(0), vecNBT.getDouble(1), vecNBT.getDouble(2));
|
||||
if (!motionBeforeStall.equals(Vector3d.ZERO))
|
||||
targetYaw = prevYaw = yaw += yawFromVector(motionBeforeStall);
|
||||
setMotion(Vec3d.ZERO);
|
||||
setMotion(Vector3d.ZERO);
|
||||
}
|
||||
if (compound.contains("Controller"))
|
||||
controllerPos = NBTUtil.readBlockPos(compound.getCompound("Controller"));
|
||||
|
@ -628,18 +632,18 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
if (getContraption() != null) {
|
||||
remove();
|
||||
BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5));
|
||||
Vec3d rotation = getRotationVec();
|
||||
Vector3d rotation = getRotationVec();
|
||||
StructureTransform transform = new StructureTransform(offset, rotation);
|
||||
contraption.addBlocksToWorld(world, transform);
|
||||
contraption.addPassengersToWorld(world, transform, getPassengers());
|
||||
removePassengers();
|
||||
|
||||
for (Entity entity : collidingEntities) {
|
||||
Vec3d positionVec = getPositionVec();
|
||||
Vec3d localVec = entity.getPositionVec()
|
||||
Vector3d positionVec = getPositionVec();
|
||||
Vector3d localVec = entity.getPositionVec()
|
||||
.subtract(positionVec);
|
||||
localVec = VecHelper.rotate(localVec, getRotationVec().scale(-1));
|
||||
Vec3d transformed = transform.apply(localVec);
|
||||
Vector3d transformed = transform.apply(localVec);
|
||||
entity.setPositionAndUpdate(transformed.x, transformed.y, transformed.z);
|
||||
}
|
||||
|
||||
|
@ -672,7 +676,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public CompoundNBT writeWithoutTypeId(CompoundNBT nbt) {
|
||||
Vec3d vec = getPositionVec();
|
||||
Vector3d vec = getPositionVec();
|
||||
List<Entity> passengers = getPassengers();
|
||||
|
||||
for (Entity entity : passengers) {
|
||||
|
@ -680,7 +684,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
entity.removed = true;
|
||||
|
||||
// Gather passengers into same chunk when saving
|
||||
Vec3d prevVec = entity.getPositionVec();
|
||||
Vector3d prevVec = entity.getPositionVec();
|
||||
entity.setPos(vec.x, prevVec.y, vec.z);
|
||||
|
||||
// Super requires all passengers to not be removed in order to write them to the
|
||||
|
@ -727,7 +731,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
|
||||
@Override
|
||||
// Make sure nothing can move contraptions out of the way
|
||||
public void setMotion(Vec3d motionIn) {}
|
||||
public void setMotion(Vector3d motionIn) {}
|
||||
|
||||
@Override
|
||||
public void setPositionAndUpdate(double x, double y, double z) {
|
||||
|
@ -740,7 +744,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
return PushReaction.IGNORE;
|
||||
}
|
||||
|
||||
public void setContraptionMotion(Vec3d vec) {
|
||||
public void setContraptionMotion(Vector3d vec) {
|
||||
super.setMotion(vec);
|
||||
}
|
||||
|
||||
|
@ -758,24 +762,24 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
return initialAngle;
|
||||
}
|
||||
|
||||
public Vec3d getRotationVec() {
|
||||
return new Vec3d(getRoll(1), getYaw(1), getPitch(1));
|
||||
public Vector3d getRotationVec() {
|
||||
return new Vector3d(getRoll(1), getYaw(1), getPitch(1));
|
||||
}
|
||||
|
||||
public Vec3d getPrevRotationVec() {
|
||||
return new Vec3d(getRoll(0), getYaw(0), getPitch(0));
|
||||
public Vector3d getPrevRotationVec() {
|
||||
return new Vector3d(getRoll(0), getYaw(0), getPitch(0));
|
||||
}
|
||||
|
||||
public Vec3d getPrevPositionVec() {
|
||||
return new Vec3d(prevPosX, prevPosY, prevPosZ);
|
||||
public Vector3d getPrevPositionVec() {
|
||||
return new Vector3d(prevPosX, prevPosY, prevPosZ);
|
||||
}
|
||||
|
||||
public Vec3d getContactPointMotion(Vec3d globalContactPoint) {
|
||||
Vec3d positionVec = getPositionVec();
|
||||
Vec3d conMotion = positionVec.subtract(getPrevPositionVec());
|
||||
Vec3d conAngularMotion = getRotationVec().subtract(getPrevRotationVec());
|
||||
Vec3d contraptionCentreOffset = stationary ? VecHelper.getCenterOf(BlockPos.ZERO) : Vec3d.ZERO.add(0, 0.5, 0);
|
||||
Vec3d contactPoint = globalContactPoint.subtract(contraptionCentreOffset)
|
||||
public Vector3d getContactPointMotion(Vector3d globalContactPoint) {
|
||||
Vector3d positionVec = getPositionVec();
|
||||
Vector3d conMotion = positionVec.subtract(getPrevPositionVec());
|
||||
Vector3d conAngularMotion = getRotationVec().subtract(getPrevRotationVec());
|
||||
Vector3d contraptionCentreOffset = stationary ? VecHelper.getCenterOf(BlockPos.ZERO) : Vector3d.ZERO.add(0, 0.5, 0);
|
||||
Vector3d contactPoint = globalContactPoint.subtract(contraptionCentreOffset)
|
||||
.subtract(positionVec);
|
||||
contactPoint = VecHelper.rotate(contactPoint, conAngularMotion.x, conAngularMotion.y, conAngularMotion.z);
|
||||
contactPoint = contactPoint.add(positionVec)
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity> {
|
||||
|
||||
|
@ -54,14 +54,14 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||
double cartX = MathHelper.lerp(partialTicks, cart.lastTickPosX, cart.getX());
|
||||
double cartY = MathHelper.lerp(partialTicks, cart.lastTickPosY, cart.getY());
|
||||
double cartZ = MathHelper.lerp(partialTicks, cart.lastTickPosZ, cart.getZ());
|
||||
Vec3d cartPos = cart.getPos(cartX, cartY, cartZ);
|
||||
Vector3d cartPos = cart.getPos(cartX, cartY, cartZ);
|
||||
|
||||
for (MatrixStack stack : matrixStacks)
|
||||
stack.translate(-.5f, 0, -.5f);
|
||||
|
||||
if (cartPos != null) {
|
||||
Vec3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F);
|
||||
Vec3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F);
|
||||
Vector3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F);
|
||||
Vector3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F);
|
||||
if (cartPosFront == null)
|
||||
cartPosFront = cartPos;
|
||||
if (cartPosBack == null)
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.client.renderer.BlockModelRenderer;
|
|||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.simibubi.create.foundation.utility.MatrixStacker;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTransform {
|
||||
|
||||
|
@ -19,9 +19,9 @@ public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTra
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Vec3d getLocalOffset(BlockState state) {
|
||||
protected Vector3d getLocalOffset(BlockState state) {
|
||||
return super.getLocalOffset(state)
|
||||
.add(new Vec3d(state.get(BlockStateProperties.FACING).getDirectionVec()).scale(-2 / 16f));
|
||||
.add(Vector3d.of(state.get(BlockStateProperties.FACING).getDirectionVec()).scale(-2 / 16f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
@ -23,8 +23,8 @@ public abstract class MovementBehaviour {
|
|||
|
||||
public void visitNewPosition(MovementContext context, BlockPos pos) {}
|
||||
|
||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vec3d.ZERO;
|
||||
public Vector3d getActiveAreaOffset(MovementContext context) {
|
||||
return Vector3d.ZERO;
|
||||
}
|
||||
|
||||
public void dropItem(MovementContext context, ItemStack stack) {
|
||||
|
@ -32,7 +32,7 @@ public abstract class MovementBehaviour {
|
|||
if (remainder.isEmpty())
|
||||
return;
|
||||
|
||||
Vec3d vec = context.position;
|
||||
Vector3d vec = context.position;
|
||||
ItemEntity itemEntity = new ItemEntity(context.world, vec.x, vec.y, vec.z, remainder);
|
||||
itemEntity.setMotion(context.motion.add(0, 0.5f, 0)
|
||||
.scale(context.world.rand.nextFloat() * .3f));
|
||||
|
|
|
@ -5,17 +5,17 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
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.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
public class MovementContext {
|
||||
|
||||
public Vec3d position;
|
||||
public Vec3d motion;
|
||||
public Vec3d relativeMotion;
|
||||
public Vec3d rotation;
|
||||
public Vector3d position;
|
||||
public Vector3d motion;
|
||||
public Vector3d relativeMotion;
|
||||
public Vector3d rotation;
|
||||
public World world;
|
||||
public BlockState state;
|
||||
public BlockPos localPos;
|
||||
|
@ -34,9 +34,9 @@ public class MovementContext {
|
|||
localPos = info.pos;
|
||||
|
||||
firstMovement = true;
|
||||
motion = Vec3d.ZERO;
|
||||
relativeMotion = Vec3d.ZERO;
|
||||
rotation = Vec3d.ZERO;
|
||||
motion = Vector3d.ZERO;
|
||||
relativeMotion = Vector3d.ZERO;
|
||||
rotation = Vector3d.ZERO;
|
||||
position = null;
|
||||
data = new CompoundNBT();
|
||||
stall = false;
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class StructureTransform {
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class StructureTransform {
|
|||
Axis rotationAxis;
|
||||
BlockPos offset;
|
||||
|
||||
public StructureTransform(BlockPos offset, Vec3d rotation) {
|
||||
public StructureTransform(BlockPos offset, Vector3d rotation) {
|
||||
this.offset = offset;
|
||||
if (rotation.x != 0) {
|
||||
rotationAxis = Axis.X;
|
||||
|
@ -77,7 +77,7 @@ public class StructureTransform {
|
|||
}
|
||||
|
||||
public BlockPos apply(BlockPos localPos) {
|
||||
Vec3d vec = VecHelper.getCenterOf(localPos);
|
||||
Vector3d vec = VecHelper.getCenterOf(localPos);
|
||||
vec = VecHelper.rotateCentered(vec, angle, rotationAxis);
|
||||
localPos = new BlockPos(vec);
|
||||
return localPos.add(offset);
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class ClockworkBearingTileEntity extends KineticTileEntity implements IBearingTileEntity {
|
||||
|
||||
|
@ -84,13 +84,13 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
|
|||
protected void applyRotations() {
|
||||
Axis axis = getBlockState().get(BlockStateProperties.FACING).getAxis();
|
||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
||||
Vec3d directionVec = new Vec3d(direction.getDirectionVec());
|
||||
Vector3d directionVec = Vector3d.of(direction.getDirectionVec());
|
||||
if (hourHand != null) {
|
||||
Vec3d vec = new Vec3d(1, 1, 1).scale(hourAngle).mul(directionVec);
|
||||
Vector3d vec = new Vector3d(1, 1, 1).scale(hourAngle).mul(directionVec);
|
||||
hourHand.rotateTo(vec.x, vec.y, vec.z);
|
||||
}
|
||||
if (minuteHand != null) {
|
||||
Vec3d vec = new Vec3d(1, 1, 1).scale(minuteAngle).mul(directionVec);
|
||||
Vector3d vec = new Vector3d(1, 1, 1).scale(minuteAngle).mul(directionVec);
|
||||
minuteHand.rotateTo(vec.x, vec.y, vec.z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity implements IBearingTileEntity {
|
||||
|
||||
|
@ -260,8 +260,8 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
|||
Axis axis = getBlockState().get(FACING)
|
||||
.getAxis();
|
||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
||||
Vec3d vec = new Vec3d(1, 1, 1).scale(angle)
|
||||
.mul(new Vec3d(direction.getDirectionVec()));
|
||||
Vector3d vec = new Vector3d(1, 1, 1).scale(angle)
|
||||
.mul(Vector3d.of(direction.getDirectionVec()));
|
||||
movedContraption.rotateTo(vec.x, vec.y, vec.z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.Rotation;
|
|||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
@ -60,7 +60,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
|
|||
BooleanProperty glueableSide = getGlueableSide(state, face);
|
||||
if (glueableSide != null && !state.get(glueableSide)) {
|
||||
if (worldIn.isRemote) {
|
||||
Vec3d vec = hit.getHitVec();
|
||||
Vector3d vec = hit.getHitVec();
|
||||
worldIn.addParticle(ParticleTypes.ITEM_SLIME, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
|
|||
if (state.get(affectedSide) == isSlimeBall)
|
||||
return ActionResultType.PASS;
|
||||
if (worldIn.isRemote) {
|
||||
Vec3d vec = hit.getHitVec();
|
||||
Vector3d vec = hit.getHitVec();
|
||||
worldIn.addParticle(ParticleTypes.ITEM_SLIME, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
public class LinearChassisBlock extends AbstractChassisBlock {
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class LinearChassisBlock extends AbstractChassisBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos,
|
||||
public boolean connectsTo(BlockState state, BlockState other, IBlockDisplayReader reader, BlockPos pos,
|
||||
BlockPos otherPos, Direction face) {
|
||||
return sameKind(state, other) && state.get(AXIS) == other.get(AXIS);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GlueEffectPacket extends SimplePacketBase {
|
|||
public void handle(Supplier<Context> context) {
|
||||
context.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (!mc.player.getPosition().withinDistance(pos, 100))
|
||||
if (!mc.player.getBlockPos().withinDistance(pos, 100))
|
||||
return;
|
||||
SuperGlueItem.spawnParticles(mc.world, pos, direction, fullBlock);
|
||||
}));
|
||||
|
|
|
@ -42,7 +42,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -216,7 +216,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
}
|
||||
|
||||
@Override
|
||||
public void move(MoverType typeIn, Vec3d pos) {
|
||||
public void move(MoverType typeIn, Vector3d pos) {
|
||||
if (!world.isRemote && isAlive() && pos.lengthSquared() > 0.0D) {
|
||||
remove();
|
||||
onBroken(null);
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
||||
|
@ -68,9 +68,9 @@ public class SuperGlueHandler {
|
|||
|
||||
double distance = placer.getAttribute(PlayerEntity.REACH_DISTANCE)
|
||||
.getValue();
|
||||
Vec3d start = placer.getEyePosition(1);
|
||||
Vec3d look = placer.getLook(1);
|
||||
Vec3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
||||
Vector3d start = placer.getEyePosition(1);
|
||||
Vector3d look = placer.getLook(1);
|
||||
Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance);
|
||||
World world = placer.world;
|
||||
|
||||
RayTraceWorld rayTraceWorld =
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.util.ActionResultType;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -80,9 +80,9 @@ public class SuperGlueItem extends Item {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void spawnParticles(World world, BlockPos pos, Direction direction, boolean fullBlock) {
|
||||
Vec3d vec = new Vec3d(direction.getDirectionVec());
|
||||
Vec3d plane = VecHelper.planeByNormal(vec);
|
||||
Vec3d facePos = VecHelper.getCenterOf(pos)
|
||||
Vector3d vec = Vector3d.of(direction.getDirectionVec());
|
||||
Vector3d plane = VecHelper.planeByNormal(vec);
|
||||
Vector3d facePos = VecHelper.getCenterOf(pos)
|
||||
.add(vec.scale(.5f));
|
||||
|
||||
float distance = fullBlock ? 1f : .25f + .25f * (world.rand.nextFloat() - .5f);
|
||||
|
@ -90,13 +90,13 @@ public class SuperGlueItem extends Item {
|
|||
ItemStack stack = new ItemStack(Items.SLIME_BALL);
|
||||
|
||||
for (int i = fullBlock ? 40 : 15; i > 0; i--) {
|
||||
Vec3d offset = VecHelper.rotate(plane, 360 * world.rand.nextFloat(), direction.getAxis());
|
||||
Vec3d motion = offset.normalize()
|
||||
Vector3d offset = VecHelper.rotate(plane, 360 * world.rand.nextFloat(), direction.getAxis());
|
||||
Vector3d motion = offset.normalize()
|
||||
.scale(1 / 16f);
|
||||
if (fullBlock)
|
||||
offset = new Vec3d(MathHelper.clamp(offset.x, -.5, .5), MathHelper.clamp(offset.y, -.5, .5),
|
||||
offset = new Vector3d(MathHelper.clamp(offset.x, -.5, .5), MathHelper.clamp(offset.y, -.5, .5),
|
||||
MathHelper.clamp(offset.z, -.5, .5));
|
||||
Vec3d particlePos = facePos.add(offset);
|
||||
Vector3d particlePos = facePos.add(offset);
|
||||
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, stack), particlePos.x, particlePos.y,
|
||||
particlePos.z, motion.x, motion.y, motion.z);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -30,8 +30,8 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
|||
|
||||
private ResourceLocation regular = new ResourceLocation(Create.ID, "textures/entity/super_glue/slime.png");
|
||||
|
||||
private Vec3d[] quad1;
|
||||
private Vec3d[] quad2;
|
||||
private Vector3d[] quad1;
|
||||
private Vector3d[] quad2;
|
||||
private float[] u = { 0, 1, 1, 0 };
|
||||
private float[] v = { 0, 0, 1, 1 };
|
||||
|
||||
|
@ -66,10 +66,10 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
|||
AngleHelper.applyRotation(face, ms);
|
||||
Entry peek = ms.peek();
|
||||
|
||||
Vec3d[][] quads = { quad1, quad2 };
|
||||
for (Vec3d[] quad : quads) {
|
||||
Vector3d[][] quads = { quad1, quad2 };
|
||||
for (Vector3d[] quad : quads) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Vec3d vertex = quad[i];
|
||||
Vector3d vertex = quad[i];
|
||||
builder.vertex(peek.getModel(), (float) vertex.x, (float) vertex.y, (float) vertex.z)
|
||||
.color(255, 255, 255, 255)
|
||||
.texture(u[i], v[i])
|
||||
|
@ -84,31 +84,31 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
|||
}
|
||||
|
||||
private void initQuads() {
|
||||
Vec3d diff = new Vec3d(Direction.SOUTH.getDirectionVec());
|
||||
Vec3d extension = diff.normalize()
|
||||
Vector3d diff = Vector3d.of(Direction.SOUTH.getDirectionVec());
|
||||
Vector3d extension = diff.normalize()
|
||||
.scale(1 / 32f - 1 / 128f);
|
||||
Vec3d plane = VecHelper.planeByNormal(diff);
|
||||
Vector3d plane = VecHelper.planeByNormal(diff);
|
||||
Axis axis = Direction.getFacingFromVector(diff.x, diff.y, diff.z)
|
||||
.getAxis();
|
||||
|
||||
Vec3d start = Vec3d.ZERO.subtract(extension);
|
||||
Vec3d end = Vec3d.ZERO.add(extension);
|
||||
Vector3d start = Vector3d.ZERO.subtract(extension);
|
||||
Vector3d end = Vector3d.ZERO.add(extension);
|
||||
|
||||
plane = plane.scale(1 / 2f);
|
||||
Vec3d a1 = plane.add(start);
|
||||
Vec3d b1 = plane.add(end);
|
||||
Vector3d a1 = plane.add(start);
|
||||
Vector3d b1 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vec3d a2 = plane.add(start);
|
||||
Vec3d b2 = plane.add(end);
|
||||
Vector3d a2 = plane.add(start);
|
||||
Vector3d b2 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vec3d a3 = plane.add(start);
|
||||
Vec3d b3 = plane.add(end);
|
||||
Vector3d a3 = plane.add(start);
|
||||
Vector3d b3 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vec3d a4 = plane.add(start);
|
||||
Vec3d b4 = plane.add(end);
|
||||
Vector3d a4 = plane.add(start);
|
||||
Vector3d b4 = plane.add(end);
|
||||
|
||||
quad1 = new Vec3d[] { a2, a3, a4, a1 };
|
||||
quad2 = new Vec3d[] { b3, b2, b1, b4 };
|
||||
quad1 = new Vector3d[] { a2, a3, a4, a1 };
|
||||
quad2 = new Vector3d[] { b3, b2, b1, b4 };
|
||||
}
|
||||
|
||||
private int getBrightnessForRender(SuperGlueEntity entity) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public enum CartAssembleRailType implements IStringSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraft.item.ItemUseContext;
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
|
@ -45,7 +45,7 @@ import net.minecraft.util.SoundCategory;
|
|||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
@ -53,15 +53,15 @@ import net.minecraft.world.IBlockReader;
|
|||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootParameters;
|
||||
import net.minecraft.loot.LootContext;
|
||||
import net.minecraft.loot.LootParameters;
|
||||
|
||||
public class CartAssemblerBlock extends AbstractRailBlock
|
||||
implements ITE<CartAssemblerTileEntity>, IWrenchable, ISpecialBlockItemRequirement {
|
||||
|
||||
public static final IProperty<RailShape> RAIL_SHAPE =
|
||||
public static final Property<RailShape> RAIL_SHAPE =
|
||||
EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH);
|
||||
public static final IProperty<CartAssembleRailType> RAIL_TYPE =
|
||||
public static final Property<CartAssembleRailType> RAIL_TYPE =
|
||||
EnumProperty.create("rail_type", CartAssembleRailType.class);
|
||||
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||
facing.getZOffset() * speed);
|
||||
} else {
|
||||
disassemble(world, pos, cart);
|
||||
Vec3d diff = VecHelper.getCenterOf(pos)
|
||||
Vector3d diff = VecHelper.getCenterOf(pos)
|
||||
.subtract(cart.getPositionVec());
|
||||
cart.setMotion(diff.x / 16f, 0, diff.z / 16f);
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IProperty<RailShape> getShapeProperty() {
|
||||
public Property<RailShape> getShapeProperty() {
|
||||
return RAIL_SHAPE;
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
|||
@SuppressWarnings("deprecation")
|
||||
@Nonnull
|
||||
public List<ItemStack> getDrops(@Nonnull BlockState state,
|
||||
@Nonnull net.minecraft.world.storage.loot.LootContext.Builder builder) {
|
||||
@Nonnull net.minecraft.loot.LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
drops.addAll(getRailBlock(state).getDrops(builder));
|
||||
return drops;
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public abstract class LinearActuatorTileEntity extends KineticTileEntity implements IControlContraption {
|
||||
|
||||
|
@ -64,7 +64,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
|||
movedContraption.setContraptionMotion(toMotionVector(syncSpeed));
|
||||
return;
|
||||
}
|
||||
movedContraption.setContraptionMotion(Vec3d.ZERO);
|
||||
movedContraption.setContraptionMotion(Vector3d.ZERO);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -201,9 +201,9 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
|||
|
||||
protected abstract ValueBoxTransform getMovementModeSlot();
|
||||
|
||||
protected abstract Vec3d toMotionVector(float speed);
|
||||
protected abstract Vector3d toMotionVector(float speed);
|
||||
|
||||
protected abstract Vec3d toPosition(float offset);
|
||||
protected abstract Vector3d toPosition(float offset);
|
||||
|
||||
protected void visitNewPosition() {}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
|||
if (movedContraption == null)
|
||||
return;
|
||||
if (movedContraption.isStalled()) {
|
||||
movedContraption.setContraptionMotion(Vec3d.ZERO);
|
||||
movedContraption.setContraptionMotion(Vector3d.ZERO);
|
||||
return;
|
||||
}
|
||||
movedContraption.setContraptionMotion(getMotionVector());
|
||||
|
@ -248,10 +248,10 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
|||
protected void applyContraptionPosition() {
|
||||
if (movedContraption == null)
|
||||
return;
|
||||
Vec3d vec = toPosition(offset);
|
||||
Vector3d vec = toPosition(offset);
|
||||
movedContraption.setPosition(vec.x, vec.y, vec.z);
|
||||
if (getSpeed() == 0 || waitingForSpeedChange)
|
||||
movedContraption.setContraptionMotion(Vec3d.ZERO);
|
||||
movedContraption.setContraptionMotion(Vector3d.ZERO);
|
||||
}
|
||||
|
||||
public float getMovementSpeed() {
|
||||
|
@ -261,7 +261,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
|||
return movementSpeed;
|
||||
}
|
||||
|
||||
public Vec3d getMotionVector() {
|
||||
public Vector3d getMotionVector() {
|
||||
return toMotionVector(getMovementSpeed());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.util.IStringSerializable;
|
|||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
@ -84,7 +84,7 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement
|
|||
if (((MechanicalPistonBlock) state.getBlock()).isSticky)
|
||||
return ActionResultType.PASS;
|
||||
if (worldIn.isRemote) {
|
||||
Vec3d vec = hit.getHitVec();
|
||||
Vector3d vec = hit.getHitVec();
|
||||
worldIn.addParticle(ParticleTypes.ITEM_SLIME, vec.x, vec.y, vec.z, 0, 0, 0);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement
|
|||
RETRACTED, MOVING, EXTENDED;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.block.IWaterLoggable;
|
|||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
|
@ -92,7 +92,7 @@ public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class MechanicalPistonTileEntity extends LinearActuatorTileEntity {
|
||||
|
||||
|
@ -138,16 +138,16 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity {
|
|||
protected void visitNewPosition() {}
|
||||
|
||||
@Override
|
||||
protected Vec3d toMotionVector(float speed) {
|
||||
protected Vector3d toMotionVector(float speed) {
|
||||
Direction pistonDirection = getBlockState().get(BlockStateProperties.FACING);
|
||||
return new Vec3d(pistonDirection.getDirectionVec()).scale(speed);
|
||||
return Vector3d.of(pistonDirection.getDirectionVec()).scale(speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vec3d toPosition(float offset) {
|
||||
Vec3d position = new Vec3d(getBlockState().get(BlockStateProperties.FACING)
|
||||
protected Vector3d toPosition(float offset) {
|
||||
Vector3d position = Vector3d.of(getBlockState().get(BlockStateProperties.FACING)
|
||||
.getDirectionVec()).scale(offset);
|
||||
return position.add(new Vec3d(movedContraption.getContraption()
|
||||
return position.add(Vector3d.of(movedContraption.getContraption()
|
||||
.getAnchor()));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.block.IWaterLoggable;
|
|||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
@ -91,13 +91,13 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return getDefaultState().with(FACING, context.getFace().getOpposite())
|
||||
.with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.block.IWaterLoggable;
|
|||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
|
@ -128,7 +128,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<Pulle
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class PulleyTileEntity extends LinearActuatorTileEntity {
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
if (!removed) {
|
||||
if (offset > 0) {
|
||||
BlockPos magnetPos = pos.down((int) offset);
|
||||
IFluidState ifluidstate = world.getFluidState(magnetPos);
|
||||
FluidState ifluidstate = world.getFluidState(magnetPos);
|
||||
world.destroyBlock(magnetPos, world.getBlockState(magnetPos)
|
||||
.getCollisionShape(world, magnetPos)
|
||||
.isEmpty());
|
||||
|
@ -115,7 +115,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
|
||||
for (int i = 1; i <= ((int) offset) - 1; i++) {
|
||||
BlockPos ropePos = pos.down(i);
|
||||
IFluidState ifluidstate = world.getFluidState(ropePos);
|
||||
FluidState ifluidstate = world.getFluidState(ropePos);
|
||||
waterlog[i] = ifluidstate.getFluid() == Fluids.WATER;
|
||||
world.destroyBlock(ropePos, world.getBlockState(ropePos)
|
||||
.getCollisionShape(world, ropePos)
|
||||
|
@ -138,13 +138,13 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Vec3d toPosition(float offset) {
|
||||
protected Vector3d toPosition(float offset) {
|
||||
if (movedContraption.getContraption() instanceof PulleyContraption) {
|
||||
PulleyContraption contraption = (PulleyContraption) movedContraption.getContraption();
|
||||
return new Vec3d(contraption.getAnchor()).add(0, contraption.initialOffset - offset, 0);
|
||||
return Vector3d.of(contraption.getAnchor()).add(0, contraption.initialOffset - offset, 0);
|
||||
|
||||
}
|
||||
return Vec3d.ZERO;
|
||||
return Vector3d.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,8 +190,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Vec3d toMotionVector(float speed) {
|
||||
return new Vec3d(0, -speed, 0);
|
||||
protected Vector3d toMotionVector(float speed) {
|
||||
return new Vector3d(0, -speed, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.item.ItemGroup;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -27,11 +27,11 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class ReinforcedRailBlock extends AbstractRailBlock {
|
||||
|
||||
public static IProperty<RailShape> RAIL_SHAPE =
|
||||
public static Property<RailShape> RAIL_SHAPE =
|
||||
EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH);
|
||||
|
||||
public static IProperty<Boolean> CONNECTS_N = BooleanProperty.create("connects_n");
|
||||
public static IProperty<Boolean> CONNECTS_S = BooleanProperty.create("connects_s");
|
||||
public static Property<Boolean> CONNECTS_N = BooleanProperty.create("connects_n");
|
||||
public static Property<Boolean> CONNECTS_S = BooleanProperty.create("connects_s");
|
||||
|
||||
public ReinforcedRailBlock(Properties properties) {
|
||||
super(true, properties);
|
||||
|
@ -44,7 +44,7 @@ public class ReinforcedRailBlock extends AbstractRailBlock {
|
|||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IProperty<RailShape> getShapeProperty() {
|
||||
public Property<RailShape> getShapeProperty() {
|
||||
return RAIL_SHAPE;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
@ -62,11 +62,11 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
|
|||
World world = e.getEntityWorld();
|
||||
if (world.isRemote && (e instanceof PlayerEntity)) {
|
||||
if (worldIn.getBlockState(e.getPosition()) != state) {
|
||||
Vec3d origin = VecHelper.getCenterOf(pos);
|
||||
Vec3d offset = e.getPositionVec()
|
||||
Vector3d origin = VecHelper.getCenterOf(pos);
|
||||
Vector3d offset = e.getPositionVec()
|
||||
.subtract(origin);
|
||||
offset = VecHelper.rotate(offset, MathHelper.clamp(speed, -16, 16) / 1f, Axis.Y);
|
||||
Vec3d movement = origin.add(offset)
|
||||
Vector3d movement = origin.add(offset)
|
||||
.subtract(e.getPositionVec());
|
||||
e.setMotion(e.getMotion()
|
||||
.add(movement));
|
||||
|
@ -84,7 +84,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
|
|||
((LivingEntity) e).setIdleTime(20);
|
||||
e.setRenderYawOffset(diff);
|
||||
e.setRotationYawHead(diff);
|
||||
e.onGround = false;
|
||||
e.setOnGround(false);
|
||||
e.velocityChanged = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class TurntableHandler {
|
||||
|
||||
|
@ -32,8 +32,8 @@ public class TurntableHandler {
|
|||
if (speed == 0)
|
||||
return;
|
||||
|
||||
Vec3d origin = VecHelper.getCenterOf(pos);
|
||||
Vec3d offset = mc.player.getPositionVec().subtract(origin);
|
||||
Vector3d origin = VecHelper.getCenterOf(pos);
|
||||
Vector3d offset = mc.player.getPositionVec().subtract(origin);
|
||||
|
||||
if (offset.length() > 1/4f)
|
||||
speed *= MathHelper.clamp((1/2f - offset.length()) * 2, 0, 1);
|
||||
|
|
|
@ -11,14 +11,14 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
|||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
@ -85,16 +85,16 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||
.getAxis())
|
||||
return;
|
||||
|
||||
IFluidState fluid = world.getFluidState(pos.offset(f));
|
||||
FluidState fluid = world.getFluidState(pos.offset(f));
|
||||
Direction wf = state.get(HORIZONTAL_FACING);
|
||||
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
int clockwiseMultiplier = 2;
|
||||
|
||||
Vec3d vec = fluid.getFlow(world, pos.offset(f));
|
||||
Vector3d vec = fluid.getFlow(world, pos.offset(f));
|
||||
vec = vec.scale(f.getAxisDirection()
|
||||
.getOffset());
|
||||
vec = new Vec3d(Math.signum(vec.x), Math.signum(vec.y), Math.signum(vec.z));
|
||||
Vec3d flow = vec;
|
||||
vec = new Vector3d(Math.signum(vec.x), Math.signum(vec.y), Math.signum(vec.z));
|
||||
Vector3d flow = vec;
|
||||
|
||||
withTileEntityDo(world, pos, te -> {
|
||||
double flowStrength = 0;
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.block.SixWayBlock;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
@ -15,7 +15,7 @@ import net.minecraft.util.Direction.Axis;
|
|||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
|
@ -37,14 +37,14 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
}
|
||||
|
||||
// TODO: more generic pipe connection handling. Ideally without marker interface
|
||||
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) || isTank(neighbour, world, pos, blockFace))
|
||||
return true;
|
||||
return neighbour.getBlock() instanceof PumpBlock && blockFace.getAxis() == neighbour.get(PumpBlock.FACING)
|
||||
.getAxis();
|
||||
}
|
||||
|
||||
public static boolean shouldDrawRim(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
|
||||
public static boolean shouldDrawRim(IBlockDisplayReader world, BlockPos pos, BlockState state, Direction direction) {
|
||||
if (!isPipe(state))
|
||||
return false;
|
||||
if (!state.get(FACING_TO_PROPERTY_MAP.get(direction)))
|
||||
|
@ -67,11 +67,11 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCornerOrEndPipe(ILightReader world, BlockPos pos, BlockState state) {
|
||||
public static boolean isCornerOrEndPipe(IBlockDisplayReader world, BlockPos pos, BlockState state) {
|
||||
return isPipe(state) && !isStraightPipe(world, pos, state) && !shouldDrawCasing(world, pos, state);
|
||||
}
|
||||
|
||||
public static boolean isStraightPipe(ILightReader world, BlockPos pos, BlockState state) {
|
||||
public static boolean isStraightPipe(IBlockDisplayReader world, BlockPos pos, BlockState state) {
|
||||
if (!isPipe(state))
|
||||
return false;
|
||||
boolean axisFound = false;
|
||||
|
@ -87,7 +87,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
return axisFound;
|
||||
}
|
||||
|
||||
public static boolean shouldDrawCasing(ILightReader world, BlockPos pos, BlockState state) {
|
||||
public static boolean shouldDrawCasing(IBlockDisplayReader world, BlockPos pos, BlockState state) {
|
||||
if (!isPipe(state))
|
||||
return false;
|
||||
for (Axis axis : Iterate.axes) {
|
||||
|
@ -109,7 +109,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return updateBlockState(getDefaultState(), context.getNearestLookingDirection(), null, context.getWorld(),
|
||||
context.getPos()).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
}
|
||||
|
||||
public BlockState updateBlockState(BlockState state, Direction preferredDirection, @Nullable Direction ignore,
|
||||
ILightReader world, BlockPos pos) {
|
||||
IBlockDisplayReader world, BlockPos pos) {
|
||||
// Update sides that are not ignored
|
||||
for (Direction d : Iterate.directions)
|
||||
if (d != ignore)
|
||||
|
@ -151,7 +151,7 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
|||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
@ -27,7 +27,7 @@ public class FluidPipeModel extends WrappedBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putRim(d, FluidPipeBlock.shouldDrawRim(world, pos, state, d));
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.util.SoundEvents;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -171,10 +171,10 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
|
|||
if (reversed)
|
||||
level = 1 - level;
|
||||
|
||||
Vec3d vec = ray.getHitVec();
|
||||
vec = new Vec3d(vec.x, controllerTE.getPos()
|
||||
Vector3d vec = ray.getHitVec();
|
||||
vec = new Vector3d(vec.x, controllerTE.getPos()
|
||||
.getY() + level * (controllerTE.height - .5f) + .25f, vec.z);
|
||||
Vec3d motion = player.getPositionVec()
|
||||
Vector3d motion = player.getPositionVec()
|
||||
.subtract(vec)
|
||||
.scale(1 / 20f);
|
||||
vec = vec.add(motion);
|
||||
|
@ -222,7 +222,7 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
|
|||
PLAIN, WINDOW, WINDOW_NW, WINDOW_SW, WINDOW_NE, WINDOW_SE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
|
||||
public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class FluidTankCTBehaviour extends HorizontalCTBehaviour {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos, BlockPos otherPos,
|
||||
public boolean connectsTo(BlockState state, BlockState other, IBlockDisplayReader reader, BlockPos pos, BlockPos otherPos,
|
||||
Direction face) {
|
||||
return state.getBlock() == other.getBlock() && FluidTankConnectivityHandler.isConnected(reader, pos, otherPos);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
|||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class FluidTankModel extends CTModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
public IModelData getModelData(IBlockDisplayReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
CullData cullData = new CullData();
|
||||
for (Direction d : Iterate.horizontalDirections)
|
||||
cullData.setCulled(d, FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(d)));
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
@ -62,7 +62,7 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable
|
|||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class PumpBlock extends DirectionalKineticBlock implements IWaterLoggable
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
FluidState ifluidstate = context.getWorld().getFluidState(context.getPos());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER));
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class PumpRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class PumpRenderer extends KineticTileEntityRenderer {
|
|||
if (!(te instanceof PumpTileEntity))
|
||||
return;
|
||||
PumpTileEntity pump = (PumpTileEntity) te;
|
||||
Vec3d rotationOffset = new Vec3d(.5, 14 / 16f, .5);
|
||||
Vector3d rotationOffset = new Vector3d(.5, 14 / 16f, .5);
|
||||
BlockState blockState = te.getBlockState();
|
||||
float angle = MathHelper.lerp(pump.arrowDirection.get(partialTicks), 0, 90) - 90;
|
||||
for (float yRot : new float[] { 0, 90 }) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.particles.ParticleTypes;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AirFlowParticle extends SimpleAnimatedParticle {
|
||||
|
@ -32,7 +32,7 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||
this.maxAge = 40;
|
||||
canCollide = false;
|
||||
selectSprite(7);
|
||||
Vec3d offset = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .25f);
|
||||
Vector3d offset = VecHelper.offsetRandomly(Vector3d.ZERO, world.rand, .25f);
|
||||
this.setPosition(posX + offset.x, posY + offset.y, posZ + offset.z);
|
||||
this.prevPosX = posX;
|
||||
this.prevPosY = posY;
|
||||
|
@ -61,12 +61,12 @@ public class AirFlowParticle extends SimpleAnimatedParticle {
|
|||
return;
|
||||
}
|
||||
|
||||
Vec3d directionVec = new Vec3d(source.airCurrent.direction.getDirectionVec());
|
||||
Vec3d motion = directionVec.scale(1 / 8f);
|
||||
Vector3d directionVec = Vector3d.of(source.airCurrent.direction.getDirectionVec());
|
||||
Vector3d motion = directionVec.scale(1 / 8f);
|
||||
if (!source.airCurrent.pushing)
|
||||
motion = motion.scale(-1);
|
||||
|
||||
double distance = new Vec3d(posX, posY, posZ).subtract(VecHelper.getCenterOf(source.getPos()))
|
||||
double distance = new Vector3d(posX, posY, posZ).subtract(VecHelper.getCenterOf(source.getPos()))
|
||||
.mul(directionVec).length() - .5f;
|
||||
if (distance > source.airCurrent.maxDistance + 1 || distance < -.25f) {
|
||||
dissipate();
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.client.particle.ParticleManager.IParticleMetaFactory;
|
|||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class AirFlowParticleData implements IParticleData, ICustomParticle<AirFl
|
|||
final int posY;
|
||||
final int posZ;
|
||||
|
||||
public AirFlowParticleData(Vec3i pos) {
|
||||
public AirFlowParticleData(Vector3i pos) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,38 +15,38 @@ import net.minecraft.client.renderer.Tessellator;
|
|||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CubeParticle extends Particle {
|
||||
|
||||
public static final Vec3d[] CUBE = {
|
||||
public static final Vector3d[] CUBE = {
|
||||
// TOP
|
||||
new Vec3d(1, 1, -1), new Vec3d(1, 1, 1), new Vec3d(-1, 1, 1), new Vec3d(-1, 1, -1),
|
||||
new Vector3d(1, 1, -1), new Vector3d(1, 1, 1), new Vector3d(-1, 1, 1), new Vector3d(-1, 1, -1),
|
||||
|
||||
// BOTTOM
|
||||
new Vec3d(-1, -1, -1), new Vec3d(-1, -1, 1), new Vec3d(1, -1, 1), new Vec3d(1, -1, -1),
|
||||
new Vector3d(-1, -1, -1), new Vector3d(-1, -1, 1), new Vector3d(1, -1, 1), new Vector3d(1, -1, -1),
|
||||
|
||||
// FRONT
|
||||
new Vec3d(-1, -1, 1), new Vec3d(-1, 1, 1), new Vec3d(1, 1, 1), new Vec3d(1, -1, 1),
|
||||
new Vector3d(-1, -1, 1), new Vector3d(-1, 1, 1), new Vector3d(1, 1, 1), new Vector3d(1, -1, 1),
|
||||
|
||||
// BACK
|
||||
new Vec3d(1, -1, -1), new Vec3d(1, 1, -1), new Vec3d(-1, 1, -1), new Vec3d(-1, -1, -1),
|
||||
new Vector3d(1, -1, -1), new Vector3d(1, 1, -1), new Vector3d(-1, 1, -1), new Vector3d(-1, -1, -1),
|
||||
|
||||
// LEFT
|
||||
new Vec3d(-1, -1, -1), new Vec3d(-1, 1, -1), new Vec3d(-1, 1, 1), new Vec3d(-1, -1, 1),
|
||||
new Vector3d(-1, -1, -1), new Vector3d(-1, 1, -1), new Vector3d(-1, 1, 1), new Vector3d(-1, -1, 1),
|
||||
|
||||
// RIGHT
|
||||
new Vec3d(1, -1, 1), new Vec3d(1, 1, 1), new Vec3d(1, 1, -1), new Vec3d(1, -1, -1) };
|
||||
new Vector3d(1, -1, 1), new Vector3d(1, 1, 1), new Vector3d(1, 1, -1), new Vector3d(1, -1, -1) };
|
||||
|
||||
public static final Vec3d[] CUBE_NORMALS = {
|
||||
public static final Vector3d[] CUBE_NORMALS = {
|
||||
// modified normals for the sides
|
||||
new Vec3d(0, 1, 0), new Vec3d(0, -1, 0), new Vec3d(0, 0, 1), new Vec3d(0, 0, 1), new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 0, 1),
|
||||
new Vector3d(0, 1, 0), new Vector3d(0, -1, 0), new Vector3d(0, 0, 1), new Vector3d(0, 0, 1), new Vector3d(0, 0, 1),
|
||||
new Vector3d(0, 0, 1),
|
||||
|
||||
/*
|
||||
* new Vec3d(0, 1, 0), new Vec3d(0, -1, 0), new Vec3d(0, 0, 1), new Vec3d(0, 0,
|
||||
* -1), new Vec3d(-1, 0, 0), new Vec3d(1, 0, 0)
|
||||
* new Vector3d(0, 1, 0), new Vector3d(0, -1, 0), new Vector3d(0, 0, 1), new Vector3d(0, 0,
|
||||
* -1), new Vector3d(-1, 0, 0), new Vector3d(1, 0, 0)
|
||||
*/
|
||||
};
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class CubeParticle extends Particle {
|
|||
|
||||
@Override
|
||||
public void buildGeometry(IVertexBuilder builder, ActiveRenderInfo renderInfo, float p_225606_3_) {
|
||||
Vec3d projectedView = renderInfo.getProjectedView();
|
||||
Vector3d projectedView = renderInfo.getProjectedView();
|
||||
float lerpedX = (float) (MathHelper.lerp(p_225606_3_, this.prevPosX, this.posX) - projectedView.getX());
|
||||
float lerpedY = (float) (MathHelper.lerp(p_225606_3_, this.prevPosY, this.posY) - projectedView.getY());
|
||||
float lerpedZ = (float) (MathHelper.lerp(p_225606_3_, this.prevPosZ, this.posZ) - projectedView.getZ());
|
||||
|
@ -113,13 +113,13 @@ public class CubeParticle extends Particle {
|
|||
for (int i = 0; i < 6; i++) {
|
||||
// 6 faces to a cube
|
||||
for (int j = 0; j < 4; j++) {
|
||||
Vec3d vec = CUBE[i * 4 + j];
|
||||
Vector3d vec = CUBE[i * 4 + j];
|
||||
vec = vec
|
||||
/* .rotate(?) */
|
||||
.scale(scale * ageMultiplier)
|
||||
.add(lerpedX, lerpedY, lerpedZ);
|
||||
|
||||
Vec3d normal = CUBE_NORMALS[i];
|
||||
Vector3d normal = CUBE_NORMALS[i];
|
||||
builder.vertex(vec.x, vec.y, vec.z)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha)
|
||||
.texture(0, 0)
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.client.particle.Particle;
|
|||
import net.minecraft.client.particle.SimpleAnimatedParticle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
||||
|
@ -24,8 +24,8 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||
protected float radius2;
|
||||
protected float speed;
|
||||
protected Axis axis;
|
||||
protected Vec3d origin;
|
||||
protected Vec3d offset;
|
||||
protected Vector3d origin;
|
||||
protected Vector3d offset;
|
||||
protected boolean isVisible;
|
||||
|
||||
private RotationIndicatorParticle(World world, double x, double y, double z, int color, float radius1,
|
||||
|
@ -34,7 +34,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
this.origin = new Vec3d(x, y, z);
|
||||
this.origin = new Vector3d(x, y, z);
|
||||
this.particleScale *= 0.75F;
|
||||
this.maxAge = lifeSpan + this.rand.nextInt(32);
|
||||
this.setColorFade(color);
|
||||
|
@ -46,7 +46,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||
this.speed = speed;
|
||||
this.axis = axis;
|
||||
this.isVisible = isVisible;
|
||||
this.offset = axis.isHorizontal() ? new Vec3d(0, 1, 0) : new Vec3d(1, 0, 0);
|
||||
this.offset = axis.isHorizontal() ? new Vector3d(0, 1, 0) : new Vector3d(1, 0, 0);
|
||||
move(0, 0, 0);
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
|
@ -69,7 +69,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
|||
public void move(double x, double y, double z) {
|
||||
float time = AnimationTickHolder.ticks;
|
||||
float angle = (float) ((time * speed) % 360) - (speed / 2 * age * (((float) age) / maxAge));
|
||||
Vec3d position = VecHelper.rotate(this.offset.scale(radius), angle, axis).add(origin);
|
||||
Vector3d position = VecHelper.rotate(this.offset.scale(radius), angle, axis).add(origin);
|
||||
posX = position.x;
|
||||
posY = position.y;
|
||||
posZ = position.z;
|
||||
|
|
|
@ -8,12 +8,12 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
|
@ -39,8 +39,8 @@ public class BasinRenderer extends SafeTileEntityRenderer<BasinTileEntity> {
|
|||
|
||||
for (int i = 0; i <= stack.getCount() / 8; i++) {
|
||||
ms.push();
|
||||
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, .25f);
|
||||
Vec3d vec2 = VecHelper.offsetRandomly(Vec3d.ZERO, r, .5f);
|
||||
Vector3d vec = VecHelper.offsetRandomly(Vector3d.ZERO, r, .25f);
|
||||
Vector3d vec2 = VecHelper.offsetRandomly(Vector3d.ZERO, r, .5f);
|
||||
ms.translate(vec.x, vec.y, vec.z);
|
||||
ms.multiply(new Vector3f((float) vec2.z, (float) vec2.y, 0).getDegreesQuaternion((float) vec2.x * 180));
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
|
@ -33,8 +33,8 @@ import net.minecraft.world.World;
|
|||
@ParametersAreNonnullByDefault
|
||||
public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
|
||||
|
||||
//public static IProperty<Integer> BLAZE_LEVEL = IntegerProperty.create("blaze_level", 0, 4);
|
||||
public static IProperty<HeatLevel> BLAZE_LEVEL = EnumProperty.create("blaze", HeatLevel.class);
|
||||
//public static Property<Integer> BLAZE_LEVEL = IntegerProperty.create("blaze_level", 0, 4);
|
||||
public static Property<HeatLevel> BLAZE_LEVEL = EnumProperty.create("blaze", HeatLevel.class);
|
||||
|
||||
public HeaterBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
@ -133,7 +133,7 @@ public class HeaterBlock extends Block implements ITE<HeaterTileEntity> {
|
|||
;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.SoundCategory;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
|
@ -157,22 +157,22 @@ public class HeaterTileEntity extends SmartTileEntity {
|
|||
if (r.nextDouble() > 0.25)
|
||||
return;
|
||||
|
||||
Vec3d color = randomColor(heatLevel);
|
||||
Vector3d color = randomColor(heatLevel);
|
||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.03F, 15), 0.015, 0.1);
|
||||
} else if (heatLevel == HeaterBlock.HeatLevel.FADING) {
|
||||
if (r.nextDouble() > 0.5)
|
||||
return;
|
||||
|
||||
Vec3d color = randomColor(heatLevel);
|
||||
Vector3d color = randomColor(heatLevel);
|
||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.035F, 18), 0.03, 0.15);
|
||||
} else if (heatLevel == HeaterBlock.HeatLevel.KINDLED) {
|
||||
Vec3d color = randomColor(heatLevel);
|
||||
Vector3d color = randomColor(heatLevel);
|
||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.04F, 21), 0.05, 0.2);
|
||||
}else if (heatLevel == HeaterBlock.HeatLevel.SEETHING) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (r.nextDouble() > 0.6)
|
||||
return;
|
||||
Vec3d color = randomColor(heatLevel);
|
||||
Vector3d color = randomColor(heatLevel);
|
||||
spawnParticle(new CubeParticleData((float) color.x,(float) color.y,(float) color.z, 0.045F, 24), 0.06, 0.22);
|
||||
}
|
||||
}
|
||||
|
@ -191,9 +191,9 @@ public class HeaterTileEntity extends SmartTileEntity {
|
|||
0.0D);
|
||||
}
|
||||
|
||||
private static Vec3d randomColor(HeaterBlock.HeatLevel heatLevel) {
|
||||
private static Vector3d randomColor(HeaterBlock.HeatLevel heatLevel) {
|
||||
if (heatLevel == HeaterBlock.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)]);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class HeaterTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
event.getThrowable().setMotion(Vec3d.ZERO);
|
||||
event.getThrowable().setMotion(Vector3d.ZERO);
|
||||
event.getThrowable().remove();
|
||||
|
||||
HeaterTileEntity heater = (HeaterTileEntity) tile;
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class SpeedControllerTileEntity extends KineticTileEntity {
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
|||
new ScrollValueBehaviour(Lang.translate("generic.speed"), this, new ControllerValueBoxTransform());
|
||||
targetSpeed.between(-max, max);
|
||||
targetSpeed.value = DEFAULT_SPEED;
|
||||
targetSpeed.moveText(new Vec3d(9, 0, 10));
|
||||
targetSpeed.moveText(new Vector3d(9, 0, 10));
|
||||
targetSpeed.withUnit(i -> Lang.translate("generic.unit.rpm"));
|
||||
targetSpeed.withCallback(i -> this.updateTargetRotation());
|
||||
targetSpeed.withStepFunction(CreativeMotorTileEntity::step);
|
||||
|
@ -106,7 +106,7 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
|||
private class ControllerValueBoxTransform extends ValueBoxTransform.Sided {
|
||||
|
||||
@Override
|
||||
protected Vec3d getSouthLocation() {
|
||||
protected Vector3d getSouthLocation() {
|
||||
return VecHelper.voxelSpace(8, 11.5f, 14);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import net.minecraft.item.ItemUseContext;
|
|||
import net.minecraft.pathfinding.PathNodeType;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -62,7 +62,7 @@ import net.minecraft.world.IWorld;
|
|||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.storage.loot.LootParameters;
|
||||
import net.minecraft.loot.LootParameters;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
@ -71,8 +71,8 @@ import net.minecraftforge.items.IItemHandler;
|
|||
|
||||
public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEntity>, ISpecialBlockItemRequirement {
|
||||
|
||||
public static final IProperty<BeltSlope> SLOPE = EnumProperty.create("slope", BeltSlope.class);
|
||||
public static final IProperty<BeltPart> PART = EnumProperty.create("part", BeltPart.class);
|
||||
public static final Property<BeltSlope> SLOPE = EnumProperty.create("slope", BeltSlope.class);
|
||||
public static final Property<BeltPart> PART = EnumProperty.create("part", BeltPart.class);
|
||||
public static final BooleanProperty CASING = BooleanProperty.create("casing");
|
||||
|
||||
public BeltBlock(Properties properties) {
|
||||
|
@ -120,7 +120,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, net.minecraft.world.storage.loot.LootContext.Builder builder) {
|
||||
public List<ItemStack> getDrops(BlockState state, net.minecraft.loot.LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
TileEntity tileEntity = builder.get(LootParameters.BLOCK_ENTITY);
|
||||
if (tileEntity instanceof BeltTileEntity && ((BeltTileEntity) tileEntity).hasPulley())
|
||||
|
@ -203,7 +203,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
|||
info.refresh(pos, state);
|
||||
} else {
|
||||
controller.passengers.put(entityIn, new TransportedEntityInfo(pos, state));
|
||||
entityIn.onGround = true;
|
||||
entityIn.setOnGround(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.IBlockDisplayReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
public class BeltColor implements IBlockColor {
|
||||
|
||||
@Override
|
||||
public int getColor(BlockState state, ILightReader reader, BlockPos pos, int layer) {
|
||||
public int getColor(BlockState state, IBlockDisplayReader reader, BlockPos pos, int layer) {
|
||||
if (reader == null)
|
||||
return 0;
|
||||
TileEntity tileEntity = reader.getTileEntity(pos);
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
public class BeltHelper {
|
||||
|
@ -40,7 +40,7 @@ public class BeltHelper {
|
|||
|
||||
public static BlockPos getPositionForOffset(BeltTileEntity controller, int offset) {
|
||||
BlockPos pos = controller.getPos();
|
||||
Vec3i vec = controller.getBeltFacing().getDirectionVec();
|
||||
Vector3i vec = controller.getBeltFacing().getDirectionVec();
|
||||
BeltSlope slope = controller.getBlockState().get(BeltBlock.SLOPE);
|
||||
int verticality = slope == BeltSlope.DOWNWARD ? -1 : slope == BeltSlope.UPWARD ? 1 : 0;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class BeltHelper {
|
|||
offset * vec.getZ());
|
||||
}
|
||||
|
||||
public static Vec3d getVectorForOffset(BeltTileEntity controller, float offset) {
|
||||
public static Vector3d getVectorForOffset(BeltTileEntity controller, float offset) {
|
||||
BeltSlope slope = controller.getBlockState().get(BeltBlock.SLOPE);
|
||||
int verticality = slope == BeltSlope.DOWNWARD ? -1 : slope == BeltSlope.UPWARD ? 1 : 0;
|
||||
float verticalMovement = verticality;
|
||||
|
@ -56,11 +56,11 @@ public class BeltHelper {
|
|||
verticalMovement = 0;
|
||||
verticalMovement = verticalMovement * (Math.min(offset, controller.beltLength - .5f) - .5f);
|
||||
|
||||
Vec3d vec = VecHelper.getCenterOf(controller.getPos());
|
||||
Vec3d horizontalMovement = new Vec3d(controller.getBeltFacing().getDirectionVec()).scale(offset - .5f);
|
||||
Vector3d vec = VecHelper.getCenterOf(controller.getPos());
|
||||
Vector3d horizontalMovement = Vector3d.of(controller.getBeltFacing().getDirectionVec()).scale(offset - .5f);
|
||||
|
||||
if (slope == BeltSlope.VERTICAL)
|
||||
horizontalMovement = Vec3d.ZERO;
|
||||
horizontalMovement = Vector3d.ZERO;
|
||||
|
||||
vec = vec.add(horizontalMovement).add(0, verticalMovement, 0);
|
||||
return vec;
|
||||
|
|
|
@ -8,7 +8,7 @@ public enum BeltPart implements IStringSerializable {
|
|||
START, MIDDLE, END, PULLEY;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
}
|
|
@ -24,15 +24,15 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
|
||||
public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||
|
||||
|
@ -154,9 +154,9 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
|
||||
ms.push();
|
||||
|
||||
Vec3i directionVec = te.getBeltFacing()
|
||||
Vector3i directionVec = te.getBeltFacing()
|
||||
.getDirectionVec();
|
||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5)
|
||||
Vector3d beltStartOffset = Vector3d.of(directionVec).scale(-.5)
|
||||
.add(.5, 13 / 16f + .125f, .5);
|
||||
ms.translate(beltStartOffset.x, beltStartOffset.y, beltStartOffset.z);
|
||||
BeltSlope slope = te.getBlockState()
|
||||
|
@ -182,7 +182,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
if (offset < .5)
|
||||
verticalMovement = 0;
|
||||
verticalMovement = verticalMovement * (Math.min(offset, te.beltLength - .5f) - .5f);
|
||||
Vec3d offsetVec = new Vec3d(directionVec).scale(offset)
|
||||
Vector3d offsetVec = Vector3d.of(directionVec).scale(offset)
|
||||
.add(0, verticalMovement, 0);
|
||||
boolean onSlope =
|
||||
slope != BeltSlope.HORIZONTAL && MathHelper.clamp(offset, .5f, te.beltLength - .5f) == offset;
|
||||
|
@ -205,7 +205,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null)
|
||||
.isGui3d();
|
||||
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
|
||||
Vec3d shadowPos = new Vec3d(te.getPos()).add(beltStartOffset.scale(1)
|
||||
Vector3d shadowPos = Vector3d.of(te.getPos()).add(beltStartOffset.scale(1)
|
||||
.add(offsetVec)
|
||||
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
||||
ShadowRenderHelper.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.simibubi.create.foundation.utility.VoxelShaper;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
|
@ -249,10 +249,10 @@ public class BeltShapes {
|
|||
|
||||
public static VoxelShaper make(VoxelShape southBeltShape){
|
||||
return forDirectionsWithRotation(
|
||||
rotatedCopy(southBeltShape, new Vec3d(-90,0,0)),
|
||||
rotatedCopy(southBeltShape, new Vector3d(-90,0,0)),
|
||||
Direction.SOUTH,
|
||||
Direction.Plane.HORIZONTAL,//idk, this can probably be improved :S
|
||||
direction -> new Vec3d(
|
||||
direction -> new Vector3d(
|
||||
direction.getAxisDirection() == Direction.AxisDirection.POSITIVE ? 0 : 180,
|
||||
-direction.getHorizontalAngle(),
|
||||
0));
|
||||
|
|
|
@ -8,7 +8,7 @@ public enum BeltSlope implements IStringSerializable {
|
|||
HORIZONTAL, UPWARD, DOWNWARD, VERTICAL, SIDEWAYS;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return Lang.asId(name());
|
||||
}
|
||||
}
|
|
@ -39,8 +39,8 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
@ -301,15 +301,15 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
return part == BeltPart.START ^ movingPositively;
|
||||
}
|
||||
|
||||
public Vec3i getMovementDirection(boolean firstHalf) {
|
||||
public Vector3i getMovementDirection(boolean firstHalf) {
|
||||
return this.getMovementDirection(firstHalf, false);
|
||||
}
|
||||
|
||||
public Vec3i getBeltChainDirection() {
|
||||
public Vector3i getBeltChainDirection() {
|
||||
return this.getMovementDirection(true, true);
|
||||
}
|
||||
|
||||
protected Vec3i getMovementDirection(boolean firstHalf, boolean ignoreHalves) {
|
||||
protected Vector3i getMovementDirection(boolean firstHalf, boolean ignoreHalves) {
|
||||
if (getSpeed() == 0)
|
||||
return BlockPos.ZERO;
|
||||
|
||||
|
@ -323,7 +323,7 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
boolean notHorizontal = blockState.get(BeltBlock.SLOPE) != HORIZONTAL;
|
||||
if (getSpeed() < 0)
|
||||
movementFacing = movementFacing.getOpposite();
|
||||
Vec3i movement = movementFacing.getDirectionVec();
|
||||
Vector3i movement = movementFacing.getDirectionVec();
|
||||
|
||||
boolean slopeBeforeHalf = (part == BeltPart.END) == (beltFacing.getAxisDirection() == POSITIVE);
|
||||
boolean onSlope = notHorizontal && (part == MIDDLE || slopeBeforeHalf == firstHalf || ignoreHalves);
|
||||
|
@ -332,7 +332,7 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
if (!onSlope)
|
||||
return movement;
|
||||
|
||||
return new Vec3i(movement.getX(), movingUp ? 1 : -1, movement.getZ());
|
||||
return new Vector3i(movement.getX(), movingUp ? 1 : -1, movement.getZ());
|
||||
}
|
||||
|
||||
public Direction getMovementFacing() {
|
||||
|
@ -366,10 +366,10 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
.applyToEachWithin(index + .5f, maxDistanceFromCenter, processFunction);
|
||||
}
|
||||
|
||||
private Vec3d getWorldPositionOf(TransportedItemStack transported) {
|
||||
private Vector3d getWorldPositionOf(TransportedItemStack transported) {
|
||||
BeltTileEntity controllerTE = getControllerTE();
|
||||
if (controllerTE == null)
|
||||
return Vec3d.ZERO;
|
||||
return Vector3d.ZERO;
|
||||
return BeltHelper.getVectorForOffset(controllerTE, transported.beltPosition);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeltConnectorHandler {
|
||||
|
@ -80,22 +80,22 @@ public class BeltConnectorHandler {
|
|||
boolean canConnect =
|
||||
BeltConnectorItem.validateAxis(world, selected) && BeltConnectorItem.canConnect(world, first, selected);
|
||||
|
||||
Vec3d start = new Vec3d(first);
|
||||
Vec3d end = new Vec3d(selected);
|
||||
Vec3d actualDiff = end.subtract(start);
|
||||
Vector3d start = Vector3d.of(first);
|
||||
Vector3d end = Vector3d.of(selected);
|
||||
Vector3d actualDiff = end.subtract(start);
|
||||
end = end.subtract(axis.getCoordinate(actualDiff.x, 0, 0), axis.getCoordinate(0, actualDiff.y, 0),
|
||||
axis.getCoordinate(0, 0, actualDiff.z));
|
||||
Vec3d diff = end.subtract(start);
|
||||
Vector3d diff = end.subtract(start);
|
||||
|
||||
double x = Math.abs(diff.x);
|
||||
double y = Math.abs(diff.y);
|
||||
double z = Math.abs(diff.z);
|
||||
float length = (float) Math.max(x, Math.max(y, z));
|
||||
Vec3d step = diff.normalize();
|
||||
Vector3d step = diff.normalize();
|
||||
|
||||
int sames = ((x == y) ? 1 : 0) + ((y == z) ? 1 : 0) + ((z == x) ? 1 : 0);
|
||||
if (sames == 0) {
|
||||
List<Vec3d> validDiffs = new LinkedList<>();
|
||||
List<Vector3d> validDiffs = new LinkedList<>();
|
||||
for (int i = -1; i <= 1; i++)
|
||||
for (int j = -1; j <= 1; j++)
|
||||
for (int k = -1; k <= 1; k++) {
|
||||
|
@ -105,11 +105,11 @@ public class BeltConnectorHandler {
|
|||
continue;
|
||||
if (i == 0 && j == 0 && k == 0)
|
||||
continue;
|
||||
validDiffs.add(new Vec3d(i, j, k));
|
||||
validDiffs.add(new Vector3d(i, j, k));
|
||||
}
|
||||
int closestIndex = 0;
|
||||
float closest = Float.MAX_VALUE;
|
||||
for (Vec3d validDiff : validDiffs) {
|
||||
for (Vector3d validDiff : validDiffs) {
|
||||
double distanceTo = step.distanceTo(validDiff);
|
||||
if (distanceTo < closest) {
|
||||
closest = (float) distanceTo;
|
||||
|
@ -122,9 +122,9 @@ public class BeltConnectorHandler {
|
|||
if (axis == Axis.Y && step.x != 0 && step.z != 0)
|
||||
return;
|
||||
|
||||
step = new Vec3d(Math.signum(step.x), Math.signum(step.y), Math.signum(step.z));
|
||||
step = new Vector3d(Math.signum(step.x), Math.signum(step.y), Math.signum(step.z));
|
||||
for (float f = 0; f < length; f += .0625f) {
|
||||
Vec3d position = start.add(step.scale(f));
|
||||
Vector3d position = start.add(step.scale(f));
|
||||
if (r.nextInt(10) == 0) {
|
||||
world.addParticle(new RedstoneParticleData(canConnect ? .3f : .9f, canConnect ? .9f : .3f, .5f, 1),
|
||||
position.x + .5f, position.y + .5f, position.z + .5f, 0, 0, 0);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue