Skip to content

Commit

Permalink
Update to 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 1, 2024
1 parent c56a084 commit 679a9b2
Show file tree
Hide file tree
Showing 117 changed files with 701 additions and 362 deletions.
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation 'eu.pb4:polymer-core:0.10.2+1.21.3'
modImplementation 'eu.pb4:polymer-resource-pack:0.10.2+1.21.3'
modImplementation 'eu.pb4:polymer-autohost:0.10.2+1.21.3'
modImplementation 'eu.pb4:polymer-virtual-entity:0.10.2+1.21.3'
modImplementation 'eu.pb4:polymer-core:0.11.0+1.21.4-rc1'
modImplementation 'eu.pb4:polymer-resource-pack:0.11.0+1.21.4-rc1'
modImplementation 'eu.pb4:polymer-resource-pack-extras:0.11.0+1.21.4-rc1'
modImplementation 'eu.pb4:polymer-autohost:0.11.0+1.21.4-rc1'
modImplementation 'eu.pb4:polymer-virtual-entity:0.11.0+1.21.4-rc1'
modImplementation include('eu.pb4:map-canvas-api:0.5.0+1.21.3')
modImplementation include('eu.pb4:common-protection-api:1.0.0')
modImplementation include('eu.pb4:sidebar-api:0.5.1+1.21.1')
modImplementation include('eu.pb4:sgui:1.7.2+1.21.2')
modImplementation include('eu.pb4:factorytools:0.4.1+1.21.3')
modImplementation include('eu.pb4:sgui:1.8.1+1.21.4')
modImplementation include('eu.pb4:factorytools:0.5.0+1.21.4')
modImplementation include('com.kneelawk.graphlib:graphlib-core-fabric:2.0.3+1.21')

// Temp hack to allow development
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.1
minecraft_version=1.21.4-rc3
yarn_mappings=1.21.4-rc3+build.1
loader_version=0.16.9

# Mod Properties
mod_version = 0.5.2
mod_version = 0.6.0
maven_group = eu.pb4
archives_base_name = polyfactory

