Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP 1.19.2 Port #300

Merged
merged 78 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
4b58101
1.19
AlphaMode Nov 7, 2022
6c7e393
Merge branch '1.18.x/main' into 1.19.2
AlphaMode Nov 30, 2022
a925af5
update the 1.19.2
AlphaMode Nov 30, 2022
98ff6a6
[1.18.2] Minimum ComputerCraft Compatibility Code (#265)
TechTastic Dec 29, 2022
98168db
Removed maven repos
Dec 29, 2022
64b2c08
Changing MixinEntity making an inject more normal.
ewoudje Dec 29, 2022
4ed0dd4
[1.18.2] FTB Chunks Compatibility (#291)
TechTastic Jan 3, 2023
387fda1
Added Create Seat entity into VS_Entities (#296)
FluffyJenkins Jan 5, 2023
6a9f9b5
Merge remote-tracking branch 'upstream/1.18.x/main' into 1.19.2
AlphaMode Jan 6, 2023
5246271
Upstream from 1.18.2
AlphaMode Jan 6, 2023
171d840
fix: null check
Rubydesic Jan 7, 2023
cbbdfa9
fix: structurize crash (#293)
Rubydesic Jan 7, 2023
10e7afa
housekeeping: update gradle plugins
Rubydesic Jan 7, 2023
8b28755
fix: add javax annotations to gradle
Rubydesic Jan 7, 2023
183b8ab
Unfloored position components in getOnPos related parts of the entity…
FluffyJenkins Jan 8, 2023
32dcacb
housekeeping: refactor moveEntityFromShipyardToWorld
Rubydesic Jan 7, 2023
2672009
fix: only move entities into shipyard when they're spawned into the w…
Rubydesic Jan 8, 2023
a202892
fix: Ladders work (kudos to copper 1.16 code)
ewoudje Jan 9, 2023
e5fe8be
createNewShipWithBlocks doesn't allow empty DenseBlockPosSet
ewoudje Jan 9, 2023
87293dc
change to LGPLv3
Rubydesic Jan 9, 2023
bf383c7
Create 0.5g compat for fabric and create
ewoudje Jan 10, 2023
92a2999
housekeeping: make Create fabric modCompileOnly
Rubydesic Jan 10, 2023
a97eb74
housekeeping: make flywheel modCompileOnly in common
Rubydesic Jan 11, 2023
c5e333f
bump version
Rubydesic Jan 11, 2023
ad4dd9a
Minor create compat updates
ewoudje Jan 11, 2023
ce70563
Applied Triode's fixes for Comod error
ThePlasticPotato Jan 11, 2023
bd8c350
bump version
Rubydesic Jan 12, 2023
43670c1
Feature/wings pt2 (#324)
StewStrong Jan 15, 2023
9e9f382
Fixed forge not running
Jan 15, 2023
b9b5aeb
Updated to 2.1.1
Jan 15, 2023
234755c
Use LevelYRange instead of IntRange to fix forge mixin crash
Jan 15, 2023
8594eec
Revert "Updated to 2.1.1"
Jan 15, 2023
a066aaf
Make version number adhere to semver better (#321)
Rubydesic Jan 15, 2023
660e193
Made wing drag 10x smaller
Jan 15, 2023
1210ae4
Made wing drag 2x larger
Jan 15, 2023
08d4d32
Feature/contraption wings (#355)
StewStrong Jan 16, 2023
346ea89
fix: potential nullptr/classcastexception
Rubydesic Jan 17, 2023
a7ac2a6
Don't transpose create matrices
Jan 17, 2023
d79c940
Added flap blocks
Jan 17, 2023
3a41156
Fixed third person camera blocking on mounted ships
Jan 17, 2023
b3b2dc9
fix: potential nullptr/classcastexception pt2
Jan 17, 2023
44bea1d
Made ShipCreatorItem work on ships
Jan 17, 2023
df47d4b
fix: flywheel issue
Rubydesic Jan 17, 2023
2ed15b8
fix: player respawns
Rubydesic Jan 18, 2023
8ba6c89
fix: disable kicked for flying
Rubydesic Jan 18, 2023
5a32c48
fix: prevent crashes when missing ship world
Rubydesic Jan 18, 2023
3daab56
fix: nullptr crash on server shutdown
Rubydesic Jan 18, 2023
08e41b0
fix: missing ship worlds pt2
Rubydesic Jan 18, 2023
7bfc768
fix: crash on premature server shutdown
Rubydesic Jan 18, 2023
0a7155b
fix: nullpointer exception
Rubydesic Jan 18, 2023
6bd2d25
Don't rotate the net torque T_T, fix camber angle not in radians
Jan 18, 2023
33baabc
Rendering Events (#359)
ewoudje Jan 18, 2023
37b7714
Moving events around
ewoudje Jan 18, 2023
43d492d
Bruh
ewoudje Jan 18, 2023
b738847
Use 2 iterations of gauss seidel
Jan 19, 2023
170ff6f
fix: re-add RegistryEvents as deprecated for addons
Rubydesic Jan 20, 2023
4727e93
fix: move sound physics to client only
Rubydesic Jan 19, 2023
f520a5c
Assembly changes (#340)
copperwarrior Jan 21, 2023
fca3d2c
Added AttachmentOrientation constraint
Jan 22, 2023
5e6edba
Update Krunch on forge
Jan 22, 2023
90677b3
feat: add a heuristic to put seat entities in shipyard
Rubydesic Jan 21, 2023
8bf4a62
optimization: terrain updates taking up a serious amount of tick time…
Rubydesic Jan 21, 2023
26f4c5e
optimization: speed up BlockStateInfoProvider
Rubydesic Jan 21, 2023
d845315
Revert "optimization: terrain updates taking up a serious amount of t…
Rubydesic Jan 23, 2023
aa79663
Merge remote-tracking branch 'upstream/1.18.x/main' into 1.19.2
AlphaMode Jan 25, 2023
ee1a38f
Update README.md
Blixtdraken Jan 30, 2023
ab74a58
feat: add ship scaling config options
Rubydesic Feb 1, 2023
1d5acb8
ShipSettings (#413)
ewoudje Feb 8, 2023
adaef37
1.18.x tis-3d rendering+infared fixes (#411)
walksanatora Feb 8, 2023
1747df5
Ship settings should be var
ewoudje Feb 9, 2023
6a23d06
fix: Make VSGameUtilsKt null-safe
Rubydesic Feb 11, 2023
42a3f38
Update 1_18_blocks.json (#416)
Weromano Feb 12, 2023
aeeefb7
Added a Vec3 isBlockInShipyard (#417)
FluffyJenkins Feb 13, 2023
8145558
Upstream from 1.18.2
AlphaMode Feb 19, 2023
4d09636
Merge remote-tracking branch 'upstream/1.18.x/main' into 1.19.2
AlphaMode Feb 19, 2023
343e4ba
Upstream from 1.18.2
AlphaMode Feb 19, 2023
c25cc3b
Fix compile issues with forge
AlphaMode Feb 19, 2023
ce123cc
Update base name to valkyrienskies-119
AlphaMode Feb 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
366 changes: 165 additions & 201 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ independent code lives in [vs-core](https://github.com/ValkyrienSkies/vs-core).
## Troubleshooting

### Running Forge in dev environment
Occasionally forge will break will strange ways. When this occurs, delete all the `build` folders, delete the `.gradle` folder of the `forge` project, and then refresh gradle.
Occasionally forge will break in strange ways. When this occurs, delete all the `build` folders, delete the `.gradle` folder of the `forge` project, and then refresh gradle.
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ buildscript {

plugins {
// Needed for Forge+Fabric
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
id 'io.github.juuxel.loom-quiltflower' version '1.7.1' apply false
id "architectury-plugin" version "3.4.143"
id "dev.architectury.loom" version "1.0.306" apply false
id 'io.github.juuxel.loom-quiltflower' version '1.8.0' apply false
// Kotlin
id "org.jetbrains.kotlin.jvm" version "1.7.10" apply false
// Kotlin linter
Expand Down Expand Up @@ -73,7 +73,7 @@ subprojects {
url = "https://maven.parchmentmc.org"
}
maven { url = "https://cursemaven.com" }
maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu
maven {
name = 'Kotlin for Forge'
url = 'https://thedarkcolour.github.io/KotlinForForge/'
Expand All @@ -82,6 +82,13 @@ subprojects {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Suggestion Tweaker
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url = "https://mvn.devos.one/snapshots/" } // Fabric Create, Porting Lib, Forge Tags, Milk Lib
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // Forge Config API Port
maven { url = "https://maven.tterrag.com/" } // Registrate, Forge Create and Flywheel
maven { url = "https://maven.cafeteria.dev/releases" } // Fake Player API
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
}
}

Expand All @@ -99,6 +106,8 @@ subprojects {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()

compileOnly("com.google.code.findbugs:jsr305:3.0.2")
}

// configure checkstyle
Expand Down
14 changes: 14 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ dependencies {
exclude module: "netty-buffer"
exclude module: "fastutil"
}

// FTB Stuffs
modCompileOnly("curse.maven:ftb-util-404465:4210935")
modCompileOnly("curse.maven:ftb-teams-404468:4229138")
modCompileOnly("curse.maven:ftb-chunks-314906:4229120")

//Common create compat,
//We just use a version from a platform and hope the classes exist on both versions and mixins apply correctly
modCompileOnly("com.jozufozu.flywheel:flywheel-fabric-${minecraft_version}:0.6.8.a-4")
}

architectury {
Expand All @@ -25,6 +34,11 @@ loom {
accessWidenerPath = file("src/main/resources/valkyrienskies-common.accesswidener")
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

jar {
// Exclude dummy Optifine classes
exclude "net/optifine/**"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
package org.valkyrienskies.mod.event;

import java.util.ArrayList;
import java.util.List;
import kotlin.Unit;
import net.minecraft.core.RegistryAccess;
import org.valkyrienskies.mod.common.hooks.VSGameEvents;

public class RegistryEvents {

private static List<Runnable> onTagsLoaded = new ArrayList<>();
private static List<Runnable> onRegistriesComplete = new ArrayList<>();

// this can be beter...
/**
* @deprecated Use VSGameEvents
*/
@Deprecated(forRemoval = true)
public static void onTagsLoaded(final Runnable event) {
onTagsLoaded.add(event);
VSGameEvents.INSTANCE.getTagsAreLoaded().on(x -> event.run());
}

/**
* @deprecated Use VSGameEvents
*/
@Deprecated(forRemoval = true)
public static void tagsAreLoaded(final RegistryAccess registries, final boolean client) {
onTagsLoaded.forEach(Runnable::run);
VSGameEvents.INSTANCE.getTagsAreLoaded().emit(Unit.INSTANCE);
}

/**
* @deprecated Use VSGameEvents
*/
@Deprecated(forRemoval = true)
public static void onRegistriesComplete(final Runnable event) {
onRegistriesComplete.add(event);
VSGameEvents.INSTANCE.getRegistriesCompleted().on(x -> event.run());
}

/**
* @deprecated Use VSGameEvents
*/
@Deprecated(forRemoval = true)
public static void registriesAreComplete() {
onRegistriesComplete.forEach(Runnable::run);
VSGameEvents.INSTANCE.getRegistriesCompleted().emit(Unit.INSTANCE);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.valkyrienskies.mod.mixin.accessors.entity;

import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
Expand All @@ -11,4 +13,13 @@ public interface EntityAccessor {
@Accessor("position")
void setPosNoUpdates(Vec3 pos);

@Accessor("blockPosition")
void setBlockPosition(BlockPos blockPosition);

@Accessor("blockPosition")
BlockPos getBlockPosition();

@Accessor("feetBlockState")
void setFeetBlockState(BlockState feetBlockState);

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.ClipContext.Block;
import net.minecraft.world.level.ClipContext.Fluid;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.HitResult.Type;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.joml.Quaterniond;
import org.joml.Quaterniondc;
Expand All @@ -20,6 +27,7 @@
import org.valkyrienskies.core.api.ships.properties.ShipTransform;
import org.valkyrienskies.mod.client.IVSCamera;
import org.valkyrienskies.mod.common.util.VectorConversionsMCKt;
import org.valkyrienskies.mod.common.world.RaycastUtilsKt;

@Mixin(Camera.class)
public abstract class MixinCamera implements IVSCamera {
Expand Down Expand Up @@ -52,6 +60,8 @@ public abstract class MixinCamera implements IVSCamera {
private float eyeHeight;
@Shadow
private float eyeHeightOld;
@Shadow
private Vec3 position;

@Shadow
protected abstract double getMaxZoom(double startingDistance);
Expand Down Expand Up @@ -92,7 +102,12 @@ public void setupWithShipMounted(final @NotNull BlockGetter level, final @NotNul

dist = dist > 4 ? dist : 4;

this.move(-this.getMaxZoom(4.0 * (dist / 4.0)), 0.0, 0.0);
if (this.level instanceof Level) {
this.move(-this.getMaxZoomIgnoringMountedShip((Level) this.level, 4.0 * (dist / 4.0), shipMountedTo),
0.0, 0.0);
} else {
this.move(-this.getMaxZoom(4.0 * (dist / 4.0)), 0.0, 0.0);
}
}
}

Expand All @@ -112,4 +127,35 @@ private void setRotationWithShipTransform(final float yaw, final float pitch, fi
this.left.set(1.0F, 0.0F, 0.0F);
this.left.transform(this.rotation);
}

/**
* When in third person, do not block the camera on the ship the player is mounted to
*/
@Unique
private double getMaxZoomIgnoringMountedShip(final Level level, double maxZoom,
final @NotNull ClientShip toIgnore) {
for (int i = 0; i < 8; ++i) {
float f = (float) ((i & 1) * 2 - 1);
float g = (float) ((i >> 1 & 1) * 2 - 1);
float h = (float) ((i >> 2 & 1) * 2 - 1);
f *= 0.1F;
g *= 0.1F;
h *= 0.1F;
final Vec3 vec3 = this.position.add(f, g, h);
final Vec3 vec32 =
new Vec3(this.position.x - (double) this.forwards.x() * maxZoom + (double) f + (double) h,
this.position.y - (double) this.forwards.y() * maxZoom + (double) g,
this.position.z - (double) this.forwards.z() * maxZoom + (double) h);
final HitResult hitResult = RaycastUtilsKt.clipIncludeShips(level,
new ClipContext(vec3, vec32, Block.VISUAL, Fluid.NONE, this.entity), true, toIgnore.getId());
if (hitResult.getType() != Type.MISS) {
final double e = hitResult.getLocation().distanceTo(this.position);
if (e < maxZoom) {
maxZoom = e;
}
}
}

return maxZoom;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import net.minecraft.world.InteractionResult;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -28,12 +30,16 @@
import org.valkyrienskies.mod.common.IShipObjectWorldServerProvider;
import org.valkyrienskies.mod.common.ValkyrienSkiesMod;
import org.valkyrienskies.mod.common.util.EntityDragger;
import org.valkyrienskies.mod.common.world.DummyShipWorldClient;
import org.valkyrienskies.mod.mixinducks.client.MinecraftDuck;

@Mixin(Minecraft.class)
public abstract class MixinMinecraft
implements MinecraftDuck, IShipObjectWorldClientProvider, IShipObjectWorldClientCreator {

@Unique
private static final Logger log = LogManager.getLogger("VS2 MixinMinecraft");

@Shadow
private boolean pause;

Expand Down Expand Up @@ -63,15 +69,15 @@ public abstract class MixinMinecraft
@WrapOperation(
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;useItemOn(Lnet/minecraft/client/player/LocalPlayer;Lnet/minecraft/client/multiplayer/ClientLevel;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;"
target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;useItemOn(Lnet/minecraft/client/player/LocalPlayer;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;"
),
method = "startUseItem"
)
private InteractionResult useOriginalCrosshairForBlockPlacement(final MultiPlayerGameMode instance,
final LocalPlayer localPlayer, final ClientLevel clientLevel, final InteractionHand interactionHand,
final LocalPlayer localPlayer, final InteractionHand interactionHand,
final BlockHitResult blockHitResult, final Operation<InteractionResult> useItemOn) {

return useItemOn.call(instance, localPlayer, clientLevel, interactionHand,
return useItemOn.call(instance, localPlayer, interactionHand,
this.originalCrosshairTarget);
}

Expand All @@ -81,7 +87,8 @@ public ClientShipWorldCore getShipObjectWorld() {
final ClientShipWorldCore shipObjectWorldCopy = shipObjectWorld;

if (shipObjectWorldCopy == null) {
throw new IllegalStateException("Requested getShipObjectWorld() when shipObjectWorld was null!");
log.warn("Requested getShipObjectWorld() when shipObjectWorld was null!");
return DummyShipWorldClient.INSTANCE;
}
return shipObjectWorldCopy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ private void handleShipMountingEntity(final ClientboundAddEntityPacket packet, f
final double f = packet.getZ();
final Entity entity = ValkyrienSkiesMod.SHIP_MOUNTING_ENTITY_TYPE.create(level);
final int i = packet.getId();
entity.setPacketCoordinates(d, e, f);
entity.syncPacketPositionCodec(d, e, f);
entity.moveTo(d, e, f);
entity.setXRot((float) (packet.getxRot() * 360) / 256.0f);
entity.setYRot((float) (packet.getyRot() * 360) / 256.0f);
entity.setXRot((packet.getXRot() * 360) / 256.0f);
entity.setYRot((packet.getYRot() * 360) / 256.0f);
entity.setId(i);
entity.setUUID(packet.getUUID());
this.level.putNonPlayerEntity(i, entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private void setupCameraWithMountedShip(final LevelRenderer instance, final Pose
// Use [camera.getPosition()] instead of [vec3] because mounting the player to the ship has changed the camera
// position.
prepareCullFrustum.call(instance, matrixStack, camera.getPosition(),
this.getProjectionMatrix(Math.max(fov, this.minecraft.options.fov)));
this.getProjectionMatrix(Math.max(fov, this.minecraft.options.fov().get())));
}
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static org.valkyrienskies.mod.common.ValkyrienSkiesMod.getVsCore;

import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
Expand All @@ -13,6 +12,7 @@
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.Blocks;
Expand Down Expand Up @@ -42,7 +42,7 @@
@Mixin(ClientLevel.class)
public abstract class MixinClientLevel implements IShipObjectWorldClientProvider {
@Unique
private final Random vsRandom = new Random();
private final RandomSource vsRandom = RandomSource.create();

@Shadow
@Final
Expand Down Expand Up @@ -188,17 +188,18 @@ private void animateTickVS(
value = "NEW",
target = "net/minecraft/client/resources/sounds/SimpleSoundInstance"
),
method = "playLocalSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZ)V"
method = "playSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZJ)V"
)
private SimpleSoundInstance redirectNewSoundInstance(final SoundEvent soundEvent, final SoundSource soundSource,
final float volume, final float pitch, final double x, final double y, final double z) {
final float volume, final float pitch, final RandomSource randomSource, final double x, final double y,
final double z) {

final Ship ship = VSGameUtilsKt.getShipManagingPos(ClientLevel.class.cast(this), x, y, z);
if (ship != null) {
return new SimpleSoundInstanceOnShip(soundEvent, soundSource, volume, pitch, x, y, z,
return new SimpleSoundInstanceOnShip(soundEvent, soundSource, volume, pitch, randomSource, x, y, z,
ship);
}

return new SimpleSoundInstance(soundEvent, soundSource, volume, pitch, x, y, z);
return new SimpleSoundInstance(soundEvent, soundSource, volume, pitch, randomSource, x, y, z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.ReportedException;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.ClipContext;
Expand Down
Loading