Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsterner committed Nov 16, 2023
1 parent edc9712 commit b794c55
Show file tree
Hide file tree
Showing 36 changed files with 220 additions and 170 deletions.
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,14 @@ subprojects {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Suggestion Tweaker
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Suggestion Tweaker, Create Big Cannons
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven { url "https://maven.architectury.dev/" }
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
maven {
url = "https://maven.realrobotix.me/createbigcannons/" // Create Big Cannons
content {
includeGroup "com.rbasamoyai"
}
}
}
}

Expand Down
14 changes: 9 additions & 5 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

dependencies {
annotationProcessor(implementation("com.github.LlamaLad7:MixinExtras:0.1.1"))
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0"))

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
// We depend on fabric loader here to use the fabric @Environment annotations
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

modApi("me.shedaniel.cloth:cloth-config:4.14.64")
modApi("me.shedaniel.cloth:cloth-config:8.3.103")
//modApi "me.shedaniel.cloth:cloth-config-fabric:8.3.103"

modCompileOnly("curse.maven:sodium-394468:3669187")
modCompileOnly("maven.modrinth:sodium:mc1.19.2-0.4.4")

// vs-core
implementation("org.valkyrienskies.core:impl:${rootProject.vs_core_version}") {
Expand All @@ -30,8 +31,11 @@ dependencies {
{ exclude group: 'com.github.AlphaMode', module: 'fakeconfigtoml' }
modCompileOnly("net.fabricmc.fabric-api:fabric-api:${fabric_api_version}")
modCompileOnly("com.jozufozu.flywheel:flywheel-fabric-${minecraft_version}:${flywheel_version_fabric}")
modCompileOnly("io.github.fabricators_of_create:Porting-Lib:${port_lib_version}+${minecraft_version}")
modCompileOnly("com.rbasamoyai:createbigcannons-fabric-${minecraft_version}:${createbigcannons_version}")
for (String module in port_lib_modules.split(",")) {
implementation("io.github.fabricators_of_create.Porting-Lib:$module:$port_lib_version+$minecraft_version")
}
//modCompileOnly("io.github.fabricators_of_create:Porting-Lib:Porting-Lib:${port_lib_version}+${minecraft_version}")
modCompileOnly("maven.modrinth:create-big-cannons:${createbigcannons_version}")
}

architectury {
Expand Down
4 changes: 2 additions & 2 deletions common/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
port_lib_version=1.2.677-beta
port_lib_hash=cca931b
port_lib_version=2.1.1096
port_lib_modules = accessors,base,entity,extensions,fake_players,networking,obj_loader,tags,transfer
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,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 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((float) (packet.getXRot() * 360) / 256.0f);
entity.setYRot((float) (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 @@ -186,20 +186,21 @@ private void animateTickVS(
@Redirect(
at = @At(
value = "NEW",
target = "net/minecraft/client/resources/sounds/SimpleSoundInstance"
target = "(Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFLnet/minecraft/util/RandomSource;DDD)Lnet/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 @@ -27,6 +27,6 @@ public ShipWorld getShipWorld() {

@Override
public void sendVSMessage(final Component component, final UUID uUID) {
minecraft.player.sendMessage(component, uUID);
minecraft.player.sendSystemMessage(component);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public ShipWorldCore getShipWorld() {

@Override
public void sendVSMessage(final Component component, final UUID uUID) {
source.sendMessage(component, uUID);
source.sendSystemMessage(component);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.valkyrienskies.mod.mixin.feature.fire_between_ship_and_world;

import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.FluidState;
Expand All @@ -19,7 +19,7 @@ public abstract class LavaFluidMixin extends FlowingFluid {
private boolean isModifyingFireTick = false;

@Inject(method = "randomTick", at = @At("TAIL"))
public void fireTickMixin(final Level level, final BlockPos pos, final FluidState state, final Random random,
public void fireTickMixin(final Level level, final BlockPos pos, final FluidState state, final RandomSource random,
final CallbackInfo ci) {
if (isModifyingFireTick) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.Objects;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
Expand All @@ -31,7 +30,7 @@ public class MixinBlockItem {
final Double mass =
Objects.requireNonNull(BlockStateInfo.INSTANCE.get(item.getBlock().defaultBlockState()))
.getFirst();
list.add(new TranslatableComponent("tooltip.valkyrienskies.mass")
list.add(Component.translatable("tooltip.valkyrienskies.mass")
.append(VSGameConfig.CLIENT.getTooltip().getUseImperialUnits() ?
getImperialText(mass) : ": " + mass + "kg").withStyle(ChatFormatting.DARK_GRAY));
} catch (final Exception ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ private static void forRecord(final SoundEvent sound, final double x, final doub
final Ship ship = VSGameUtilsKt.getShipManagingPos(Minecraft.getInstance().level, x, y, z);
if (ship != null) {
cir.setReturnValue(new SimpleSoundInstanceOnShip(
sound, SoundSource.RECORDS, 4.0F, 1.0F, false, 0, SoundInstance.Attenuation.LINEAR, x, y, z, ship));
sound, SoundSource.RECORDS, 4.0F, 1.0F, SoundInstance.createUnseededRandom(), false, 0,
SoundInstance.Attenuation.LINEAR, x, y, z, ship));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import java.util.function.Supplier;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.storage.WritableLevelData;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -26,8 +28,10 @@ public class MixinLevel {
method = "<init>"
)
private void setWorldBorderLevel(
final WritableLevelData writableLevelData, final ResourceKey resourceKey, final Holder holder,
final Supplier supplier, final boolean bl, final boolean bl2, final long l, final CallbackInfo ci) {
final WritableLevelData writableLevelData, final ResourceKey<Level> resourceKey,
final Holder<DimensionType> holder,
final Supplier<ProfilerFiller> supplier, final boolean bl, final boolean bl2, final long l, final int i,
final CallbackInfo ci) {

((OfLevel) this.worldBorder).setLevel(Level.class.cast(this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -61,7 +61,7 @@ private void injectOnRemove(BlockState state, Level worldIn, BlockPos pos, Block
}

@Inject(method = "tick", at = @At(value = "INVOKE_ASSIGN", shift = At.Shift.BY, by = 2, target = "Lcom/simibubi/create/content/redstone/contact/RedstoneContactBlock;hasValidContact(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)Z"), locals = LocalCapture.CAPTURE_FAILHARD)
private void injectTick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random, CallbackInfo ci, boolean hasValidContact) {
private void injectTick(BlockState state, ServerLevel worldIn, BlockPos pos, RandomSource random, CallbackInfo ci, boolean hasValidContact) {
if (VSGameUtilsKt.isBlockInShipyard(worldIn, pos)) {
Pair<Level, BlockPos> key = Pair.of(worldIn, pos);
if (!hasValidContact && state.getValue(POWERED) && contactCache.containsKey(key)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ public abstract class MixinCannonMount extends KineticBlockEntity implements Con
public MixinCannonMount(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
super(typeIn, pos, state);
}

/* TODO
@Override
public void cacheRecoilVector(Vec3 vector, AbstractContraptionEntity cannon) {
recoilVec = VectorConversionsMCKt.toJOML(vector);
}
*/

@Unique
private void handleAssembly() {
LoadedServerShip ship = null;
Expand Down
Loading

0 comments on commit b794c55

Please sign in to comment.