# Dependencies
fabric_version=0.106.1+1.21.3
fabric_version=0.110.2+1.21.4
3 changes: 2 additions & 1 deletion src/main/java/eu/pb4/polyfactory/ModInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import eu.pb4.polyfactory.block.FactoryBlocks;
import eu.pb4.polyfactory.item.FactoryItems;
import eu.pb4.polyfactory.nodes.FactoryNodes;
import eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.loader.api.FabricLoader;
Expand Down Expand Up @@ -87,7 +88,7 @@ public void onInitialize() {
GuiTextures.register();
PolydexCompat.register();
PolymerResourcePackUtils.addModAssets(ID);
PolymerResourcePackUtils.addBridgedModelsFolder(id("block"), id("sgui"), id("particle"));
ResourcePackExtras.forDefault().addBridgedModelsFolder(id("block"), id("sgui"), id("particle"));
PolymerResourcePackUtils.markAsRequired();

FluidTextures.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import eu.pb4.polymer.virtualentity.api.attachment.BlockAwareAttachment;
import eu.pb4.polymer.virtualentity.api.attachment.HolderAttachment;
import eu.pb4.polymer.virtualentity.api.elements.ItemDisplayElement;
import it.unimi.dsi.fastutil.ints.IntList;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.CustomModelDataComponent;
import net.minecraft.component.type.DyedColorComponent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -99,8 +101,8 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
var stack = super.getPickStack(world, pos, state);
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
var stack = super.getPickStack(world, pos, state, includeData);
if (world.getBlockEntity(pos) instanceof ColorProvider be && !be.isDefaultColor()) {
ColoredItem.setColor(stack, be.getColor());
}
Expand Down Expand Up @@ -281,7 +283,7 @@ protected final boolean hasCable(BlockState state) {

protected void updateModel() {
var stack = getModel(this.state, AbstractCableBlock::checkModelDirection);
stack.set(DataComponentTypes.DYED_COLOR, new DyedColorComponent(this.color, false));
stack.set(DataComponentTypes.CUSTOM_MODEL_DATA, new CustomModelDataComponent(List.of(), List.of(), List.of(), IntList.of(this.color)));
this.cable.setItem(stack);

if (this.cable.getHolder() == this && this.color >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void updateStatePos(BlockState state, EnumProperty<Direction> property,

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public WallWithCableBlock(Settings settings, WallBlock wallBlock) {
}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
return this.backing.getPickStack(world, pos, this.backing.getDefaultState());
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
return this.backing.getDefaultState().getPickStack(world, pos, includeData);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public DataMemoryBlock(Settings settings) {
}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
var x = super.getPickStack(world, pos, state);
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
var x = super.getPickStack(world, pos, state, includeData);
x.set(FactoryDataComponents.READ_ONLY, state.get(READ_ONLY));
if (world.getBlockEntity(pos) instanceof DataCache cache && cache.getCachedData() != null) {
x.set(FactoryDataComponents.STORED_DATA, cache.getCachedData());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public HologramProjectorBlock(Settings settings) {

var rot = switch (direction) {
case UP, DOWN -> ctx.getHorizontalPlayerFacing().getAxis() == Direction.Axis.Z
? ctx.getHorizontalPlayerFacing().getHorizontal() : ctx.getHorizontalPlayerFacing().getOpposite().getHorizontal();
? ctx.getHorizontalPlayerFacing().getHorizontalQuarterTurns() : ctx.getHorizontalPlayerFacing().getOpposite().getHorizontalQuarterTurns();
case NORTH, SOUTH, WEST, EAST -> ctx.getHorizontalPlayerFacing().getAxis() == ctx.getSide().getAxis()
? (ctx.getVerticalPlayerLookDirection() == Direction.UP ? 2 : 0)
: ((ctx.getHorizontalPlayerFacing().getDirection() == Direction.AxisDirection.POSITIVE) == (direction.getAxis() == Direction.Axis.Z) ? 1 : 3);
Expand Down Expand Up @@ -280,7 +280,7 @@ protected void onTick() {
this.sendPacket(new ParticleS2CPacket(new DustColorTransitionParticleEffect(
ColorHelper.getArgb(133, 250, 255),
ColorHelper.getArgb(235, 254, 255),
0.8f), false, pos.x, pos.y, pos.z, 0, 0, 0, 0, 0));
0.8f), false, false, pos.x, pos.y, pos.z, 0, 0, 0, 0, 0));

if (this.currentDisplay != null) {
this.currentDisplay.startInterpolationIfDirty();
Expand All @@ -303,13 +303,13 @@ private void updateStatePos(BlockState state) {
this.facing = dir;
this.active = state.get(ACTIVE);
float p = 0;
float y = rot.asRotation();
float y = rot.getPositiveHorizontalDegrees();

y = rot.asRotation();
y = rot.getPositiveHorizontalDegrees();
var q = new Quaternionf();
if (dir.getAxis() != Direction.Axis.Y) {
p = 90;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
q.rotateY((float) (MathHelper.HALF_PI * state.get(FRONT)));
} else if (dir == Direction.DOWN) {
p = 180;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import eu.pb4.polyfactory.util.FactoryUtil;
import eu.pb4.polymer.virtualentity.api.ElementHolder;
import eu.pb4.polymer.virtualentity.api.elements.ItemDisplayElement;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.RedstoneWireBlock;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.CustomModelDataComponent;
import net.minecraft.component.type.DyedColorComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand All @@ -40,7 +42,7 @@
import java.util.List;

import static eu.pb4.polyfactory.util.FactoryUtil.id;
import static eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils.bridgeModel;
import static eu.pb4.polymer.resourcepack.extras.api.ResourcePackExtras.bridgeModel;

public class RedstoneOutputBlock extends GenericCabledDataBlock implements DataReceiver, RedstoneConnectable {
public static final IntProperty POWER = Properties.POWER;
Expand Down Expand Up @@ -115,9 +117,9 @@ public Model(BlockState state) {
}

private ItemStack createOverlay(BlockState state) {
var stack = new ItemStack(Items.LEATHER_HORSE_ARMOR);
var stack = new ItemStack(Items.PAPER);
stack.set(DataComponentTypes.ITEM_MODEL, state.isOf(FactoryBlocks.REDSTONE_OUTPUT) ? OUTPUT_OVERLAY : INPUT_OVERLAY);
stack.set(DataComponentTypes.DYED_COLOR, new DyedColorComponent(RedstoneWireBlock.getWireColor(state.get(POWER)), false));
stack.set(DataComponentTypes.CUSTOM_MODEL_DATA, new CustomModelDataComponent(List.of(), List.of(), List.of(), IntList.of(RedstoneWireBlock.getWireColor(state.get(POWER)))));
return stack;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
Expand Down Expand Up @@ -82,7 +83,9 @@ public void onProjectileHit(World world, BlockState state, BlockHitResult hit, P
var holder = BlockBoundAttachment.get(world, hit.getBlockPos());

if (holder != null && holder.holder() instanceof Model x) {
x.interact(projectile.getYaw());
var delta = hit.getPos().subtract(Vec3d.ofCenter(hit.getBlockPos()));
var angle = Math.atan2(delta.x, -delta.z);
x.interact((float) angle * MathHelper.DEGREES_PER_RADIAN);
}
}

Expand Down Expand Up @@ -211,7 +214,7 @@ protected void onTick() {
}

private void updateRotation(Direction dir) {
float y = dir.asRotation();
float y = dir.getPositiveHorizontalDegrees();

this.base.setYaw(y);
this.tater.setYaw(y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public <T> Stream<T> keys(DynamicOps<T> ops) {
}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
return this.asItem().getDefaultStack();
}

Expand Down Expand Up @@ -205,7 +205,7 @@ protected void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private Model(BlockState state) {
private void updateStatePos(BlockState state) {
var direction = state.get(INPUT_FACING);

this.main.setYaw(direction.asRotation());
this.main.setYaw(direction.getPositiveHorizontalDegrees());
}

private void updateAnimation(float rotation, Direction.Axis axis) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected void updatePosition(int id) {
if (id == INPUT_FIRST) {
base = base.add(0, 0.50, 0).offset(dir, -(this.visualProgress - 0.5) * (8 / 16f)).offset(dir.rotateYClockwise(), -4 / 16f);
rot = Direction.UP.getRotationQuaternion()
.rotateY(-dir.rotateYClockwise().asRotation() * MathHelper.RADIANS_PER_DEGREE)
.rotateY(-dir.rotateYClockwise().getPositiveHorizontalDegrees() * MathHelper.RADIANS_PER_DEGREE)
.rotateX(MathHelper.PI * 3 / 4);
} else {
base = base.add(0, 0.45, 0).offset(dir, -0.3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ private Model(ServerWorld world, BlockState state) {
private void updateStatePos(BlockState state) {
var direction = state.get(INPUT_FACING);

this.main.setYaw(direction.asRotation());
this.gearA.setYaw(direction.asRotation());
this.gearB.setYaw(direction.asRotation());
this.main.setYaw(direction.getPositiveHorizontalDegrees());
this.gearA.setYaw(direction.getPositiveHorizontalDegrees());
this.gearB.setYaw(direction.getPositiveHorizontalDegrees());
}

private void updateAnimation(float rotation, boolean negative) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected void updatePosition(int id) {
scale = 1.25f;
} else {
base = base.add(0, 10f / 16, 0);
rot = Direction.UP.getRotationQuaternion().rotateY(dir.asRotation() * MathHelper.RADIANS_PER_DEGREE);
rot = Direction.UP.getRotationQuaternion().rotateY(dir.getPositiveHorizontalDegrees() * MathHelper.RADIANS_PER_DEGREE);
}
} else {
base = base.add(0, 7.5 / 16, 0).offset(dir, -0.4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
public void onPolymerBlockSend(BlockState blockState, BlockPos.Mutable pos, PacketContext.NotNullWithPlayer player) {}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
return FactoryItems.STEEL_GEAR.getDefaultStack();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public AxleWithLargeGearBlock(Settings settings) {
}

@Override
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) {
return FactoryItems.LARGE_STEEL_GEAR.getDefaultStack();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void updateStatePos(BlockState state) {

if (dir.getAxis() != Direction.Axis.Y) {
p = 0;
y = dir.asRotation();
y = dir.getPositiveHorizontalDegrees();
} else if (dir == Direction.DOWN) {
p = 90;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ private ItemStack getFastModel(DirectionValue directionValue, boolean sticky, Bl
private void updateAnimation(Direction dir, DirectionValue value) {
if (dir != this.direction || value != this.value) {
var mat = mat();
mat.identity().translate(0, 0.5f, 0).rotateY((270 - dir.asRotation()) * MathHelper.RADIANS_PER_DEGREE);
mat.identity().translate(0, 0.5f, 0).rotateY((270 - dir.getPositiveHorizontalDegrees()) * MathHelper.RADIANS_PER_DEGREE);
if (value.value == -1 && !value.stack) {
mat.rotateY(MathHelper.PI);
}
Expand Down Expand Up @@ -611,7 +611,7 @@ public void updateDelta(double oldDelta, double newDelta) {

if (movingItemContainer != null) {
movingItemContainer.setPos(calculatePos(newDelta));
var base = new Quaternionf().rotateY(this.direction.asRotation() * MathHelper.RADIANS_PER_DEGREE);
var base = new Quaternionf().rotateY(this.direction.getPositiveHorizontalDegrees() * MathHelper.RADIANS_PER_DEGREE);
if (this.value.stack) {
base.rotateX(MathHelper.HALF_PI);
} else if (this.value.value != 0) {
Expand Down
Loading

0 comments on commit 679a9b2

Please sign in to comment.