Merge branch 'mc1.18/dev' into mc1.18/global-railways

This commit is contained in:
Jozufozu 2022-02-05 20:05:29 -08:00
commit 87bdd8d586
7 changed files with 33 additions and 32 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2022.01.23
# dependency versions # dependency versions
registrate_version = MC1.18-1.0.21 registrate_version = MC1.18-1.0.21
flywheel_version = 1.18-0.6.0.50 flywheel_version = 1.18-0.6.1.56
jei_minecraft_version = 1.18.1 jei_minecraft_version = 1.18.1
jei_version = 9.2.1.69 jei_version = 9.2.1.69

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
@ -34,6 +35,8 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
@Override @Override
protected void renderSafe(PortableStorageInterfaceTileEntity te, float partialTicks, PoseStack ms, protected void renderSafe(PortableStorageInterfaceTileEntity te, float partialTicks, PoseStack ms,
MultiBufferSource buffer, int light, int overlay) { MultiBufferSource buffer, int light, int overlay) {
if (Backend.isOn()) return;
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
float progress = te.getExtensionDistance(partialTicks); float progress = te.getExtensionDistance(partialTicks);
VertexConsumer vb = buffer.getBuffer(RenderType.solid()); VertexConsumer vb = buffer.getBuffer(RenderType.solid());

View file

@ -19,11 +19,10 @@ public class EngineInstance extends BlockEntityInstance<EngineTileEntity> {
Block block = blockState Block block = blockState
.getBlock(); .getBlock();
if (!(block instanceof EngineBlock)) if (!(block instanceof EngineBlock engineBlock))
return; return;
EngineBlock engineBlock = (EngineBlock) block; PartialModel frame = engineBlock.getFrameModel();
PartialModel frame = engineBlock.getFrameModel();
Direction facing = blockState.getValue(BlockStateProperties.HORIZONTAL_FACING); Direction facing = blockState.getValue(BlockStateProperties.HORIZONTAL_FACING);
@ -33,7 +32,7 @@ public class EngineInstance extends BlockEntityInstance<EngineTileEntity> {
this.frame.loadIdentity() this.frame.loadIdentity()
.translate(getInstancePosition()) .translate(getInstancePosition())
.nudge(tile.hashCode()) .nudge(pos.hashCode())
.centre() .centre()
.rotate(Direction.UP, angle) .rotate(Direction.UP, angle)
.unCentre() .unCentre()

View file

@ -66,9 +66,8 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE<FurnaceEngine
@SubscribeEvent @SubscribeEvent
public static void usingFurnaceEngineOnFurnacePreventsGUI(RightClickBlock event) { public static void usingFurnaceEngineOnFurnacePreventsGUI(RightClickBlock event) {
ItemStack item = event.getItemStack(); ItemStack item = event.getItemStack();
if (!(item.getItem() instanceof BlockItem)) if (!(item.getItem() instanceof BlockItem blockItem))
return; return;
BlockItem blockItem = (BlockItem) item.getItem();
if (blockItem.getBlock() != AllBlocks.FURNACE_ENGINE.get()) if (blockItem.getBlock() != AllBlocks.FURNACE_ENGINE.get())
return; return;
BlockState state = event.getWorld().getBlockState(event.getPos()); BlockState state = event.getWorld().getBlockState(event.getPos());

View file

@ -7,6 +7,7 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.DynamicInstance;
import com.jozufozu.flywheel.backend.instancing.TaskEngine; import com.jozufozu.flywheel.backend.instancing.TaskEngine;
import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager; import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
@ -15,52 +16,51 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import net.minecraft.client.Camera; import net.minecraft.client.Camera;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
public class ContraptionInstanceManager extends BlockEntityInstanceManager { public class ContraptionInstanceManager extends BlockEntityInstanceManager {
protected ArrayList<ActorInstance> actors = new ArrayList<>(); protected ArrayList<ActorInstance> actors = new ArrayList<>();
private final VirtualRenderWorld renderWorld; private final VirtualRenderWorld renderWorld;
ContraptionInstanceManager(MaterialManager materialManager, VirtualRenderWorld contraption) { ContraptionInstanceManager(MaterialManager materialManager, VirtualRenderWorld contraption) {
super(materialManager); super(materialManager);
this.renderWorld = contraption; this.renderWorld = contraption;
} }
public void tick() { public void tick() {
actors.forEach(ActorInstance::tick); actors.forEach(ActorInstance::tick);
} }
@Override @Override
public void beginFrame(TaskEngine taskEngine, Camera info) { public void beginFrame(TaskEngine taskEngine, Camera info) {
super.beginFrame(taskEngine, info); super.beginFrame(taskEngine, info);
actors.forEach(ActorInstance::beginFrame); actors.forEach(ActorInstance::beginFrame);
} }
@Override @Override
protected boolean shouldFrameUpdate(BlockPos worldPos, float lookX, float lookY, float lookZ, int cX, int cY, int cZ) { protected void updateInstance(DynamicInstance dyn, float lookX, float lookY, float lookZ, int cX, int cY, int cZ) {
return true; dyn.beginFrame();
} }
@Nullable @Nullable
public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) { public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) {
StructureBlockInfo blockInfo = actor.getLeft(); StructureBlockInfo blockInfo = actor.getLeft();
MovementContext context = actor.getRight(); MovementContext context = actor.getRight();
MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state); MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state);
if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) { if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) {
ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context); ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context);
actors.add(instance); actors.add(instance);
return instance; return instance;
} }
return null; return null;
} }
} }

View file

@ -138,7 +138,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
@Override @Override
public Biome getBiome(BlockPos pos) { public Biome getBiome(BlockPos pos) {
return ForgeRegistries.BIOMES.getValue(Biomes.FOREST.location()); return ForgeRegistries.BIOMES.getValue(Biomes.PLAINS.location());
} }
@Override @Override

View file

@ -32,6 +32,6 @@ Technology that empowers the player.'''
[[dependencies.create]] [[dependencies.create]]
modId="flywheel" modId="flywheel"
mandatory=true mandatory=true
versionRange="[1.18-0.6.0,1.18-0.6.1)" versionRange="[1.18-0.6.1,1.18-0.6.2)"
ordering="AFTER" ordering="AFTER"
side="CLIENT" side="CLIENT"