mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 14:54:42 +01:00
Merge branch 'mc1.20.1/feature-dev' into mc1.21.1/dev
# Conflicts: # src/main/java/com/simibubi/create/content/kinetics/chainConveyor/ChainConveyorRidingHandler.java # src/main/java/com/simibubi/create/content/kinetics/waterwheel/WaterWheelVisual.java
This commit is contained in:
commit
3a404d3493
24 changed files with 222 additions and 159 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2025-01-18T13:14:26.2262033 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
|
||||
// 1.20.1 2025-01-18T17:58:23.8133105 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
|
||||
60bbdf92d2ac9824ea6144955c74043a6005f79d assets/create/blockstates/acacia_window.json
|
||||
6a67703c2697d81b7dc83e9d72a66f9c9ff08383 assets/create/blockstates/acacia_window_pane.json
|
||||
c3ae87b62e81d8e9476eccd793bb1548d74c66a1 assets/create/blockstates/adjustable_chain_gearshift.json
|
||||
|
@ -2369,9 +2369,15 @@ ebffb05119f499fcec051a4337aadc47654baed2 assets/create/models/item/purple_valve_
|
|||
f91405b9aec1e0142c1b90582e03a1973251da05 assets/create/models/item/radial_chassis.json
|
||||
1c984ea9dbaec02e88dba1b81906c9acca7ed672 assets/create/models/item/railway_casing.json
|
||||
87c4c0e13441cf0238103ca065c0c16f80f60f26 assets/create/models/item/rare_creeper_package.json
|
||||
f15145349b717dbd58b696019d38c7c8c506dee2 assets/create/models/item/rare_darcy_package.json
|
||||
8bb602b530ac2c1301776b83673ef062b7b0ace6 assets/create/models/item/rare_evan_package.json
|
||||
f982794c2e01a70fcc2bb009bcb8cd06a2ea5510 assets/create/models/item/rare_jinx_package.json
|
||||
9f4de06da4d9c2b54b758b2b01e0595811338b94 assets/create/models/item/rare_kryppers_package.json
|
||||
7830b48ef4292922f0ef13f9a7c2ee7d47366169 assets/create/models/item/rare_simi_package.json
|
||||
fd2345d4e4012ba238501985962cf9d34ab2cd34 assets/create/models/item/rare_starlotte_package.json
|
||||
d3274003067a943d749ba5d23b5abc0fee8727a2 assets/create/models/item/rare_thunder_package.json
|
||||
95aae4907a2435e31f079411dd1b3625ab2689c4 assets/create/models/item/rare_up_package.json
|
||||
48ceaaead35ae1422542a615c9db55bd88f464e6 assets/create/models/item/rare_vector_package.json
|
||||
5f8e5283fbebb452f1a1141b33ee73f08879c75d assets/create/models/item/raw_zinc.json
|
||||
4631d67976cef148c346a7016baaa6703e4f243e assets/create/models/item/raw_zinc_block.json
|
||||
9dc6c52e258b00cac6ed23147983045c43218b5d assets/create/models/item/redstone_contact.json
|
||||
|
@ -4713,7 +4719,7 @@ ebd7b09daf2f64c0c04d821696b0e145683d8693 data/create/tags/items/dyed_table_cloth
|
|||
d2bb65d893d71d2d9871f81f430c233a93adb4bb data/create/tags/items/invalid_for_track_paving.json
|
||||
1cebeb92bd514b75d54ac6d5708047801f0501c5 data/create/tags/items/modded_stripped_logs.json
|
||||
586f8fc5a8b8559c9dc0017e13c78ad918688fae data/create/tags/items/modded_stripped_wood.json
|
||||
b96668734c9b7a90348235217512d49193e4ea7f data/create/tags/items/packages.json
|
||||
cebf5fd98eddf5c14befdd47052be678eea79542 data/create/tags/items/packages.json
|
||||
f400870b8dbcd14238be3ec99c419093073ba3a6 data/create/tags/items/postboxes.json
|
||||
695d75b352fd190b303c724d1aaee9bb786a903b data/create/tags/items/pressurized_air_sources.json
|
||||
22c4d4e033a61942b170aa309ed46a89a0ba0c65 data/create/tags/items/pulpifiable.json
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_darcy"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_evan"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_starlotte"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_thunder"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_up"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:item/package/custom_12x10",
|
||||
"textures": {
|
||||
"2": "create:item/package/rare_vector"
|
||||
}
|
||||
}
|
|
@ -4,9 +4,15 @@
|
|||
"create:cardboard_package_10x12",
|
||||
"create:cardboard_package_10x8",
|
||||
"create:cardboard_package_12x10",
|
||||
"create:rare_kryppers_package",
|
||||
"create:rare_jinx_package",
|
||||
"create:rare_creeper_package",
|
||||
"create:rare_simi_package"
|
||||
"create:rare_darcy_package",
|
||||
"create:rare_evan_package",
|
||||
"create:rare_jinx_package",
|
||||
"create:rare_kryppers_package",
|
||||
"create:rare_simi_package",
|
||||
"create:rare_starlotte_package",
|
||||
"create:rare_thunder_package",
|
||||
"create:rare_up_package",
|
||||
"create:rare_vector_package"
|
||||
]
|
||||
}
|
|
@ -15,45 +15,6 @@ public abstract class KineticBlockEntityVisual<T extends KineticBlockEntity> ext
|
|||
super(context, blockEntity, partialTick);
|
||||
}
|
||||
|
||||
protected final void updateRotation(RotatingInstance instance) {
|
||||
instance.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
protected final void updateRotation(RotatingInstance instance, Direction.Axis axis) {
|
||||
instance.setup(blockEntity, axis)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
protected final void updateRotation(RotatingInstance instance, float speed) {
|
||||
instance.setup(blockEntity, speed)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
protected final void updateRotation(RotatingInstance instance, Direction.Axis axis, float speed) {
|
||||
instance.setup(blockEntity, axis, speed)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
protected final RotatingInstance setup(RotatingInstance key) {
|
||||
key.setup(blockEntity).setPosition(getVisualPosition()).setChanged();
|
||||
return key;
|
||||
}
|
||||
|
||||
protected final RotatingInstance setup(RotatingInstance key, Direction.Axis axis) {
|
||||
key.setup(blockEntity, axis).setPosition(getVisualPosition()).setChanged();
|
||||
return key;
|
||||
}
|
||||
|
||||
protected final RotatingInstance setup(RotatingInstance key, float speed) {
|
||||
key.setup(blockEntity, speed).setPosition(getVisualPosition()).setChanged();
|
||||
return key;
|
||||
}
|
||||
|
||||
protected float getRotationOffset(final Direction.Axis axis) {
|
||||
return rotationOffset(blockState, axis, pos) + blockEntity.getRotationAngleOffset(axis);
|
||||
}
|
||||
|
||||
protected Direction.Axis rotationAxis() {
|
||||
return rotationAxis(blockState);
|
||||
}
|
||||
|
|
|
@ -60,9 +60,13 @@ public class BeltVisual extends KineticBlockEntityVisual<BeltBlockEntity> {
|
|||
}
|
||||
|
||||
if (blockEntity.hasPulley()) {
|
||||
pulley = setup(instancerProvider()
|
||||
pulley = instancerProvider()
|
||||
.instancer(AllInstanceTypes.ROTATING, getPulleyModel())
|
||||
.createInstance());
|
||||
.createInstance();
|
||||
|
||||
pulley.setup(BeltVisual.this.blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.setChanged();
|
||||
} else {
|
||||
pulley = null;
|
||||
}
|
||||
|
@ -82,8 +86,9 @@ public class BeltVisual extends KineticBlockEntityVisual<BeltBlockEntity> {
|
|||
}
|
||||
|
||||
if (pulley != null) {
|
||||
updateRotation(pulley);
|
||||
}
|
||||
pulley.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
|
|||
boolean centered = BeltHelper.isItemUpright(stack);
|
||||
angle = centered ? 180 : R.nextInt(360);
|
||||
if (PackageItem.isPackage(stack))
|
||||
angle = 180 + R.nextInt(10);
|
||||
angle = R.nextInt(4) * 90 + R.nextInt(20) - 10;
|
||||
sideOffset = prevSideOffset = getTargetSideOffset();
|
||||
insertedFrom = Direction.UP;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.content.kinetics.chainConveyor;
|
||||
|
||||
import com.simibubi.create.AllTags.AllItemTags;
|
||||
import com.simibubi.create.content.kinetics.chainConveyor.ChainConveyorBlockEntity.ConnectionStats;
|
||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||
|
||||
|
@ -45,6 +46,10 @@ public class ChainConveyorRidingHandler {
|
|||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.isPaused())
|
||||
return;
|
||||
if (!AllItemTags.WRENCH.matches(mc.player.getMainHandItem())) {
|
||||
stopRiding();
|
||||
return;
|
||||
}
|
||||
BlockEntity blockEntity = mc.level.getBlockEntity(ridingChainConveyor);
|
||||
if (mc.player.isShiftKeyDown() || !(blockEntity instanceof ChainConveyorBlockEntity clbe)) {
|
||||
stopRiding();
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.simibubi.create.content.kinetics.base.RotatingInstance;
|
|||
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||
|
||||
import dev.engine_room.flywheel.api.instance.Instance;
|
||||
import dev.engine_room.flywheel.api.model.Model;
|
||||
import dev.engine_room.flywheel.api.visual.DynamicVisual;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
|
||||
import dev.engine_room.flywheel.lib.instance.InstanceTypes;
|
||||
|
@ -33,9 +32,12 @@ public class HandCrankVisual extends KineticBlockEntityVisual<HandCrankBlockEnti
|
|||
rotateCrank(partialTick);
|
||||
|
||||
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.HAND_CRANK_BASE))
|
||||
.createInstance()
|
||||
.rotateToFace(blockState.getValue(BlockStateProperties.FACING));
|
||||
setup(rotatingModel);
|
||||
.createInstance();
|
||||
|
||||
rotatingModel.setup(HandCrankVisual.this.blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(blockState.getValue(BlockStateProperties.FACING))
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,7 +66,8 @@ public class HandCrankVisual extends KineticBlockEntityVisual<HandCrankBlockEnti
|
|||
|
||||
@Override
|
||||
public void update(float pt) {
|
||||
updateRotation(rotatingModel);
|
||||
rotatingModel.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,9 +32,14 @@ public class FlywheelVisual extends KineticBlockEntityVisual<FlywheelBlockEntity
|
|||
super(context, blockEntity, partialTick);
|
||||
|
||||
var axis = rotationAxis();
|
||||
shaft = setup(instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT))
|
||||
.createInstance())
|
||||
.rotateToFace(axis);
|
||||
shaft = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT))
|
||||
.createInstance();
|
||||
|
||||
shaft.setup(FlywheelVisual.this.blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(axis)
|
||||
.setChanged();
|
||||
|
||||
wheel = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.FLYWHEEL))
|
||||
.createInstance();
|
||||
|
||||
|
@ -75,7 +80,8 @@ public class FlywheelVisual extends KineticBlockEntityVisual<FlywheelBlockEntity
|
|||
|
||||
@Override
|
||||
public void update(float pt) {
|
||||
updateRotation(shaft);
|
||||
shaft.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.RotatingInstance;
|
||||
import com.simibubi.create.content.kinetics.base.SingleAxisRotatingVisual;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogVisual;
|
||||
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||
|
||||
|
@ -17,14 +18,14 @@ import dev.engine_room.flywheel.lib.model.Models;
|
|||
import dev.engine_room.flywheel.lib.visual.SimpleDynamicVisual;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
public class MixerVisual extends EncasedCogVisual implements SimpleDynamicVisual {
|
||||
public class MixerVisual extends SingleAxisRotatingVisual<MechanicalMixerBlockEntity> implements SimpleDynamicVisual {
|
||||
|
||||
private final RotatingInstance mixerHead;
|
||||
private final OrientedInstance mixerPole;
|
||||
private final MechanicalMixerBlockEntity mixer;
|
||||
|
||||
public MixerVisual(VisualizationContext context, MechanicalMixerBlockEntity blockEntity, float partialTick) {
|
||||
super(context, blockEntity, false, partialTick);
|
||||
super(context, blockEntity, partialTick, Models.partial(AllPartialModels.SHAFTLESS_COGWHEEL));
|
||||
this.mixer = blockEntity;
|
||||
|
||||
mixerHead = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.MECHANICAL_MIXER_HEAD))
|
||||
|
@ -38,11 +39,6 @@ public class MixerVisual extends EncasedCogVisual implements SimpleDynamicVisual
|
|||
animate(partialTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Model getCogModel() {
|
||||
return Models.partial(AllPartialModels.SHAFTLESS_COGWHEEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame(DynamicVisual.Context ctx) {
|
||||
animate(ctx.partialTick());
|
||||
|
|
|
@ -56,9 +56,9 @@ public class BracketedKineticBlockEntityVisual {
|
|||
@Override
|
||||
public void update(float pt) {
|
||||
super.update(pt);
|
||||
updateRotation(additionalShaft);
|
||||
additionalShaft.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos))
|
||||
.setChanged();
|
||||
additionalShaft.setup(blockEntity)
|
||||
.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos))
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,19 +38,24 @@ public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntit
|
|||
protected final RotatingInstance rotatingBottomShaft;
|
||||
|
||||
public static EncasedCogVisual small(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
|
||||
return new EncasedCogVisual(modelManager, blockEntity, false, partialTick);
|
||||
return new EncasedCogVisual(modelManager, blockEntity, false, partialTick, Models.partial(AllPartialModels.SHAFTLESS_COGWHEEL));
|
||||
}
|
||||
|
||||
public static EncasedCogVisual large(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
|
||||
return new EncasedCogVisual(modelManager, blockEntity, true, partialTick);
|
||||
return new EncasedCogVisual(modelManager, blockEntity, true, partialTick, Models.partial(AllPartialModels.SHAFTLESS_LARGE_COGWHEEL));
|
||||
}
|
||||
|
||||
public EncasedCogVisual(VisualizationContext modelManager, KineticBlockEntity blockEntity, boolean large, float partialTick) {
|
||||
public EncasedCogVisual(VisualizationContext modelManager, KineticBlockEntity blockEntity, boolean large, float partialTick, Model model) {
|
||||
super(modelManager, blockEntity, partialTick);
|
||||
this.large = large;
|
||||
|
||||
var instancer = instancerProvider().instancer(AllInstanceTypes.ROTATING, getCogModel());
|
||||
rotatingModel = setup(instancer.createInstance());
|
||||
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, model)
|
||||
.createInstance();
|
||||
|
||||
rotatingModel.setup(blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(rotationAxis())
|
||||
.setChanged();
|
||||
|
||||
RotatingInstance rotatingTopShaft = null;
|
||||
RotatingInstance rotatingBottomShaft = null;
|
||||
|
@ -60,15 +65,21 @@ public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntit
|
|||
for (Direction d : Iterate.directionsInAxis(rotationAxis())) {
|
||||
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
|
||||
continue;
|
||||
RotatingInstance data = setup(instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF, d))
|
||||
.createInstance());
|
||||
RotatingInstance instance = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF))
|
||||
.createInstance();
|
||||
instance.setup(blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(Direction.SOUTH, d)
|
||||
.setChanged();
|
||||
|
||||
if (large) {
|
||||
data.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos));
|
||||
instance.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos));
|
||||
}
|
||||
|
||||
if (d.getAxisDirection() == AxisDirection.POSITIVE) {
|
||||
rotatingTopShaft = data;
|
||||
rotatingTopShaft = instance;
|
||||
} else {
|
||||
rotatingBottomShaft = data;
|
||||
rotatingBottomShaft = instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,9 +90,12 @@ public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntit
|
|||
|
||||
@Override
|
||||
public void update(float pt) {
|
||||
updateRotation(rotatingModel);
|
||||
if (rotatingTopShaft != null) updateRotation(rotatingTopShaft);
|
||||
if (rotatingBottomShaft != null) updateRotation(rotatingBottomShaft);
|
||||
rotatingModel.setup(blockEntity)
|
||||
.setChanged();
|
||||
if (rotatingTopShaft != null) rotatingTopShaft.setup(blockEntity)
|
||||
.setChanged();
|
||||
if (rotatingBottomShaft != null) rotatingBottomShaft.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,23 +110,6 @@ public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntit
|
|||
if (rotatingBottomShaft != null) rotatingBottomShaft.delete();
|
||||
}
|
||||
|
||||
protected Model getCogModel() {
|
||||
BlockState referenceState = blockEntity.getBlockState();
|
||||
Direction facing =
|
||||
Direction.fromAxisAndDirection(referenceState.getValue(BlockStateProperties.AXIS), AxisDirection.POSITIVE);
|
||||
PartialModel partial = large ? AllPartialModels.SHAFTLESS_LARGE_COGWHEEL : AllPartialModels.SHAFTLESS_COGWHEEL;
|
||||
|
||||
return Models.partial(partial, facing, EncasedCogVisual::transformCog);
|
||||
}
|
||||
|
||||
private static void transformCog(Direction dir, PoseStack stack) {
|
||||
TransformStack.of(stack)
|
||||
.center()
|
||||
.rotateToFace(dir)
|
||||
.rotate(Axis.XN.rotationDegrees(90))
|
||||
.uncenter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectCrumblingInstances(Consumer<@Nullable Instance> consumer) {
|
||||
consumer.accept(rotatingModel);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package com.simibubi.create.content.kinetics.waterwheel;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public record WaterWheelModelKey(boolean large, BlockState state, BlockState material) {
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.AllPartialModels;
|
|||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.model.BakedModelHelper;
|
||||
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.createmod.catnip.render.StitchedSprite;
|
||||
|
@ -37,7 +38,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
|
||||
public class WaterWheelRenderer<T extends WaterWheelBlockEntity> extends KineticBlockEntityRenderer<T> {
|
||||
public static final SuperByteBufferCache.Compartment<WaterWheelModelKey> WATER_WHEEL = new SuperByteBufferCache.Compartment<>();
|
||||
public static final SuperByteBufferCache.Compartment<ModelKey> WATER_WHEEL = new SuperByteBufferCache.Compartment<>();
|
||||
|
||||
public static final StitchedSprite OAK_PLANKS_TEMPLATE = new StitchedSprite(ResourceLocation.withDefaultNamespace("block/oak_planks"));
|
||||
public static final StitchedSprite OAK_LOG_TEMPLATE = new StitchedSprite(ResourceLocation.withDefaultNamespace("block/oak_log"));
|
||||
|
@ -60,7 +61,7 @@ public class WaterWheelRenderer<T extends WaterWheelBlockEntity> extends Kinetic
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(T be, BlockState state) {
|
||||
WaterWheelModelKey key = new WaterWheelModelKey(large, state, be.material);
|
||||
ModelKey key = new ModelKey(large, state, be.material);
|
||||
return SuperByteBufferCache.getInstance().get(WATER_WHEEL, key, () -> {
|
||||
BakedModel model = generateModel(key);
|
||||
BlockState state1 = key.state();
|
||||
|
@ -75,21 +76,12 @@ public class WaterWheelRenderer<T extends WaterWheelBlockEntity> extends Kinetic
|
|||
});
|
||||
}
|
||||
|
||||
public static BakedModel generateModel(WaterWheelModelKey key) {
|
||||
BakedModel template;
|
||||
if (key.large()) {
|
||||
boolean extension = key.state()
|
||||
.getValue(LargeWaterWheelBlock.EXTENSION);
|
||||
if (extension) {
|
||||
template = AllPartialModels.LARGE_WATER_WHEEL_EXTENSION.get();
|
||||
} else {
|
||||
template = AllPartialModels.LARGE_WATER_WHEEL.get();
|
||||
}
|
||||
} else {
|
||||
template = AllPartialModels.WATER_WHEEL.get();
|
||||
}
|
||||
public static BakedModel generateModel(ModelKey key) {
|
||||
return generateModel(Variant.of(key.large(), key.state()), key.material());
|
||||
}
|
||||
|
||||
return generateModel(template, key.material());
|
||||
public static BakedModel generateModel(Variant variant, BlockState material) {
|
||||
return generateModel(variant.model(), material);
|
||||
}
|
||||
|
||||
public static BakedModel generateModel(BakedModel template, BlockState planksBlockState) {
|
||||
|
@ -170,4 +162,36 @@ public class WaterWheelRenderer<T extends WaterWheelBlockEntity> extends Kinetic
|
|||
return model.getParticleIcon(ModelData.EMPTY);
|
||||
}
|
||||
|
||||
public enum Variant {
|
||||
SMALL(AllPartialModels.WATER_WHEEL),
|
||||
LARGE(AllPartialModels.LARGE_WATER_WHEEL),
|
||||
LARGE_EXTENSION(AllPartialModels.LARGE_WATER_WHEEL_EXTENSION),
|
||||
;
|
||||
|
||||
private final PartialModel partial;
|
||||
|
||||
Variant(PartialModel partial) {
|
||||
this.partial = partial;
|
||||
}
|
||||
|
||||
public BakedModel model() {
|
||||
return partial.get();
|
||||
}
|
||||
|
||||
public static Variant of(boolean large, BlockState blockState) {
|
||||
if (large) {
|
||||
boolean extension = blockState.getValue(LargeWaterWheelBlock.EXTENSION);
|
||||
if (extension) {
|
||||
return LARGE_EXTENSION;
|
||||
} else {
|
||||
return LARGE;
|
||||
}
|
||||
} else {
|
||||
return SMALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record ModelKey(boolean large, BlockState state, BlockState material) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simibubi.create.content.kinetics.waterwheel;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
|
||||
import com.simibubi.create.content.kinetics.base.RotatingInstance;
|
||||
import com.simibubi.create.content.kinetics.waterwheel.WaterWheelRenderer.Variant;
|
||||
import com.simibubi.create.foundation.render.AllInstanceTypes;
|
||||
|
||||
import dev.engine_room.flywheel.api.instance.Instance;
|
||||
|
@ -12,14 +12,11 @@ import dev.engine_room.flywheel.api.model.Model;
|
|||
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
|
||||
import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder;
|
||||
import dev.engine_room.flywheel.lib.util.RendererReloadCache;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class WaterWheelVisual<T extends WaterWheelBlockEntity> extends KineticBlockEntityVisual<T> {
|
||||
private static final RendererReloadCache<WaterWheelModelKey, Model> MODEL_CACHE = new RendererReloadCache<>(WaterWheelVisual::createModel);
|
||||
private static final RendererReloadCache<ModelKey, Model> MODEL_CACHE = new RendererReloadCache<>(WaterWheelVisual::createModel);
|
||||
|
||||
protected final boolean large;
|
||||
protected BlockState lastMaterial;
|
||||
|
@ -42,9 +39,12 @@ public class WaterWheelVisual<T extends WaterWheelBlockEntity> extends KineticBl
|
|||
|
||||
private void setupInstance() {
|
||||
lastMaterial = blockEntity.material;
|
||||
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, MODEL_CACHE.get(new WaterWheelModelKey(large, blockState, blockEntity.material)))
|
||||
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, MODEL_CACHE.get(new ModelKey(Variant.of(large, blockState), blockEntity.material)))
|
||||
.createInstance();
|
||||
setup(rotatingModel);
|
||||
rotatingModel.setup(blockEntity)
|
||||
.setPosition(getVisualPosition())
|
||||
.rotateToFace(rotationAxis())
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,9 +52,10 @@ public class WaterWheelVisual<T extends WaterWheelBlockEntity> extends KineticBl
|
|||
if (lastMaterial != blockEntity.material) {
|
||||
rotatingModel.delete();
|
||||
setupInstance();
|
||||
} else {
|
||||
rotatingModel.setup(blockEntity)
|
||||
.setChanged();
|
||||
}
|
||||
|
||||
updateRotation(rotatingModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,18 +73,13 @@ public class WaterWheelVisual<T extends WaterWheelBlockEntity> extends KineticBl
|
|||
consumer.accept(rotatingModel);
|
||||
}
|
||||
|
||||
private static Model createModel(WaterWheelModelKey key) {
|
||||
BakedModel model = WaterWheelRenderer.generateModel(key);
|
||||
BlockState state = key.state();
|
||||
Direction dir;
|
||||
if (key.large()) {
|
||||
dir = Direction.fromAxisAndDirection(state.getValue(LargeWaterWheelBlock.AXIS), AxisDirection.POSITIVE);
|
||||
} else {
|
||||
dir = state.getValue(WaterWheelBlock.FACING);
|
||||
}
|
||||
PoseStack transform = CachedBuffers.rotateToFaceVertical(dir).get();
|
||||
private static Model createModel(ModelKey key) {
|
||||
BakedModel model = WaterWheelRenderer.generateModel(key.variant(), key.material());
|
||||
return new BakedModelBuilder(model)
|
||||
.poseStack(transform)
|
||||
.build();
|
||||
}
|
||||
|
||||
public record ModelKey(WaterWheelRenderer.Variant variant, BlockState material) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,56 +4,71 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class PackageStyles {
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jetbrains.annotations.UnmodifiableView;
|
||||
|
||||
public static record PackageStyle(String type, int width, int height, float riggingOffset, boolean rare) {
|
||||
|
||||
public class PackageStyles {
|
||||
public record PackageStyle(String type, int width, int height, float riggingOffset, boolean rare) {
|
||||
public ResourceLocation getItemId() {
|
||||
String size = "_" + width + "x" + height;
|
||||
String id = type + "_package" + (rare ? "" : size);
|
||||
return Create.asResource(id);
|
||||
}
|
||||
|
||||
|
||||
public ResourceLocation getRiggingModel() {
|
||||
String size = width + "x" + height;
|
||||
return Create.asResource("item/package/rigging_" + size);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static final List<PackageStyle> STYLES = new ArrayList<>(List.of(
|
||||
|
||||
/**
|
||||
* This is used for registration, if you insert into this list, you will be registering items under Create's namespace.
|
||||
* Instead, you should handle registration yourself
|
||||
* and use the PackageItem class so your packages end up in the correct lists.
|
||||
*/
|
||||
@Internal
|
||||
@UnmodifiableView
|
||||
public static final List<PackageStyle> STYLES = ImmutableList.of(
|
||||
new PackageStyle("cardboard", 12, 12, 23f, false),
|
||||
new PackageStyle("cardboard", 10, 12, 22f, false),
|
||||
new PackageStyle("cardboard", 10, 8, 18f, false),
|
||||
new PackageStyle("cardboard", 12, 10, 21f, false),
|
||||
|
||||
new PackageStyle("rare_kryppers", 12, 10, 21f, true),
|
||||
new PackageStyle("rare_jinx", 12, 10, 21f, true),
|
||||
new PackageStyle("rare_creeper", 12, 10, 21f, true),
|
||||
new PackageStyle("rare_simi", 12, 10, 21f, true)
|
||||
|
||||
));
|
||||
rare("creeper"),
|
||||
rare("darcy"),
|
||||
rare("evan"),
|
||||
rare("jinx"),
|
||||
rare("kryppers"),
|
||||
rare("simi"),
|
||||
rare("starlotte"),
|
||||
rare("thunder"),
|
||||
rare("up"),
|
||||
rare("vector")
|
||||
);
|
||||
|
||||
public static final List<PackageItem> ALL_BOXES = new ArrayList<>();
|
||||
public static final List<PackageItem> STANDARD_BOXES = new ArrayList<>();
|
||||
public static final List<PackageItem> RARE_BOXES = new ArrayList<>();
|
||||
|
||||
private static final Random STYLE_PICKER = new Random();
|
||||
private static final int RARE_CHANCE = 5000; // addons, have mercy
|
||||
private static final int RARE_CHANCE = 7500; // addons, have mercy
|
||||
|
||||
public static ItemStack getRandomBox() {
|
||||
List<PackageItem> pool = STYLE_PICKER.nextInt(RARE_CHANCE) == 0 ? RARE_BOXES : STANDARD_BOXES;
|
||||
return new ItemStack(pool.get(STYLE_PICKER.nextInt(pool.size())));
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack getDefaultBox() {
|
||||
return new ItemStack(ALL_BOXES.get(0));
|
||||
}
|
||||
|
||||
private static PackageStyle rare(String name) {
|
||||
return new PackageStyle("rare_" + name, 12, 10, 21f, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa
|
|||
// <filtered, non-filtered>
|
||||
Couple<List<Pair<BlockPos, Direction>>> distributionTargets;
|
||||
|
||||
private boolean newItemArrived;
|
||||
private boolean syncedOutputActive;
|
||||
private Set<BrassTunnelBlockEntity> syncSet;
|
||||
|
||||
|
@ -183,11 +184,16 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa
|
|||
.isEmpty())
|
||||
return;
|
||||
|
||||
if (selectionMode.get() != SelectionMode.SYNCHRONIZE || syncedOutputActive) {
|
||||
distributionProgress = AllConfigs.server().logistics.brassTunnelTimer.get();
|
||||
sendData();
|
||||
if (newItemArrived) {
|
||||
newItemArrived = false;
|
||||
distributionProgress = 2;
|
||||
} else {
|
||||
if (selectionMode.get() != SelectionMode.SYNCHRONIZE || syncedOutputActive) {
|
||||
distributionProgress = AllConfigs.server().logistics.brassTunnelTimer.get();
|
||||
sendData();
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (distributionProgress != 0)
|
||||
|
@ -336,6 +342,8 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa
|
|||
stackToDistribute = stack;
|
||||
stackEnteredFrom = enteredFrom;
|
||||
distributionProgress = -1;
|
||||
if (!stack.isEmpty())
|
||||
newItemArrived = true;
|
||||
sendData();
|
||||
setChanged();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public class PlayerSkyhookRenderer {
|
|||
return;
|
||||
|
||||
model.head.resetPose();
|
||||
model.hat.resetPose();
|
||||
model.body.resetPose();
|
||||
model.leftArm.resetPose();
|
||||
model.rightArm.resetPose();
|
||||
|
@ -39,6 +40,7 @@ public class PlayerSkyhookRenderer {
|
|||
|
||||
private static void setHangingPose(HumanoidModel<?> model) {
|
||||
model.head.x = 0;
|
||||
model.hat.x = 0;
|
||||
model.body.resetPose();
|
||||
model.leftArm.resetPose();
|
||||
model.rightArm.resetPose();
|
||||
|
@ -53,6 +55,7 @@ public class PlayerSkyhookRenderer {
|
|||
|
||||
model.body.zRot = bodySwing;
|
||||
model.head.zRot = bodySwing;
|
||||
model.hat.zRot = bodySwing;
|
||||
|
||||
model.rightArm.y -= 3;
|
||||
|
||||
|
@ -87,12 +90,14 @@ public class PlayerSkyhookRenderer {
|
|||
model.leftLeg.xRot = AngleHelper.rad(10);
|
||||
model.leftLeg.zRot = -AngleHelper.rad(10) + 0.5f * bodySwing + limbSwing;
|
||||
|
||||
model.hat.x -= armPivotX;
|
||||
model.head.x -= armPivotX;
|
||||
model.body.x -= armPivotX;
|
||||
model.leftArm.x -= armPivotX;
|
||||
model.leftLeg.x -= armPivotX;
|
||||
model.rightLeg.x -= armPivotX;
|
||||
|
||||
model.hat.y -= armPivotY;
|
||||
model.head.y -= armPivotY;
|
||||
model.body.y -= armPivotY;
|
||||
model.leftArm.y -= armPivotY;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 365 B |
Loading…
Add table
Reference in a new issue