diff --git a/changelog.md b/changelog.md index 9fd9fa2..147a401 100644 --- a/changelog.md +++ b/changelog.md @@ -1,12 +1,14 @@ -Multiplayer and non-player entity compatibility, along with 1.18.2 support. +Extra smoothness and extra compatibility change. Changelog: -- **Fixed:** Player camera turns when an unrelated player is on a train. -- **Added:** Ability for non-player entities to be affected by this mod. -- **Technical:** Cleaned up the code a bit. +- **Fixed:** Delayed camera movement when train turns. +- **Added:** Debug option to display new value scales used to fix the aforementioned delayed camera movement. +- **Fixed:** Incompatibility with Figura combined with some mods. [#67](https://github.com/der-fruhling-entertainment/create-train-perspective/issues/67) + - (fixed via possibly temporary workaround. please report any other issues with this mod and mine! it likes to get breaky) +- **Technical:** Cleaned up the code a bit more. -[View full change log.](https://github.com/der-fruhling/create-train-perspective/compare/v0.4.1...v0.5.0) +[View full change log.](https://github.com/der-fruhling/create-train-perspective/compare/v0.5.0...v0.6.0) --- diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Camera3D.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Camera3D.java index 6aed625..46f3115 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Camera3D.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Camera3D.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; public interface Camera3D { diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Conditional.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Conditional.java index 7fead56..65f0109 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Conditional.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Conditional.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; import net.minecraft.client.player.LocalPlayer; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/CreateTrainPerspectiveMod.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/CreateTrainPerspectiveMod.java index 25c81f9..034e4ee 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/CreateTrainPerspectiveMod.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/CreateTrainPerspectiveMod.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; @@ -33,10 +59,7 @@ public void onEntityMountEvent(boolean isMounting, Entity entityMounting, Entity public void onEntityMount(Perspective persp, CarriageContraptionEntity contraption) { if (persp.getRotationState() == null) { var state = new RotationState(contraption, false); - persp.setRotationState(state); - var carriage = state.getContraption(); - assert carriage != null; - persp.enable(carriage.pitch, carriage.yaw); + persp.enable(contraption, state); } else { var state = persp.getRotationState(); state.onMounted(); @@ -57,10 +80,7 @@ public void tickStandingEntity(final CarriageContraptionEntity contraption, fina if (state == null || !Objects.equals(state.getContraption(), contraption)) { state = new RotationState(contraption, true); - persp.setRotationState(state); - var carriage = state.getContraption(); - assert carriage != null; - persp.enable(carriage.pitch, carriage.yaw); + persp.enable(contraption, state); } else { state.update(); } @@ -69,8 +89,7 @@ public void tickStandingEntity(final CarriageContraptionEntity contraption, fina private void tickPerspectiveState(Entity player, Perspective persp, RotationState state) { var carriage = state.getContraption(); if (carriage == null) return; - persp.setLean(carriage.pitch); - persp.setYaw(carriage.yaw); + persp.setReference(carriage); player.setYRot(player.getYRot() + state.getYawDelta()); player.setYBodyRot(player.getYRot()); @@ -78,7 +97,7 @@ private void tickPerspectiveState(Entity player, Perspective persp, RotationStat state.tick(); if (state.getTicksSinceLastUpdate() > 5) { - state.setShouldTickState(false); + state.stopTickingState(); } } } @@ -94,7 +113,6 @@ public void tickEntity(Entity entity, Perspective persp) { persp.diminish(); if (persp.isDiminished()) { - persp.setRotationState(null); persp.disable(); } } diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/MixinUtil.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/MixinUtil.java index dbf07f0..6682543 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/MixinUtil.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/MixinUtil.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; import com.mojang.math.Vector3d; @@ -27,7 +53,7 @@ public static float getExtraYRot(Perspective persp, float xRot, float yRot, floa public static Vector3d applyStandingCameraTranslation(Player player, double x, double y, double z, Perspective persp, float f) { var lean = persp.getLean(f) * Mth.DEG_TO_RAD; var yaw = persp.getYaw(f) * Mth.DEG_TO_RAD; - var height = player.getEyeHeight(); + var height = y - player.getY(); var newY = y + ((height * Mth.cos(lean)) - height); var leanSin = Mth.sin(lean); var newZ = z - (height * Mth.sin(yaw) * leanSin); diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/ModConfig.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/ModConfig.java index ad7dfe6..09051af 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/ModConfig.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/ModConfig.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; import com.google.gson.Gson; @@ -40,6 +66,7 @@ public class ModConfig { public boolean applyToNonPlayerEntities = true; public List blockedEntities = new ArrayList<>(); public boolean dbgShowStandingTransforms = false; + public boolean dbgShowValueScales = false; private ModConfig() { } @@ -187,6 +214,16 @@ public static Screen createConfigScreen(Screen parent) { .setDefaultValue(false) .build()); + + debug.add(entryBuilder + .startBooleanToggle( + Component.translatable("option.create_train_perspective.debug.value_scales"), + INSTANCE.dbgShowValueScales) + .setSaveConsumer(value -> INSTANCE.dbgShowValueScales = value) + .setTooltip(Component.translatable("option.create_train_perspective.debug.value_scales.tooltip")) + .setDefaultValue(false) + .build()); + advanced.add(debug.build()); general.addEntry(advanced.build()); diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java index 5042d74..516c454 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/Perspective.java @@ -1,33 +1,137 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; +import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; public interface Perspective { - void enable(float initialLean, float initialYaw); + /** + * Enables this perspective and attaches it to the provided carriage + * contraption entity. + * + * @param entity The entity. + */ + void enable(CarriageContraptionEntity entity, RotationState state); + /** + * Disables this perspective and resets it to the default state. + */ void disable(); + /** + * @return {@code true} if enabled. + */ boolean isEnabled(); - void setLean(float lean); + /** + * Sets the new reference carriage contraption entity for this perspective. + * + * @throws IllegalStateException If {@link #isEnabled()} returns {@code false}. + * @param entity The new reference. + */ + void setReference(CarriageContraptionEntity entity); - void setYaw(float yaw); + /** + * @return The reference carriage contraption entity, or {@code null} if + * {@link #isEnabled()} would return {@code false} + */ + @Nullable + CarriageContraptionEntity getReference(); - float getLean(float f); + /** + * Calculates the amount of lean to apply to this perspective. + * + * @param f The delta between the last tick and the next tick. + * @return Lean value. + */ + default float getLean(float f) { + var ref = getReference(); + if (ref == null) return 0.0f; + if (f == 1.0f) return ref.pitch * getValueScale(); + return Mth.lerp(f, ref.prevPitch * getPrevValueScale(), ref.pitch * getValueScale()); + } - float getYaw(float f); + /** + * Calculates the amount of yaw to apply to this perspective. + * + * @param f The delta between the last tick and the next tick. + * @return Yaw value. + */ + default float getYaw(float f) { + var ref = getReference(); + if (ref == null) return 0.0f; + if (f == 1.0f) return ref.yaw * getValueScale(); + return Mth.lerp(f, ref.prevYaw * getPrevValueScale(), ref.yaw * getValueScale()); + } + /** + * @return The current {@link RotationState} value. + */ @Nullable RotationState getRotationState(); + /** + * Sets the rotation state. + */ + @Deprecated(since = "0.6.0", forRemoval = true) void setRotationState(@Nullable RotationState state); - default void diminish() { - setLean(getLean(1.0f) * 0.9f); - } + /** + * Applies a diminishing effect to this perspective, called every tick if + * {@link RotationState#shouldTickState()} returns {@code false}. + */ + void diminish(); + + /** + * @return The value scale calculated in the last tick. + * This will only be less than one if {@link #diminish()} was + * called last tick. + */ + float getPrevValueScale(); + + // this must not be named getScale()!!!! + // Entity (or something) has a method also called getScale() that conflicts + // with this method in a fuckey way. + /** + * @return The value scale calculated in this tick. + * This will only be less than one if {@link #diminish()} was + * called this tick. + */ + float getValueScale(); + /** + * @return {@code true} if {@link #diminish()} has been called enough to + * reduce the effect that the mod is having on the perspective that + * it looks close enough to vanilla to just {@link #disable()} + * this perspective and stop wasting time multiplying values forever. + */ default boolean isDiminished() { - return Mth.abs(getLean(1.0f)) < 0.01f; + return getValueScale() < 0.00025f; } } diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/RotationState.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/RotationState.java index cf117eb..fde0c03 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/RotationState.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/RotationState.java @@ -1,8 +1,41 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective; import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; import org.jetbrains.annotations.Nullable; +/** + * Contains some state needed to support rotating the player based on a + * carriage contraption's value. + * This is here mostly for simplicity, otherwise there would be too many + * {@code @Nullable} fields in + * {@link net.derfruhling.minecraft.create.trainperspective.mixin.EntityMixin EntityMixin} + */ public class RotationState { private CarriageContraptionEntity contraption; private boolean isStandingState; @@ -10,12 +43,37 @@ public class RotationState { private boolean shouldTickState = true; private int ticksSinceLastUpdate = 0; + /** + * Constructs a new rotation state. + * This constructor is used when an entity is mounting a train. + * + * @param contraption The contraption to bind to. + * @param isStandingState If {@code true} then the entity is standing on + * the train and requires different logic to + * detect when the player leaves the train. + *

+ * Otherwise, the player is seated, and therefore + * it can be assumed that when the player leaves + * their seat they will probably continue to stand + * for at least a moment. + *

+ * As such, the state is updated to be a + * standing state, which correctly handles if the + * player dismounts into a position which is no + * longer on the train. + */ public RotationState(CarriageContraptionEntity contraption, boolean isStandingState) { this.contraption = contraption; lastRecordedYaw = contraption.yaw; this.isStandingState = isStandingState; } + /** + * @return The difference between the current yaw of the contraption and + * the last yaw recorded by this function. + * @implNote This method does not take into account mid-tick frames, and + * as such should not be used for rendering. + */ public float getYawDelta() { while (contraption.yaw - lastRecordedYaw < -180.0f) { lastRecordedYaw -= 360.0f; @@ -30,48 +88,94 @@ public float getYawDelta() { return rotation; } + /** + * @return The currently bound contraption. + */ public @Nullable CarriageContraptionEntity getContraption() { return contraption; } - public void setCarriageEntity(@Nullable CarriageContraptionEntity contraption) { + @Deprecated(since = "0.6.0", forRemoval = true) + public void setContraption(@Nullable CarriageContraptionEntity contraption) { this.contraption = contraption; } + /** + * @return {@code true} if this is a standing state, + * {@code false} otherwise. + */ public boolean isStanding() { return isStandingState; } + /** + * @return {@code true} if this is not a standing state, + * {@code false} otherwise. + */ public boolean isSeated() { return !isStandingState; } + /** + * If {@link #isStanding isStanding()} is true, then after the player is + * detected not to be on the contraption this method will start returning + * {@code false}. + * Otherwise, it will always return {@code true}. + * + * @return {@code true} if this standing state should continue being ticked. + */ public boolean shouldTickState() { return shouldTickState; } + /** + * Called when the player begins riding the contraption. + * Converts this state into a seated state. + */ public void onMounted() { this.isStandingState = false; + + // ensure correct behavior (this is ignored for seated states anyway) this.shouldTickState = true; } + /** + * Called when the player stops riding the contraption. + * Converts this state into a standing state. + */ public void onDismount() { this.isStandingState = true; } + @Deprecated(since = "0.6.0", forRemoval = true) public void setShouldTickState(boolean shouldTickState) { this.shouldTickState = shouldTickState; } + /** + * Calls for this state to stop ticking. + * + * @throws IllegalStateException Not {@link #isStanding()} + */ + public void stopTickingState() { + if(!isStandingState) throw new IllegalStateException("not a standing state"); + + this.shouldTickState = false; + } + + /** + * @return Returns the number of {@link #tick()} calls since the last + * {@link #update()} + */ public int getTicksSinceLastUpdate() { return ticksSinceLastUpdate; } - public void update() { + void update() { ticksSinceLastUpdate = 0; } - public void tick() { + void tick() { ticksSinceLastUpdate += 1; } } diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/AbstractContraptionEntityMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/AbstractContraptionEntityMixin.java index 10ffc52..7529a72 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/AbstractContraptionEntityMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/AbstractContraptionEntityMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.simibubi.create.content.contraptions.AbstractContraptionEntity; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java index 4ca33d4..1294661 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CameraMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.mojang.math.Quaternion; @@ -17,7 +43,8 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(Camera.class) +// workaround for figura to work (this is terrible but works) +@Mixin(value = Camera.class, priority = 1100) @Implements({@Interface(iface = Camera3D.class, prefix = "c3d$")}) @Environment(EnvType.CLIENT) public abstract class CameraMixin { diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/ClientLevelMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/ClientLevelMixin.java index 2e28eb2..ab89639 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/ClientLevelMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/ClientLevelMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CreateRaycastHelperMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CreateRaycastHelperMixin.java index dccd291..485c648 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CreateRaycastHelperMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/CreateRaycastHelperMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/EntityMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/EntityMixin.java index c692966..48ea055 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/EntityMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/EntityMixin.java @@ -1,6 +1,33 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.llamalad7.mixinextras.sugar.Local; +import com.simibubi.create.content.trains.entity.CarriageContraptionEntity; import net.derfruhling.minecraft.create.trainperspective.*; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -28,7 +55,11 @@ public abstract class EntityMixin { @Unique private boolean ctp$perspectiveActive = false; @Unique - private float ctp$lean = 0.0f, ctp$yaw = 0.0f, ctp$oldLean = 0.0f, ctp$oldYaw = 0.0f; + private @Nullable CarriageContraptionEntity ctp$reference = null; + @Unique + private float ctp$scale = 1.0f; + @Unique + private float ctp$prevScale = 1.0f; @Unique private @Nullable RotationState ctp$currentState = null; @@ -74,60 +105,56 @@ public float modifyYaw(float yaw, @Local(argsOnly = true, index = 1) float pitch } else return yaw; } - public void ctp$enable(float initialLean, float initialYaw) { + public void ctp$enable(CarriageContraptionEntity entity, RotationState state) { ctp$perspectiveActive = true; - ctp$lean = initialLean; - ctp$yaw = initialYaw; - ctp$oldLean = initialLean; - ctp$oldYaw = initialYaw; + ctp$currentState = state; + ctp$reference = entity; + ctp$prevScale = 1.0f; + ctp$scale = 1.0f; } public void ctp$disable() { ctp$perspectiveActive = false; - ctp$lean = 0.0f; - ctp$yaw = 0.0f; - ctp$oldLean = 0.0f; - ctp$oldYaw = 0.0f; + ctp$currentState = null; + ctp$reference = null; + ctp$prevScale = 1.0f; + ctp$scale = 1.0f; } - public boolean ctp$isEnabled() { - return ctp$perspectiveActive; + public void ctp$setReference(CarriageContraptionEntity entity) { + ctp$reference = entity; + ctp$prevScale = ctp$scale; + ctp$scale = 1.0f; } - public void ctp$setLean(float lean) { - ctp$oldLean = ctp$lean; - ctp$lean = lean; + public CarriageContraptionEntity ctp$getReference() { + return ctp$reference; } - public void ctp$setYaw(float yaw) { - // some configurations flip between 0 and 360 constantly - // adjust accordingly - ctp$oldYaw = ctp$yaw; - ctp$yaw = yaw; - - while (ctp$yaw - ctp$oldYaw < -180.0f) { - ctp$oldYaw -= 360.0f; - } + public void ctp$diminish() { + if (ctp$scale <= 0.0f) return; + ctp$prevScale = ctp$scale; + ctp$scale = Mth.lerp(0.1f, ctp$scale, 0.0f); + } - while (ctp$yaw - ctp$oldYaw >= 180.0f) { - ctp$oldYaw += 360.0f; - } + public float ctp$getValueScale() { + return ctp$scale; } - public float ctp$getLean(float f) { - if (f == 1.0f) return ctp$lean; - return Mth.lerp(f, ctp$oldLean, ctp$lean); + public float ctp$getPrevValueScale() { + return ctp$prevScale; } - public float ctp$getYaw(float f) { - if (f == 1.0f) return ctp$yaw; - return Mth.lerp(f, ctp$oldYaw, ctp$yaw); + public boolean ctp$isEnabled() { + return ctp$perspectiveActive; } public @Nullable RotationState ctp$getRotationState() { return ctp$currentState; } + @SuppressWarnings("removal") + @Deprecated(since = "0.6.0", forRemoval = true) public void ctp$setRotationState(@Nullable RotationState state) { ctp$currentState = state; } diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/GameRendererMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/GameRendererMixin.java index fd97eaf..3cc180b 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/GameRendererMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/GameRendererMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LivingEntityRendererMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LivingEntityRendererMixin.java index 11c97a3..721f937 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LivingEntityRendererMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LivingEntityRendererMixin.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LocalPlayerMixin.java b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LocalPlayerMixin.java index 4209e9d..11272b6 100644 --- a/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LocalPlayerMixin.java +++ b/common/src/main/java/net/derfruhling/minecraft/create/trainperspective/mixin/LocalPlayerMixin.java @@ -1,24 +1,72 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.mixin; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.mojang.authlib.GameProfile; +import net.derfruhling.minecraft.create.trainperspective.ModConfig; import net.derfruhling.minecraft.create.trainperspective.Perspective; import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.chat.Component; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = LocalPlayer.class) -public class LocalPlayerMixin { +public abstract class LocalPlayerMixin extends AbstractClientPlayer { @Shadow @Final protected Minecraft minecraft; + @Shadow public abstract void displayClientMessage(Component arg, boolean bl); + + public LocalPlayerMixin(ClientLevel clientLevel, GameProfile gameProfile) { + super(clientLevel, gameProfile); + } + @WrapOperation(method = "getViewYRot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isPassenger()Z")) public boolean isPassenger(LocalPlayer localPlayer, Operation original) { var perspective = (Perspective) localPlayer; return original.call(localPlayer) || perspective.isEnabled(); } + + @Inject(method = "tick", at = @At(value = "TAIL")) + public void tickDebugFeatures(CallbackInfo ci) { + var persp = (Perspective) this; + + if(ModConfig.INSTANCE.dbgShowValueScales) { + this.displayClientMessage(Component.literal(persp.getValueScale() + ", " + persp.getPrevValueScale()), true); + } + } } diff --git a/common/src/main/resources/assets/minecraft/lang/en_us.json b/common/src/main/resources/assets/minecraft/lang/en_us.json index b494b15..224b254 100644 --- a/common/src/main/resources/assets/minecraft/lang/en_us.json +++ b/common/src/main/resources/assets/minecraft/lang/en_us.json @@ -5,7 +5,7 @@ "category.create_train_perspective.multiplayer": "Multiplayer", "category.create_train_perspective.advanced": "Advanced", "category.create_train_perspective.debug": "Debug Features", - "category.create_train_perspective.debug.description": "These are debugging features used for development. You probably don't want to touch these unless you're working on the mod itself.", + "category.create_train_perspective.debug.description": "These are debugging features used for development. You probably don't want to touch these unless you're working on the mod itself, and you should only enable one at a time if you want them to mean anything.", "option.create_train_perspective.enabled": "Enabled", "option.create_train_perspective.enabled.tooltip": "Enables the mod. If False, the mod is disabled.", "option.create_train_perspective.leaning.enabled": "Enable Leaning", @@ -23,5 +23,7 @@ "option.create_train_perspective.advanced.blocked_entities": "Blocked entities", "option.create_train_perspective.advanced.blocked_entities.tooltip": "Entities with an ID in this list will not be considered for this mod's functionality", "option.create_train_perspective.debug.standing_transforms": "Show Standing Translations", - "option.create_train_perspective.debug.standing_transforms.tooltip": "Shows translations used to transform the player while standing on a train. (X, Y, Z)" + "option.create_train_perspective.debug.standing_transforms.tooltip": "Shows translations used to transform the player while standing on a train. (X, Y, Z)", + "option.create_train_perspective.debug.value_scales": "Show Value Scales", + "option.create_train_perspective.debug.value_scales.tooltip": "Shows scalars used to scale leaning and yaw after leaving a train. (CURRENT, LAST)" } \ No newline at end of file diff --git a/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ConfigIntegration.java b/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ConfigIntegration.java index 49658b1..d52c4d6 100644 --- a/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ConfigIntegration.java +++ b/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ConfigIntegration.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.fabric; import com.terraformersmc.modmenu.api.ConfigScreenFactory; diff --git a/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ModFabricEntrypoint.java b/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ModFabricEntrypoint.java index 5b9095c..40f37ad 100644 --- a/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ModFabricEntrypoint.java +++ b/fabric/src/main/java/net/derfruhling/minecraft/create/trainperspective/fabric/ModFabricEntrypoint.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.fabric; import net.derfruhling.minecraft.create.trainperspective.CreateTrainPerspectiveMod; diff --git a/forge/src/main/java/net/derfruhling/minecraft/create/trainperspective/forge/ModForgeEntrypoint.java b/forge/src/main/java/net/derfruhling/minecraft/create/trainperspective/forge/ModForgeEntrypoint.java index 10ed3d2..058e863 100644 --- a/forge/src/main/java/net/derfruhling/minecraft/create/trainperspective/forge/ModForgeEntrypoint.java +++ b/forge/src/main/java/net/derfruhling/minecraft/create/trainperspective/forge/ModForgeEntrypoint.java @@ -1,3 +1,29 @@ +/* + * Part of the Create: Train Perspective project. + * + * The MIT License (MIT) + * + * Copyright (c) 2024 der_frühling + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package net.derfruhling.minecraft.create.trainperspective.forge; import dev.architectury.platform.forge.EventBuses; diff --git a/gradle.properties b/gradle.properties index c49a57c..c451c7b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ fabric_loader_version=0.15.7 fabric_api_version=0.77.0+1.19.2 # public info mod_id=create_train_perspective -mod_version=0.5.0 +mod_version=0.6.0 maven_group=net.derfruhling.minecraft archives_base_name=create-train-perspective # mod dependency versions