adjust block updates from rotation menu

- remove unused ponder keybind
This commit is contained in:
zelophed 2024-11-08 15:56:39 +01:00
parent b1b5e192a1
commit 6f1979df0a
13 changed files with 39 additions and 44 deletions

View file

@ -51,7 +51,7 @@ mixin {
config 'flywheel.backend.mixins.json'
config 'flywheel.impl.mixins.json'
config 'flywheel.impl.sodium.mixins.json'
//config 'flywheel.impl.sodium.mixins.json'
config 'create.mixins.json'
debug.verbose = true
@ -126,7 +126,7 @@ minecraft {
arg '-mixin.config=flywheel.backend.mixins.json'
arg '-mixin.config=flywheel.impl.mixins.json'
arg '-mixin.config=flywheel.impl.sodium.mixins.json'
//arg '-mixin.config=flywheel.impl.sodium.mixins.json'
}
server {
@ -235,7 +235,7 @@ dependencies {
jarJar("dev.engine_room.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") {
jarJar.ranged(it, '[1.0,2.0)')
}
jarJar("net.createmod.catnip:Catnip-Forge-${minecraft_version}:${catnip_version}") {
jarJar.ranged(it, '[0.7.5,)')
}
@ -282,12 +282,12 @@ dependencies {
// implementation fg.deobf("curse.maven:ic2-classic-242942:5555152")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
// implementation fg.deobf("com.railwayteam.railways:railways-1.19.2-1.6.4:all") { transitive = false }
implementation fg.deobf("dev.architectury:architectury-forge:9.1.12")
implementation fg.deobf("dev.ftb.mods:ftb-chunks-forge:2001.3.1")
implementation fg.deobf("dev.ftb.mods:ftb-teams-forge:2001.3.0")
implementation fg.deobf("dev.ftb.mods:ftb-library-forge:2001.2.4")
implementation fg.deobf("curse.maven:journeymap-32274:5457831")
// implementation fg.deobf("ignored:journeymap-1.20.1-5.10.1-forge")

View file

@ -23,13 +23,13 @@ use_parchment = true
# dependency versions
registrate_version = MC1.20-1.3.3
flywheel_minecraft_version = 1.20.1
flywheel_version = 1.0.0-beta-145
flywheel_version = 1.0.0-beta-154
jei_minecraft_version = 1.20.1
jei_version = 15.10.0.39
curios_minecraft_version = 1.20.1
curios_version = 5.3.1
catnip_version = 0.8.17
ponder_version = 0.8.11
catnip_version = 0.8.20
ponder_version = 0.8.12
cc_tweaked_enable = true
cc_tweaked_minecraft_version = 1.20.1

View file

@ -18,7 +18,6 @@ public enum AllKeys {
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
TOOLBELT("toolbelt", GLFW.GLFW_KEY_LEFT_ALT),
PONDER("ponder", GLFW.GLFW_KEY_W),
ROTATE_MENU("rotate_menu", GLFW.GLFW_KEY_UNKNOWN),
;

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.contraptions.wrench;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.foundation.networking.SimplePacketBase;
@ -7,6 +8,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.network.NetworkEvent;
import net.minecraftforge.registries.GameData;
@ -38,7 +40,10 @@ public class RadialWrenchMenuSubmitPacket extends SimplePacketBase {
ServerPlayer player = context.getSender();
Level level = player.level();
KineticBlockEntity.switchToBlockState(level, blockPos, newState);
BlockState updatedState = Block.updateFromNeighbourShapes(newState, level, blockPos);
KineticBlockEntity.switchToBlockState(level, blockPos, updatedState);
IWrenchable.playRotateSound(level, blockPos);
});
return true;
}

View file

@ -62,7 +62,7 @@ public class WhistleExtenderBlock extends Block implements IWrenchable {
if (!(world instanceof ServerLevel))
return InteractionResult.SUCCESS;
world.setBlock(pos, state.setValue(SHAPE, WhistleExtenderShape.SINGLE), 3);
playRemoveSound(world, pos);
IWrenchable.playRemoveSound(world, pos);
return InteractionResult.SUCCESS;
}

View file

@ -6,7 +6,7 @@ import org.joml.Vector3f;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import dev.engine_room.flywheel.lib.util.ShadersModHandler;
import dev.engine_room.flywheel.lib.util.ShadersModHelper;
import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.SimpleAnimatedParticle;
@ -65,7 +65,7 @@ public class CustomRotationParticle extends SimpleAnimatedParticle {
float maxU = mirror ? getU0() : getU1();
float minV = getV0();
float maxV = getV1();
int brightness = ShadersModHandler.isShaderPackInUse() ? LightTexture.pack(12, 15) : getLightColor(partialTicks);
int brightness = ShadersModHelper.isShaderPackInUse() ? LightTexture.pack(12, 15) : getLightColor(partialTicks);
builder.vertex(vertices[0].x(), vertices[0].y(), vertices[0].z()).uv(maxU, maxV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
builder.vertex(vertices[1].x(), vertices[1].y(), vertices[1].z()).uv(maxU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
builder.vertex(vertices[2].x(), vertices[2].y(), vertices[2].z()).uv(minU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();

View file

@ -4,7 +4,6 @@ import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.Create;
import com.simibubi.create.content.kinetics.base.DirectionalAxisKineticBlock;
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
import com.simibubi.create.content.kinetics.base.HorizontalAxisKineticBlock;
import com.simibubi.create.content.kinetics.base.HorizontalKineticBlock;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
@ -20,7 +19,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.level.BlockEvent;
@ -28,21 +26,16 @@ import net.minecraftforge.event.level.BlockEvent;
public interface IWrenchable {
default InteractionResult onWrenched(BlockState state, UseOnContext context) {
Level world = context.getLevel();
Level level = context.getLevel();
BlockPos pos = context.getClickedPos();
BlockState rotated = getRotatedBlockState(state, context.getClickedFace());
if (!rotated.canSurvive(world, context.getClickedPos()))
if (!rotated.canSurvive(level, context.getClickedPos()))
return InteractionResult.PASS;
KineticBlockEntity.switchToBlockState(world, context.getClickedPos(), updateAfterWrenched(rotated, context));
KineticBlockEntity.switchToBlockState(level, pos, updateAfterWrenched(rotated, context));
BlockEntity be = context.getLevel()
.getBlockEntity(context.getClickedPos());
if (be instanceof GeneratingKineticBlockEntity) {
((GeneratingKineticBlockEntity) be).reActivateSource = true;
}
if (world.getBlockState(context.getClickedPos()) != state)
playRotateSound(world, context.getClickedPos());
if (level.getBlockState(pos) != state)
playRotateSound(level, pos);
return InteractionResult.SUCCESS;
}
@ -79,12 +72,12 @@ public interface IWrenchable {
return InteractionResult.SUCCESS;
}
default void playRemoveSound(Level world, BlockPos pos) {
AllSoundEvents.WRENCH_REMOVE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f);
static void playRemoveSound(Level level, BlockPos pos) {
AllSoundEvents.WRENCH_REMOVE.playOnServer(level, pos, 1, Create.RANDOM.nextFloat() * .5f + .5f);
}
default void playRotateSound(Level world, BlockPos pos) {
AllSoundEvents.WRENCH_ROTATE.playOnServer(world, pos, 1, Create.RANDOM.nextFloat() + .5f);
static void playRotateSound(Level level, BlockPos pos) {
AllSoundEvents.WRENCH_ROTATE.playOnServer(level, pos, 1, Create.RANDOM.nextFloat() + .5f);
}
default BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace) {

View file

@ -18,7 +18,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
@ -51,11 +50,6 @@ public class PumpBlock extends DirectionalKineticBlock
.getOpposite());
}
@Override
public BlockState updateAfterWrenched(BlockState newState, UseOnContext context) {
return super.updateAfterWrenched(newState, context);
}
@Override
public Axis getRotationAxis(BlockState state) {
return state.getValue(FACING)

View file

@ -393,6 +393,10 @@ public class KineticBlockEntity extends SmartBlockEntity implements IHaveGoggleI
kineticBlockEntity.removeSource();
}
if (blockEntity instanceof GeneratingKineticBlockEntity generatingBlockEntity) {
generatingBlockEntity.reActivateSource = true;
}
world.setBlock(pos, state, 3);
}

View file

@ -7,6 +7,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.ITransformableBlock;
import com.simibubi.create.content.contraptions.StructureTransform;
import com.simibubi.create.content.decoration.encasing.EncasedBlock;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.kinetics.base.IRotate;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
@ -107,7 +108,7 @@ public class EncasedCogwheelBlock extends RotatedPillarKineticBlock
BlockPos pos = context.getClickedPos();
KineticBlockEntity.switchToBlockState(level, pos, state.cycle(context.getClickedFace()
.getAxisDirection() == AxisDirection.POSITIVE ? TOP_SHAFT : BOTTOM_SHAFT));
playRotateSound(level, pos);
IWrenchable.playRotateSound(level, pos);
return InteractionResult.SUCCESS;
}

View file

@ -148,7 +148,7 @@ public class FactoryPanelBlock extends FaceAttachedHorizontalDirectionalBlock
player.getInventory()
.placeItemBackInInventory(AllBlocks.FACTORY_GAUGE.asStack());
playRemoveSound(world, pos);
IWrenchable.playRemoveSound(world, pos);
if (be.activePanels() == 0)
world.destroyBlock(pos, false);

View file

@ -27,6 +27,7 @@ import com.simibubi.create.content.contraptions.AssemblyException;
import com.simibubi.create.content.contraptions.ITransformableBlockEntity;
import com.simibubi.create.content.contraptions.StructureTransform;
import com.simibubi.create.content.decoration.slidingDoor.DoorControlBehaviour;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.logistics.depot.DepotBehaviour;
import com.simibubi.create.content.logistics.packagePort.PackagePortBlockEntity;
import com.simibubi.create.content.logistics.packagePort.postbox.PostboxBlockEntity;
@ -314,7 +315,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
if (!(newEntity instanceof AbstractBogeyBlockEntity newBE))
continue;
newBE.setBogeyData(oldData);
bogey.playRotateSound(level, bogeyPos);
IWrenchable.playRotateSound(level, bogeyPos);
return true;
}
}
@ -476,7 +477,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
itemEntity.setDeltaMovement(Vec3.ZERO);
getLevel().addFreshEntity(itemEntity);
}
public void updateMapColor(int color) {
GlobalStation station = getStation();
if (station == null)
@ -979,7 +980,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
if (ppbe instanceof PostboxBlockEntity pbe)
pbe.trackedGlobalStation = new WeakReference<GlobalStation>(station);
if (station.connectedPorts.containsKey(ppbe.getBlockPos()))
restoreOfflineBuffer(ppbe, station.connectedPorts.get(ppbe.getBlockPos()));

View file

@ -4,14 +4,12 @@ import java.util.function.Function;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.foundation.render.RenderTypes;
import dev.engine_room.flywheel.lib.transform.TransformStack;
import net.createmod.catnip.utility.BasicFluidRenderer;
import net.createmod.catnip.utility.math.AngleHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
@ -29,7 +27,7 @@ public class FluidRenderer extends BasicFluidRenderer {
public static void renderFluidStream(FluidStack fluidStack, Direction direction, float radius, float progress,
boolean inbound, MultiBufferSource buffer, PoseStack ms, int light) {
renderFluidStream(fluidStack, direction, radius, progress, inbound, buffer.getBuffer(RenderTypes.fluid()), ms, light);
renderFluidStream(fluidStack, direction, radius, progress, inbound, getFluidBuilder(buffer), ms, light);
}
public static void renderFluidStream(FluidStack fluidStack, Direction direction, float radius, float progress,