From fc8278c8eeb97841451f5d1e43c94afa35d2a12a Mon Sep 17 00:00:00 2001 From: Toastworth Date: Fri, 8 Aug 2025 01:42:05 +0200 Subject: [PATCH 01/19] Added ramp tricks and some more sound effects --- .../automobility/entity/AutomobileEntity.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 150cb34f..44a4626d 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -36,6 +36,7 @@ import net.minecraft.core.Cursor3D; import net.minecraft.core.Direction; import net.minecraft.core.Holder; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; @@ -48,6 +49,7 @@ import net.minecraft.server.level.ServerEntity; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; @@ -119,9 +121,12 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En public static final int MEDIUM_TURBO_TIME = 70; public static final int LARGE_TURBO_TIME = 115; public static final float TERMINAL_VELOCITY = -1.2f; + public static final float TRICK_MIN_VELOCITY = 0.4f; public final Input input = new Input(); private boolean prevHoldDrift = input.holdingDrift; + private boolean prevPrevHoldDrift = input.holdingDrift; + private boolean prevPrevPrevHoldDrift = input.holdingDrift; private long clientTime; @@ -714,6 +719,7 @@ public void tick() { positionTrackingTick(); collisionStateTick(); steeringTick(); + rampTrickTick(); driftingTick(); burnoutTick(); @@ -1318,6 +1324,7 @@ public void boost(float power, int time) { } controllerAction(c -> c.updateBoostingRumbleState(true, power)); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.BLAZE_SHOOT, SoundSource.PLAYERS, 0.6f, 1.0f, true); } private void steeringTick() { @@ -1381,9 +1388,50 @@ private void driftingTick() { controllerAction(c -> c.updateMaxChargeRumbleState(false)); } + if (turboCharge >= SMALL_TURBO_TIME && prevTurboCharge < SMALL_TURBO_TIME) { + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.15f, 1.5f, true); + } else if (turboCharge >= MEDIUM_TURBO_TIME && prevTurboCharge < MEDIUM_TURBO_TIME) { + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.175f, 1.75f, true); + } else if (turboCharge >= LARGE_TURBO_TIME && prevTurboCharge < LARGE_TURBO_TIME) { + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.2f, 2.0f, true); + } + + this.prevPrevPrevHoldDrift = this.prevPrevHoldDrift; + this.prevPrevHoldDrift = this.prevHoldDrift; this.prevHoldDrift = input.holdingDrift; } + private void rampTrickTick() { + if (wasOnGround && !automobileOnGround && !isFloorDirectlyBelow && hSpeed > TRICK_MIN_VELOCITY && + ((!prevHoldDrift && input.holdingDrift) || (!prevPrevHoldDrift && prevHoldDrift) || (!prevPrevPrevHoldDrift && prevPrevHoldDrift))) { + setDrifting(false); + controllerAction(c -> c.updateMaxChargeRumbleState(false)); + boost(0.20f, 9); + spawnTrickEffect(); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.5f, 1.5f, true); + } + } + + private void spawnTrickEffect() { + + for (int i = 0; i < 6; i++) { + for (int j = 0; j < 6; j++) { + double xVel = Math.sin(i) * Math.cos(j) * 2; + double yVel = Math.sin(i) * Math.sin(j) * 2; + double zVel = Math.cos(i) * 2; + + level().addParticle( + ParticleTypes.CRIT, + getX(), + getY() + 0.5, + getZ(), + xVel, + yVel, + zVel); + } + } + } + private void endBurnout() { setBurningOut(false); this.updateEngineSpeed(0); From e6fb8d0d6f9cffe9b3339539a973b9728951b8ae Mon Sep 17 00:00:00 2001 From: Toastworth Date: Fri, 8 Aug 2025 01:42:19 +0200 Subject: [PATCH 02/19] Adjusted boost strength --- .../foundationgames/automobility/block/DashPanelBlock.java | 2 +- .../foundationgames/automobility/block/LaunchGelBlock.java | 2 +- .../automobility/entity/AutomobileEntity.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java index 195074aa..940a2fde 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java @@ -116,7 +116,7 @@ public static void onCollideWithDashPanel(@Nullable BlockState panelState, Entit } if (entity instanceof AutomobileEntity auto) { - auto.boost(0.45f, 50); + auto.boost(0.4f, 50); } else if (entity.getType().is(AutomobilityEntities.DASH_PANEL_BOOSTABLES)) { if (entity instanceof LivingEntity living) { living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 40, 6, true, false, false)); diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/LaunchGelBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LaunchGelBlock.java index eda77e71..901a44e5 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/LaunchGelBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LaunchGelBlock.java @@ -28,7 +28,7 @@ public void entityInside(BlockState state, Level world, BlockPos pos, Entity ent super.entityInside(state, world, pos, entity); if (entity instanceof AutomobileEntity automobile && automobile.automobileOnGround()) { - automobile.boost(0.14f, 7); + automobile.boost(0.13f, 7); } } diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 44a4626d..e38f89b0 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -1335,11 +1335,11 @@ private void steeringTick() { private void consumeTurboCharge() { if (turboCharge > LARGE_TURBO_TIME) { - boost(0.38f, 38); + boost(0.33f, 38); } else if (turboCharge > MEDIUM_TURBO_TIME) { - boost(0.3f, 21); + boost(0.26f, 21); } else if (turboCharge > SMALL_TURBO_TIME) { - boost(0.23f, 9); + boost(0.20f, 9); } turboCharge = 0; } From 55d598adb592a8ef0d32be6c8b61a91c05f76c77 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Sat, 9 Aug 2025 18:33:18 +0200 Subject: [PATCH 03/19] Improved audio mixing --- .../automobility/entity/AutomobileEntity.java | 13 ++++++++----- .../automobility/sound/AutomobileSoundInstance.java | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index e38f89b0..0eb62897 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -1324,7 +1324,10 @@ public void boost(float power, int time) { } controllerAction(c -> c.updateBoostingRumbleState(true, power)); - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.BLAZE_SHOOT, SoundSource.PLAYERS, 0.6f, 1.0f, true); + + float boostSoundPitch = 1.6f - (Math.clamp(power - 0.15f, 0f, 0.25f) * 3); + float boostSoundVolume = 0.5f; + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.BLAZE_SHOOT, SoundSource.AMBIENT, boostSoundVolume, boostSoundPitch, true); } private void steeringTick() { @@ -1389,11 +1392,11 @@ private void driftingTick() { } if (turboCharge >= SMALL_TURBO_TIME && prevTurboCharge < SMALL_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.15f, 1.5f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.09f, 1.5f, true); } else if (turboCharge >= MEDIUM_TURBO_TIME && prevTurboCharge < MEDIUM_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.175f, 1.75f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.10f, 1.75f, true); } else if (turboCharge >= LARGE_TURBO_TIME && prevTurboCharge < LARGE_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.PLAYERS, 0.2f, 2.0f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.11f, 2.0f, true); } this.prevPrevPrevHoldDrift = this.prevPrevHoldDrift; @@ -1408,7 +1411,7 @@ private void rampTrickTick() { controllerAction(c -> c.updateMaxChargeRumbleState(false)); boost(0.20f, 9); spawnTrickEffect(); - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.5f, 1.5f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.AMBIENT, 0.25f, 1.5f, true); } } diff --git a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java index 264ef39f..22d2141c 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java +++ b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java @@ -110,7 +110,7 @@ protected float getPitch(AutomobileEntity automobile) { @Override protected float getVolume(AutomobileEntity automobile) { - return 1; + return 0.7f; } @Override @@ -140,7 +140,9 @@ protected float getPitch(AutomobileEntity automobile) { @Override protected float getVolume(AutomobileEntity automobile) { - return automobile.automobileOnGround() ? 1 : 0; + float volumeBoost = ((Math.clamp(automobile.getHSpeed(), 0.2f, 1.4f) - 0.2f) / 1.2f) * 3; + System.out.println(volumeBoost); + return automobile.automobileOnGround() ? 0.75f + volumeBoost : 0; } @Override From 3a8ff885235bced2f54a8b795bde11e36b79076e Mon Sep 17 00:00:00 2001 From: Toastworth Date: Sat, 9 Aug 2025 20:02:46 +0200 Subject: [PATCH 04/19] Improved game feel --- .../automobility/entity/AutomobileEntity.java | 64 +++++++++++++++++-- .../sound/AutomobileSoundInstance.java | 1 - 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 0eb62897..cfca437e 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -49,7 +49,6 @@ import net.minecraft.server.level.ServerEntity; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; @@ -186,6 +185,7 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En private boolean automobileOnGround = true; private boolean wasOnGround = automobileOnGround; private boolean isFloorDirectlyBelow = true; + private boolean isFloorWithinOneBlockBelow = true; private boolean touchingWall = false; private int hadVehicleCollision = 0; @@ -210,10 +210,12 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En private Vector3f debrisColor = new Vector3f(); private int fallTicks = 0; + private int airTime = 0; private int despawnTime = -1; private int despawnCountdown = 0; private boolean decorative = false; + private boolean trickBuffered = false; private boolean wasEngineRunning = false; @@ -221,6 +223,7 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En public void writeSyncStateData(FriendlyByteBuf buf) { buf.writeInt(boostTimer); + buf.writeInt(airTime); buf.writeFloat(steering); buf.writeFloat(wheelAngle); buf.writeInt(turboCharge); @@ -229,11 +232,13 @@ public void writeSyncStateData(FriendlyByteBuf buf) { input.writePacket(buf); buf.writeBoolean(drifting); + buf.writeBoolean(trickBuffered); buf.writeBoolean(burningOut); } public void readSyncStateData(FriendlyByteBuf buf) { boostTimer = buf.readInt(); + airTime = buf.readInt(); steering = buf.readFloat(); wheelAngle = buf.readFloat(); turboCharge = buf.readInt(); @@ -242,6 +247,7 @@ public void readSyncStateData(FriendlyByteBuf buf) { input.readPacket(buf); setDrifting(buf.readBoolean()); + setTrickBuffered(buf.readBoolean()); setBurningOut(buf.readBoolean()); this.dataLerpTicks = CLIENT_SYNC_INTERVAL; @@ -290,9 +296,11 @@ public void readAdditionalSaveData(CompoundTag nbt) { input.holdingDrift = nbt.getBoolean("holdingDrift"); input.holdingHorn = nbt.getBoolean("holdingHorn"); fallTicks = nbt.getInt("fallTicks"); + airTime = nbt.getInt("airTime"); despawnTime = nbt.getInt("despawnTime"); despawnCountdown = nbt.getInt("despawnCountdown"); decorative = nbt.getBoolean("decorative"); + trickBuffered = nbt.getBoolean("trickBuffered"); } @Override @@ -325,9 +333,11 @@ public void addAdditionalSaveData(CompoundTag nbt) { nbt.putBoolean("holdingDrift", input.holdingDrift); nbt.putBoolean("holdingHorn", input.holdingHorn); nbt.putInt("fallTicks", fallTicks); + nbt.putInt("airTime", airTime); nbt.putInt("despawnTime", despawnTime); nbt.putInt("despawnCountdown", despawnCountdown); nbt.putBoolean("decorative", decorative); + nbt.putBoolean("trickBuffered", trickBuffered); } public AutomobileEntity(EntityType type, Level world) { @@ -497,6 +507,10 @@ private void setDrifting(boolean drifting) { this.drifting = drifting; } + private void setTrickBuffered(boolean trickBuffered) { + this.trickBuffered = trickBuffered; + } + private void setBurningOut(boolean burningOut) { if (this.level().isClientSide() && !this.drifting && !this.burningOut && burningOut) { skidSound.accept(this); @@ -521,6 +535,10 @@ public boolean isDrifting() { return this.drifting; } + public boolean isTrickBuffered() { + return this.trickBuffered; + } + public boolean isBike() { return this.getFrame().model().wheelBase().wheelCount() == 2; } @@ -837,6 +855,10 @@ public void updateEngineSpeed(float speed) { return; } + if(engineSpeed > stats.getComfortableSpeed() * 1.25f) { + speed = stats.getComfortableSpeed() * 1.25f; + } + this.engineSpeed = speed; } @@ -1106,6 +1128,13 @@ public void postMovementTick() { fallTicks = 0; } + // Increment air time timer + if (!automobileOnGround) { + airTime += 1; + } else { + airTime = 0; + } + // Handle launching off slopes double highestPrevYDisp = 0; for (double d : prevYDisplacements) { @@ -1252,15 +1281,19 @@ public void collisionStateTick() { wasOnGround = automobileOnGround; automobileOnGround = false; isFloorDirectlyBelow = false; + isFloorWithinOneBlockBelow = false; + var b = getBoundingBox(); var groundBox = new AABB(b.minX, b.minY - 0.04, b.minZ, b.maxX, b.minY, b.maxZ); var wid = (b.getXsize() + b.getZsize()) * 0.5f; var floorBox = new AABB(b.minX + (wid * 0.94), b.minY - 0.05, b.minZ + (wid * 0.94), b.maxX - (wid * 0.94), b.minY, b.maxZ - (wid * 0.94)); + var floorOneBlockBelowBox = new AABB(b.minX, b.minY - 1, b.minZ, b.maxX, b.minY, b.maxZ); var wallBox = b.deflate(0.05).move(this.lastVelocity.normalize().scale(0.12)); - var start = new BlockPos((int) Math.floor(b.minX - 0.1), (int) Math.floor(b.minY - 0.2), (int) Math.floor(b.minZ - 0.1)); + var start = new BlockPos((int) Math.floor(b.minX - 0.1), (int) Math.floor(b.minY - 1), (int) Math.floor(b.minZ - 0.1)); var end = new BlockPos((int) Math.floor(b.maxX + 0.1), (int) Math.floor(b.maxY + 0.2 + this.maxUpStep()), (int) Math.floor(b.maxZ + 0.1)); var groundCuboid = Shapes.create(groundBox); var floorCuboid = Shapes.create(floorBox); + var floorOneBlockBelowCuboid = Shapes.create(floorOneBlockBelowBox); var wallCuboid = Shapes.create(wallBox); var stepWallCuboid = wallCuboid.move(0, this.maxUpStep() - 0.05, 0); boolean wallHit = false; @@ -1276,6 +1309,7 @@ public void collisionStateTick() { var blockShape = state.getCollisionShape(this.level(), pos, shapeCtx).move(pos.getX(), pos.getY(), pos.getZ()); this.automobileOnGround |= Shapes.joinIsNotEmpty(blockShape, groundCuboid, BooleanOp.AND); this.isFloorDirectlyBelow |= Shapes.joinIsNotEmpty(blockShape, floorCuboid, BooleanOp.AND); + this.isFloorWithinOneBlockBelow |= Shapes.joinIsNotEmpty(blockShape, floorOneBlockBelowCuboid, BooleanOp.AND); wallHit |= Shapes.joinIsNotEmpty(blockShape, wallCuboid, BooleanOp.AND); stepWallHit |= Shapes.joinIsNotEmpty(blockShape, stepWallCuboid, BooleanOp.AND); } @@ -1351,7 +1385,7 @@ private void driftingTick() { int prevTurboCharge = turboCharge; // Handles starting a drift - if (!prevHoldDrift && input.holdingDrift) { + if ((!prevHoldDrift && input.holdingDrift) || (!prevPrevHoldDrift && prevHoldDrift) || (!prevPrevPrevHoldDrift && prevPrevHoldDrift)) { if (steering != 0 && !drifting && hSpeed > 0.4f && automobileOnGround) { setDrifting(true); controllerAction(AutomobileController::driftChargeRumble); @@ -1405,13 +1439,29 @@ private void driftingTick() { } private void rampTrickTick() { - if (wasOnGround && !automobileOnGround && !isFloorDirectlyBelow && hSpeed > TRICK_MIN_VELOCITY && - ((!prevHoldDrift && input.holdingDrift) || (!prevPrevHoldDrift && prevHoldDrift) || (!prevPrevPrevHoldDrift && prevPrevHoldDrift))) { + boolean trickCommandEarly = wasOnGround && + !automobileOnGround && + !isFloorDirectlyBelow && + hSpeed > TRICK_MIN_VELOCITY && + ((!prevHoldDrift && input.holdingDrift) || (!prevPrevHoldDrift && prevHoldDrift) || (!prevPrevPrevHoldDrift && prevPrevHoldDrift)); + + boolean trickCommandLate = !wasOnGround && + !automobileOnGround && + !isFloorDirectlyBelow && + hSpeed > TRICK_MIN_VELOCITY && + airTime < 2 && + (!prevHoldDrift && input.holdingDrift); + + if (trickCommandEarly || trickCommandLate) { setDrifting(false); - controllerAction(c -> c.updateMaxChargeRumbleState(false)); - boost(0.20f, 9); spawnTrickEffect(); level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.AMBIENT, 0.25f, 1.5f, true); + trickBuffered = true; + } + + if ((isFloorWithinOneBlockBelow || isFloorDirectlyBelow || automobileOnGround) && trickBuffered) { + boost(0.26f, 21); + trickBuffered = false; } } diff --git a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java index 22d2141c..bf7ee0d1 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java +++ b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java @@ -141,7 +141,6 @@ protected float getPitch(AutomobileEntity automobile) { @Override protected float getVolume(AutomobileEntity automobile) { float volumeBoost = ((Math.clamp(automobile.getHSpeed(), 0.2f, 1.4f) - 0.2f) / 1.2f) * 3; - System.out.println(volumeBoost); return automobile.automobileOnGround() ? 0.75f + volumeBoost : 0; } From 2c295eef7090e2f1dc222a6bbd0b03fc704f5c82 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Sun, 10 Aug 2025 12:30:53 +0200 Subject: [PATCH 05/19] Adjusted drift and boost parameters to more closely match MK8DX --- .../automobility/block/DashPanelBlock.java | 2 +- .../automobility/entity/AutomobileEntity.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java index 940a2fde..47a9f00c 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/DashPanelBlock.java @@ -116,7 +116,7 @@ public static void onCollideWithDashPanel(@Nullable BlockState panelState, Entit } if (entity instanceof AutomobileEntity auto) { - auto.boost(0.4f, 50); + auto.boost(0.35f, 50); } else if (entity.getType().is(AutomobilityEntities.DASH_PANEL_BOOSTABLES)) { if (entity instanceof LivingEntity living) { living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 40, 6, true, false, false)); diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index cfca437e..ab483704 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -118,7 +118,7 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En public static final int SMALL_TURBO_TIME = 35; public static final int MEDIUM_TURBO_TIME = 70; - public static final int LARGE_TURBO_TIME = 115; + public static final int LARGE_TURBO_TIME = 125; public static final float TERMINAL_VELOCITY = -1.2f; public static final float TRICK_MIN_VELOCITY = 0.4f; @@ -1372,11 +1372,11 @@ private void steeringTick() { private void consumeTurboCharge() { if (turboCharge > LARGE_TURBO_TIME) { - boost(0.33f, 38); + boost(0.25f, 38); } else if (turboCharge > MEDIUM_TURBO_TIME) { - boost(0.26f, 21); + boost(0.25f, 21); } else if (turboCharge > SMALL_TURBO_TIME) { - boost(0.20f, 9); + boost(0.25f, 9); } turboCharge = 0; } @@ -1460,7 +1460,7 @@ private void rampTrickTick() { } if ((isFloorWithinOneBlockBelow || isFloorDirectlyBelow || automobileOnGround) && trickBuffered) { - boost(0.26f, 21); + boost(0.25f, 9); trickBuffered = false; } } From 4f980ef3882d3cb46847b8880d8827027b372722 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Mon, 11 Aug 2025 12:55:25 +0200 Subject: [PATCH 06/19] Refactored offroad block system --- .../automobility/block/AutomobilityBlocks.java | 8 ++++---- ...OffRoadBlock.java => LayeredOffroadBlock.java} | 15 +++++++++++++-- .../automobility/block/OffroadBlock.java | 9 +++++++++ .../automobility/entity/AutomobileEntity.java | 14 ++++++-------- 4 files changed, 32 insertions(+), 14 deletions(-) rename common/src/main/java/io/github/foundationgames/automobility/block/{OffRoadBlock.java => LayeredOffroadBlock.java} (86%) create mode 100644 common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java b/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java index 5f5db7c2..391bfd66 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java @@ -45,10 +45,10 @@ public enum AutomobilityBlocks {; public static final Eventual DASH_PANEL = register("dash_panel", () -> new DashPanelBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK) .lightLevel(s -> s.getValue(DashPanelBlock.POWERED) ? 0 : 1).emissiveRendering((s, l, p) -> !s.getValue(DashPanelBlock.POWERED)).noCollission()), b -> new DashPanelItem(b, new Item.Properties()), Automobility.TAB); - public static final Eventual GRASS_OFF_ROAD = register("grass_off_road", () -> new OffRoadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK).noCollission(), AUtils.colorFromInt(0x406918)), Automobility.TAB); - public static final Eventual DIRT_OFF_ROAD = register("dirt_off_road", () -> new OffRoadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).noCollission(), AUtils.colorFromInt(0x594227)), Automobility.TAB); - public static final Eventual SAND_OFF_ROAD = register("sand_off_road", () -> new OffRoadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).noCollission(), AUtils.colorFromInt(0xC2B185)), Automobility.TAB); - public static final Eventual SNOW_OFF_ROAD = register("snow_off_road", () -> new OffRoadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SNOW_BLOCK).noCollission(), AUtils.colorFromInt(0xD0E7ED)), Automobility.TAB); + public static final Eventual GRASS_OFF_ROAD = register("grass_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK).noCollission(), AUtils.colorFromInt(0x406918)), Automobility.TAB); + public static final Eventual DIRT_OFF_ROAD = register("dirt_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).noCollission(), AUtils.colorFromInt(0x594227)), Automobility.TAB); + public static final Eventual SAND_OFF_ROAD = register("sand_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).noCollission(), AUtils.colorFromInt(0xC2B185)), Automobility.TAB); + public static final Eventual SNOW_OFF_ROAD = register("snow_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SNOW_BLOCK).noCollission(), AUtils.colorFromInt(0xD0E7ED)), Automobility.TAB); public static final Eventual LAUNCH_GEL = register("launch_gel", () -> new LaunchGelBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.CLAY).strength(0.1f).sound(SoundType.HONEY_BLOCK).noCollission()), Automobility.TAB); diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/OffRoadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java similarity index 86% rename from common/src/main/java/io/github/foundationgames/automobility/block/OffRoadBlock.java rename to common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java index e5c1bc92..c1e982f8 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/OffRoadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java @@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; -public class OffRoadBlock extends Block { +public class LayeredOffroadBlock extends Block implements OffroadBlock { public static final VoxelShape ONE_LAYER_SHAPE = box(0, 0, 0, 16, 2, 16); public static final VoxelShape TWO_LAYER_SHAPE = box(0, 0, 0, 16, 4, 16); public static final VoxelShape THREE_LAYER_SHAPE = box(0, 0, 0, 16, 6, 16); @@ -25,7 +25,7 @@ public class OffRoadBlock extends Block { public final Vector3f color; - public OffRoadBlock(Properties settings, Vector3f color) { + public LayeredOffroadBlock(Properties settings, Vector3f color) { super(settings.pushReaction(PushReaction.DESTROY)); registerDefaultState(defaultBlockState().setValue(LAYERS, 1)); this.color = color; @@ -73,4 +73,15 @@ protected void createBlockStateDefinition(StateDefinition.Builder 0.01; // Handle being in off-road - if (boostSpeed < 0.4f && level().getBlockState(blockPosition()).getBlock() instanceof OffRoadBlock block) { - int layers = level().getBlockState(blockPosition()).getValue(OffRoadBlock.LAYERS); - float cap = stats.getComfortableSpeed() * (1 - ((float)layers / 3.5f)); + if (boostSpeed < 0.4f && level().getBlockState(blockPosition()).getBlock() instanceof OffroadBlock block) { + BlockState blockState = level().getBlockState(blockPosition()); + float cap = stats.getComfortableSpeed() * block.getSpeedMultiplier(blockState); this.updateEngineSpeed(Math.min(cap, engineSpeed)); - this.debrisColor = block.color; + this.debrisColor = block.getDebrisColor(blockState); this.offRoad = true; } else this.offRoad = false; From 57076fd5d2cea3a184fe131c37170b9a008b6974 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Mon, 11 Aug 2025 18:02:15 +0200 Subject: [PATCH 07/19] Merged rotation smoothing bugfix by mocksonline from PR #129 of the main repo --- .../automobility/mixin/EntityMixin.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/common/src/main/java/io/github/foundationgames/automobility/mixin/EntityMixin.java b/common/src/main/java/io/github/foundationgames/automobility/mixin/EntityMixin.java index 0441d24d..e79fc7fa 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/mixin/EntityMixin.java +++ b/common/src/main/java/io/github/foundationgames/automobility/mixin/EntityMixin.java @@ -1,15 +1,42 @@ package io.github.foundationgames.automobility.mixin; import io.github.foundationgames.automobility.entity.AutomobileEntity; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Entity.class) public class EntityMixin { + @Shadow + private float yRot; + @Shadow + public float yRotO; + @Unique + private float automobility$lastYRot = 0f; + + // Rotation smoothing bug fix taken from https://github.com/FoundationGames/Automobility/pull/129 + @Inject(method = "setYRot", at = @At("HEAD"), cancellable = true) + public void automobility$smoothYRotOnAutomobile(float yRot, CallbackInfo ci) { + Entity self = (Entity)(Object)this; + if (self instanceof LocalPlayer player && player.isLocalPlayer() && self.getVehicle() instanceof AutomobileEntity) { + float smoothedYRot = Mth.rotLerp(1.0f, this.automobility$lastYRot, yRot); + this.automobility$lastYRot = smoothedYRot; + + ci.cancel(); + this.yRotO = this.yRot; + this.yRot = smoothedYRot; + } else { + this.automobility$lastYRot = yRot; + } + } + @Inject(method = "stopRiding", at = @At("HEAD")) private void automobility$clientFinalSyncBeforeDismountAutomobile(CallbackInfo ci) { var self = (Entity) (Object) this; From 150762aca69d4fa2389616567a9d8e1ec02d297c Mon Sep 17 00:00:00 2001 From: Toastworth Date: Mon, 11 Aug 2025 21:57:50 +0200 Subject: [PATCH 08/19] Added ground particles/sounds and made sound effects more muted while underwater --- .../automobility/entity/AutomobileEntity.java | 106 ++++++++++++++++-- .../mixin/BlockBehaviorAccess.java | 14 +++ .../sound/AutomobileSoundInstance.java | 9 +- .../SlicedLoopingAutomobileSoundInstance.java | 2 +- .../main/resources/automobility.mixins.json | 1 + 5 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 common/src/main/java/io/github/foundationgames/automobility/mixin/BlockBehaviorAccess.java diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index bb79c36a..79d28138 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -19,6 +19,7 @@ import io.github.foundationgames.automobility.controller.AutomobileController; import io.github.foundationgames.automobility.item.AutomobileInteractable; import io.github.foundationgames.automobility.item.AutomobilityItems; +import io.github.foundationgames.automobility.mixin.BlockBehaviorAccess; import io.github.foundationgames.automobility.particle.AutomobilityParticles; import io.github.foundationgames.automobility.platform.Platform; import io.github.foundationgames.automobility.screen.AutomobileContainerLevelAccess; @@ -33,6 +34,7 @@ import net.minecraft.core.Cursor3D; import net.minecraft.core.Direction; import net.minecraft.core.Holder; +import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; @@ -69,6 +71,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.gameevent.GameEvent; @@ -218,6 +223,7 @@ public class AutomobileEntity extends Entity implements RenderableAutomobile, En private boolean wasEngineRunning = false; private float standStillTime = -1.3f; + private float stepSoundMovementDistance; public void writeSyncStateData(FriendlyByteBuf buf) { buf.writeInt(boostTimer); @@ -1079,7 +1085,7 @@ public void receiveVehicleCollisions() { .multiply(1, 0, 1)); if (hadVehicleCollision <= 0) { - level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.COLLISION.require(), SoundSource.AMBIENT, 0.22f, 0.7f + (0.06f * (this.level().random.nextFloat() - 0.5f)), false); + level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.COLLISION.require(), SoundSource.AMBIENT, 0.22f * getUnderwaterVolumeMultiplier(), 0.7f + (0.06f * (this.level().random.nextFloat() - 0.5f)) * getUnderwaterPitchMultiplier(), false); this.engineSpeed *= 0.6f; hadVehicleCollision = 12; } @@ -1106,7 +1112,7 @@ public void postMovementTick() { double knockSpeed = ((-0.2 * hSpeed) - 0.5); addedVelocity = addedVelocity.add(Math.sin(angle) * knockSpeed, 0, Math.cos(angle) * knockSpeed); - level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.COLLISION.require(), SoundSource.AMBIENT, 0.76f, 0.65f + (0.06f * (this.level().random.nextFloat() - 0.5f)), true); + level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.COLLISION.require(), SoundSource.AMBIENT, 0.76f * getUnderwaterVolumeMultiplier(), 0.65f + (0.06f * (this.level().random.nextFloat() - 0.5f)) * getUnderwaterPitchMultiplier(), true); if (isVehicle() && level().isClientSide()) { if (getPassengers().stream().anyMatch(p -> p instanceof LocalPlayer)) { @@ -1197,6 +1203,76 @@ public void postMovementTick() { if (this.automobileOnGround()) { this.smoothAngVel = Mth.lerp(0.34f, this.smoothAngVel, this.measuredAngVel); } + + // Add step sounds and particles + if(automobileOnGround() && Math.abs(getHSpeed()) > 0.05f && !(level().getBlockState(blockPosition()).getBlock() instanceof OffroadBlock block)) { + stepSoundMovementDistance += Math.abs(getHSpeed()); + + if(stepSoundMovementDistance > 0.5f) { + if(isUnderWater()) { + this.playSound(this.getSwimSound(), 0.04f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.3F); + + if(Math.abs(getHSpeed()) > 0.2f && !isReversing()) { + spawnBubbleParticle(); + } + } else { + BlockPos stepSoundPosition = getPrimaryStepSoundBlockPos(blockPosition().below()); + BlockState stepSoundBlockState = level().getBlockState(stepSoundPosition); + SoundType soundType = stepSoundBlockState.getSoundType(); + this.playSound(soundType.getStepSound(), soundType.getVolume() * 0.09f * getUnderwaterVolumeMultiplier(), soundType.getPitch() * 0.8f * getUnderwaterPitchMultiplier()); + + if(Math.abs(getHSpeed()) > 0.2f && !isReversing()) { + spawnGroundParticle(); + } + } + + stepSoundMovementDistance = 0; + } + } + } + + private void spawnGroundParticle() { + BlockPos blockPos = this.getOnPos(); + BlockState blockState = this.level().getBlockState(blockPos); + BlockBehaviorAccess blockProperties = (BlockBehaviorAccess)blockState.getBlock().properties(); + if(!blockProperties.getSpawnTerrainParticles()) return; + + if (blockState.getRenderShape() != RenderShape.INVISIBLE) { + Vec3 deltaMovement = this.getDeltaMovement(); + for (var wheel : this.getFrame().model().wheelBase().wheels()) { + float particleResistance = Math.clamp(blockProperties.getExplosionResistance(), 2, 9) * 0.11f; + particleResistance -= ((Math.clamp(Math.abs(getHSpeed()), 0.3f, 1f)) - 0.3f) * 0.25f; + if(isDrifting()) particleResistance *= 0.75f; + if(random.nextFloat() < particleResistance) continue; + + if (wheel.end() == WheelBase.WheelEnd.BACK) { + Vector3d pos = new Vector3d(wheel.right() + ((wheel.right() > 0 ? 1 : -1) * this.getWheels().model().width() * wheel.scale()), 0, wheel.forward()).mul(0.0625); + localPosToWorldSpace(pos); + pos.add(-deltaMovement.x * 0.9f, -0.025f, -deltaMovement.z * 0.9f); + + level().addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), pos.x(), pos.y(), pos.z(), deltaMovement.x * (double)-1.5f + (random.nextFloat() - 0.5f) * 2f, (double)1.5f, deltaMovement.z * (double)-1.5f + (random.nextFloat() - 0.5f) * 2f); + } + } + } + } + + private void spawnBubbleParticle() { + BlockPos blockPos = this.getOnPos(); + BlockState blockState = this.level().getBlockState(blockPos); + if (blockState.getRenderShape() != RenderShape.INVISIBLE) { + Vec3 deltaMovement = this.getDeltaMovement(); + for (var wheel : this.getFrame().model().wheelBase().wheels()) { + if(random.nextFloat() < 0.2f) continue; + + if (wheel.end() == WheelBase.WheelEnd.BACK) { + Vector3d pos = new Vector3d(wheel.right() + ((wheel.right() > 0 ? 1 : -1) * this.getWheels().model().width() * wheel.scale()), 0, wheel.forward()).mul(0.0625); + localPosToWorldSpace(pos); + pos.add(-deltaMovement.x * 0.9f, 0, -deltaMovement.z * 0.9f); + + level().addParticle(ParticleTypes.BUBBLE, pos.x(), pos.y(), pos.z(), deltaMovement.x * (double)-1.5f + (random.nextFloat() - 0.5f) * 1.5f, 0.5f, deltaMovement.z * (double)-1.5f + (random.nextFloat() - 0.5f) * 1.5f); + } + } + } } public void whenRotated(float dYaw, Entity e) { @@ -1204,6 +1280,18 @@ public void whenRotated(float dYaw, Entity e) { e.setYBodyRot(Mth.wrapDegrees(e.getYRot() + dYaw)); } + public float getUnderwaterVolumeMultiplier() { + return isUnderWater() ? 0.8f : 1.0f; + } + + public float getUnderwaterPitchMultiplier() { + return isUnderWater() ? 0.8f : 1.0f; + } + + public boolean isReversing() { + return engineSpeed < 0; + } + private void whenRotatedSmooth(Entity passenger) { double lockStrength = 0.36; @@ -1359,7 +1447,7 @@ public void boost(float power, int time) { float boostSoundPitch = 1.6f - (Math.clamp(power - 0.15f, 0f, 0.25f) * 3); float boostSoundVolume = 0.5f; - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.BLAZE_SHOOT, SoundSource.AMBIENT, boostSoundVolume, boostSoundPitch, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.BLAZE_SHOOT, SoundSource.AMBIENT, boostSoundVolume * getUnderwaterVolumeMultiplier(), boostSoundPitch * getUnderwaterPitchMultiplier(), true); } private void steeringTick() { @@ -1424,11 +1512,11 @@ private void driftingTick() { } if (turboCharge >= SMALL_TURBO_TIME && prevTurboCharge < SMALL_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.09f, 1.5f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.09f * getUnderwaterVolumeMultiplier(), 1.5f * getUnderwaterPitchMultiplier(), true); } else if (turboCharge >= MEDIUM_TURBO_TIME && prevTurboCharge < MEDIUM_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.10f, 1.75f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.10f * getUnderwaterVolumeMultiplier(), 1.75f * getUnderwaterPitchMultiplier(), true); } else if (turboCharge >= LARGE_TURBO_TIME && prevTurboCharge < LARGE_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.11f, 2.0f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.11f * getUnderwaterVolumeMultiplier(), 2.0f * getUnderwaterPitchMultiplier(), true); } this.prevPrevPrevHoldDrift = this.prevPrevHoldDrift; @@ -1453,7 +1541,7 @@ private void rampTrickTick() { if (trickCommandEarly || trickCommandLate) { setDrifting(false); spawnTrickEffect(); - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.AMBIENT, 0.25f, 1.5f, true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.AMBIENT, 0.25f * getUnderwaterVolumeMultiplier(), 1.5f * getUnderwaterPitchMultiplier(), true); trickBuffered = true; } @@ -1601,7 +1689,7 @@ public float getStandStillTime() { public void playHitSound(Vec3 pos) { level().gameEvent(this, GameEvent.ENTITY_DAMAGE, pos); - level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.COPPER_BREAK, SoundSource.AMBIENT, 1, 0.9f + (this.level().random.nextFloat() * 0.2f)); + level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.COPPER_BREAK, SoundSource.AMBIENT, 1 * getUnderwaterVolumeMultiplier(), 0.9f + (this.level().random.nextFloat() * 0.2f) * getUnderwaterPitchMultiplier()); } private void dropParts(Vec3 pos) { @@ -1899,7 +1987,7 @@ public float getTrackedFrontAttachmentAnimation() { public void bounce() { suspensionBounceTimer = 3; - level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.LANDING.require(), SoundSource.AMBIENT, 1, 1.5f + (0.15f * (this.level().random.nextFloat() - 0.5f)), true); + level().playLocalSound(this.getX(), this.getY(), this.getZ(), AutomobilitySounds.LANDING.require(), SoundSource.AMBIENT, 1 * getUnderwaterVolumeMultiplier(), 1.5f + (0.15f * (this.level().random.nextFloat() - 0.5f)) * getUnderwaterPitchMultiplier(), true); controllerAction(AutomobileController::groundThudRumble); } diff --git a/common/src/main/java/io/github/foundationgames/automobility/mixin/BlockBehaviorAccess.java b/common/src/main/java/io/github/foundationgames/automobility/mixin/BlockBehaviorAccess.java new file mode 100644 index 00000000..8759c299 --- /dev/null +++ b/common/src/main/java/io/github/foundationgames/automobility/mixin/BlockBehaviorAccess.java @@ -0,0 +1,14 @@ +package io.github.foundationgames.automobility.mixin; + +import net.minecraft.world.level.block.state.BlockBehaviour; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(BlockBehaviour.Properties.class) +public interface BlockBehaviorAccess { + @Accessor + boolean getSpawnTerrainParticles(); + + @Accessor + float getExplosionResistance(); +} diff --git a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java index bf7ee0d1..802198fe 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java +++ b/common/src/main/java/io/github/foundationgames/automobility/sound/AutomobileSoundInstance.java @@ -105,12 +105,12 @@ protected boolean canPlay(AutomobileEntity automobile) { @Override protected float getPitch(AutomobileEntity automobile) { - return (float) (Math.pow(4, (automobile.getEffectiveSpeed() - 0.9)) + 0.32); + return ((float) (Math.pow(4, (automobile.getEffectiveSpeed() - 0.9)) + 0.32)) * automobile.getUnderwaterPitchMultiplier(); } @Override protected float getVolume(AutomobileEntity automobile) { - return 0.7f; + return 0.7f * automobile.getUnderwaterVolumeMultiplier(); } @Override @@ -134,14 +134,13 @@ protected boolean canPlay(AutomobileEntity automobile) { @Override protected float getPitch(AutomobileEntity automobile) { - return automobile.burningOut() ? 0.75f : - 1 + 0.056f * ((float)Math.min(automobile.getTurboCharge(), AutomobileEntity.LARGE_TURBO_TIME) / AutomobileEntity.LARGE_TURBO_TIME); + return (automobile.burningOut() ? 0.75f : 1 + 0.056f * ((float)Math.min(automobile.getTurboCharge(), AutomobileEntity.LARGE_TURBO_TIME) / AutomobileEntity.LARGE_TURBO_TIME)) * automobile.getUnderwaterPitchMultiplier(); } @Override protected float getVolume(AutomobileEntity automobile) { float volumeBoost = ((Math.clamp(automobile.getHSpeed(), 0.2f, 1.4f) - 0.2f) / 1.2f) * 3; - return automobile.automobileOnGround() ? 0.75f + volumeBoost : 0; + return (automobile.automobileOnGround() ? 0.75f + volumeBoost : 0) * automobile.getUnderwaterVolumeMultiplier(); } @Override diff --git a/common/src/main/java/io/github/foundationgames/automobility/sound/SlicedLoopingAutomobileSoundInstance.java b/common/src/main/java/io/github/foundationgames/automobility/sound/SlicedLoopingAutomobileSoundInstance.java index 95fba379..4fac9657 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/sound/SlicedLoopingAutomobileSoundInstance.java +++ b/common/src/main/java/io/github/foundationgames/automobility/sound/SlicedLoopingAutomobileSoundInstance.java @@ -96,7 +96,7 @@ protected float getPitch(AutomobileEntity automobile) { @Override protected float getVolume(AutomobileEntity automobile) { - return 2; + return 2 * automobile.getUnderwaterVolumeMultiplier(); } @Override diff --git a/common/src/main/resources/automobility.mixins.json b/common/src/main/resources/automobility.mixins.json index 1d0c50df..af749a39 100644 --- a/common/src/main/resources/automobility.mixins.json +++ b/common/src/main/resources/automobility.mixins.json @@ -7,6 +7,7 @@ "mixins": [ "AABBMixin", "AbstractContainerMenuMixin", + "BlockBehaviorAccess", "EntityMixin", "ItemCombinerMenuMixin", "PlayerEnderChestContainerMixin", From e6512b3e66cef246e357f071213868ec583a275d Mon Sep 17 00:00:00 2001 From: Toastworth Date: Mon, 11 Aug 2025 23:29:16 +0200 Subject: [PATCH 09/19] Fixed mixin issue on dedicated servers --- common/src/main/resources/automobility.mixins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/resources/automobility.mixins.json b/common/src/main/resources/automobility.mixins.json index af749a39..7da5d389 100644 --- a/common/src/main/resources/automobility.mixins.json +++ b/common/src/main/resources/automobility.mixins.json @@ -8,7 +8,6 @@ "AABBMixin", "AbstractContainerMenuMixin", "BlockBehaviorAccess", - "EntityMixin", "ItemCombinerMenuMixin", "PlayerEnderChestContainerMixin", "ServerGamePacketListenerImplMixin", @@ -17,6 +16,7 @@ "client": [ "EntityRenderDispatcherMixin", "EntityRenderersMixin", + "EntityMixin", "KeyMappingAccess", "LocalPlayerMixin", "MultiPlayerGameModeMixin", From 9ae796b35cfdd7fa39e3c6a93a2c73c522946751 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Mon, 11 Aug 2025 23:42:11 +0200 Subject: [PATCH 10/19] Added slime bounce sound to launch gel --- .../foundationgames/automobility/entity/AutomobileEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 79d28138..1429bb42 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -902,6 +902,7 @@ public void movementTick() { this.setSpeed(Math.max(this.getHSpeed(), 0.1f), Math.max(this.getVSpeed(), 0.9f)); this.jumpCooldown = 5; this.automobileOnGround = false; + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.SLIME_JUMP, SoundSource.AMBIENT, 0.8f * getUnderwaterVolumeMultiplier(), getUnderwaterPitchMultiplier(), true); } // Track the last position of the automobile From a0942a2a4f91234efeb31247f47b596fb9f428b0 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Tue, 12 Aug 2025 00:01:00 +0200 Subject: [PATCH 11/19] Slightly lowered volume of block sounds (again) --- .../foundationgames/automobility/entity/AutomobileEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 1429bb42..8277abdf 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -1220,7 +1220,7 @@ public void postMovementTick() { BlockPos stepSoundPosition = getPrimaryStepSoundBlockPos(blockPosition().below()); BlockState stepSoundBlockState = level().getBlockState(stepSoundPosition); SoundType soundType = stepSoundBlockState.getSoundType(); - this.playSound(soundType.getStepSound(), soundType.getVolume() * 0.09f * getUnderwaterVolumeMultiplier(), soundType.getPitch() * 0.8f * getUnderwaterPitchMultiplier()); + this.playSound(soundType.getStepSound(), soundType.getVolume() * 0.07f * getUnderwaterVolumeMultiplier(), soundType.getPitch() * 0.8f * getUnderwaterPitchMultiplier()); if(Math.abs(getHSpeed()) > 0.2f && !isReversing()) { spawnGroundParticle(); From efebf45ea3382ac761b4b1814bbb17264cf3d38d Mon Sep 17 00:00:00 2001 From: Toastworth Date: Wed, 13 Aug 2025 16:51:23 +0200 Subject: [PATCH 12/19] Fixed Quilt maven and tweaked details --- .../automobility/entity/AutomobileEntity.java | 10 +++++----- fabric/build.gradle.kts | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 8277abdf..96a7acec 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -1211,7 +1211,7 @@ public void postMovementTick() { if(stepSoundMovementDistance > 0.5f) { if(isUnderWater()) { - this.playSound(this.getSwimSound(), 0.04f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.3F); + this.playSound(this.getSwimSound(), 0.035f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.3F); if(Math.abs(getHSpeed()) > 0.2f && !isReversing()) { spawnBubbleParticle(); @@ -1251,7 +1251,7 @@ private void spawnGroundParticle() { localPosToWorldSpace(pos); pos.add(-deltaMovement.x * 0.9f, -0.025f, -deltaMovement.z * 0.9f); - level().addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), pos.x(), pos.y(), pos.z(), deltaMovement.x * (double)-1.5f + (random.nextFloat() - 0.5f) * 2f, (double)1.5f, deltaMovement.z * (double)-1.5f + (random.nextFloat() - 0.5f) * 2f); + level().addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), pos.x(), pos.y(), pos.z(), deltaMovement.x * (double)-1.5f + (random.nextFloat() - 0.5f) * 2.5f, (double)1.5f, deltaMovement.z * (double)-1.5f + (random.nextFloat() - 0.5f) * 2.5f); } } } @@ -1513,11 +1513,11 @@ private void driftingTick() { } if (turboCharge >= SMALL_TURBO_TIME && prevTurboCharge < SMALL_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.09f * getUnderwaterVolumeMultiplier(), 1.5f * getUnderwaterPitchMultiplier(), true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.08f * getUnderwaterVolumeMultiplier(), 1.5f * getUnderwaterPitchMultiplier(), true); } else if (turboCharge >= MEDIUM_TURBO_TIME && prevTurboCharge < MEDIUM_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.10f * getUnderwaterVolumeMultiplier(), 1.75f * getUnderwaterPitchMultiplier(), true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.09f * getUnderwaterVolumeMultiplier(), 1.75f * getUnderwaterPitchMultiplier(), true); } else if (turboCharge >= LARGE_TURBO_TIME && prevTurboCharge < LARGE_TURBO_TIME) { - level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.11f * getUnderwaterVolumeMultiplier(), 2.0f * getUnderwaterPitchMultiplier(), true); + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.1f * getUnderwaterVolumeMultiplier(), 2.0f * getUnderwaterPitchMultiplier(), true); } this.prevPrevPrevHoldDrift = this.prevPrevHoldDrift; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 256ddfb0..2694f16a 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -13,6 +13,8 @@ repositories { maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } maven { url = uri("https://jitpack.io") } maven { url = uri("https://maven.isxander.dev/releases") } + + maven { url = uri("https://maven.quiltmc.org/repository/release") } } dependencies { From e6102d0c4655b69a0b60178ced3695080fbbd87a Mon Sep 17 00:00:00 2001 From: Toastworth Date: Wed, 13 Aug 2025 18:04:41 +0200 Subject: [PATCH 13/19] Added missing layers to layered offroad blocks --- .../block/LayeredOffroadBlock.java | 38 ++++++++++++------- .../blockstates/dirt_off_road.json | 21 ++++++++-- .../blockstates/grass_off_road.json | 21 ++++++++-- .../blockstates/sand_off_road.json | 21 ++++++++-- .../blockstates/snow_off_road.json | 21 ++++++++-- .../models/block/dirt_off_road_3.json | 7 ++++ .../models/block/dirt_off_road_4.json | 7 ++++ .../models/block/dirt_off_road_5.json | 7 ++++ .../models/block/dirt_off_road_6.json | 7 ++++ .../models/block/dirt_off_road_7.json | 7 ++++ .../models/block/grass_off_road_3.json | 7 ++++ .../models/block/grass_off_road_4.json | 7 ++++ .../models/block/grass_off_road_5.json | 7 ++++ .../models/block/grass_off_road_6.json | 7 ++++ .../models/block/grass_off_road_7.json | 7 ++++ .../models/block/sand_off_road_3.json | 7 ++++ .../models/block/sand_off_road_4.json | 7 ++++ .../models/block/sand_off_road_5.json | 7 ++++ .../models/block/sand_off_road_6.json | 7 ++++ .../models/block/sand_off_road_7.json | 7 ++++ .../models/block/snow_off_road_3.json | 7 ++++ .../models/block/snow_off_road_4.json | 7 ++++ .../models/block/snow_off_road_5.json | 7 ++++ .../models/block/snow_off_road_6.json | 7 ++++ .../models/block/snow_off_road_7.json | 7 ++++ .../models/block/template_off_road_3.json | 20 ++++++++++ .../models/block/template_off_road_4.json | 20 ++++++++++ .../models/block/template_off_road_5.json | 20 ++++++++++ .../models/block/template_off_road_6.json | 20 ++++++++++ .../models/block/template_off_road_7.json | 20 ++++++++++ 30 files changed, 337 insertions(+), 25 deletions(-) create mode 100644 common/src/main/resources/assets/automobility/models/block/dirt_off_road_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/dirt_off_road_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/dirt_off_road_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/dirt_off_road_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/dirt_off_road_7.json create mode 100644 common/src/main/resources/assets/automobility/models/block/grass_off_road_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/grass_off_road_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/grass_off_road_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/grass_off_road_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/grass_off_road_7.json create mode 100644 common/src/main/resources/assets/automobility/models/block/sand_off_road_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/sand_off_road_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/sand_off_road_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/sand_off_road_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/sand_off_road_7.json create mode 100644 common/src/main/resources/assets/automobility/models/block/snow_off_road_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/snow_off_road_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/snow_off_road_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/snow_off_road_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/snow_off_road_7.json create mode 100644 common/src/main/resources/assets/automobility/models/block/template_off_road_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/template_off_road_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/template_off_road_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/template_off_road_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/template_off_road_7.json diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java index c1e982f8..04487460 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java @@ -7,6 +7,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.IntegerProperty; @@ -17,13 +18,18 @@ import org.joml.Vector3f; public class LayeredOffroadBlock extends Block implements OffroadBlock { - public static final VoxelShape ONE_LAYER_SHAPE = box(0, 0, 0, 16, 2, 16); - public static final VoxelShape TWO_LAYER_SHAPE = box(0, 0, 0, 16, 4, 16); - public static final VoxelShape THREE_LAYER_SHAPE = box(0, 0, 0, 16, 6, 16); - - public static final IntegerProperty LAYERS = IntegerProperty.create("layers", 1, 3); + public static final int MAX_LAYERS = 8; + public static final IntegerProperty LAYERS = IntegerProperty.create("layers", 1, MAX_LAYERS); public final Vector3f color; + private static final VoxelShape[] SHAPES_BY_LAYER; + + static { + SHAPES_BY_LAYER = new VoxelShape[MAX_LAYERS]; + for (int i = 0; i < SHAPES_BY_LAYER.length; i++) { + SHAPES_BY_LAYER[i] = getShapeForLayerCount(i + 1); + } + } public LayeredOffroadBlock(Properties settings, Vector3f color) { super(settings.pushReaction(PushReaction.DESTROY)); @@ -35,7 +41,7 @@ public LayeredOffroadBlock(Properties settings, Vector3f color) { @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { var state = ctx.getLevel().getBlockState(ctx.getClickedPos()); - if (state.is(this) && state.getValue(LAYERS) < 3) { + if (state.is(this) && state.getValue(LAYERS) < MAX_LAYERS) { return state.setValue(LAYERS, state.getValue(LAYERS) + 1); } return super.getStateForPlacement(ctx); @@ -43,7 +49,7 @@ public BlockState getStateForPlacement(BlockPlaceContext ctx) { @Override public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { - return state.getValue(LAYERS) < 3 && context.getItemInHand().is(this.asItem()); + return state.getValue(LAYERS) < MAX_LAYERS && context.getItemInHand().is(this.asItem()); } @Override @@ -61,11 +67,12 @@ public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { @Override public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { - return switch (state.getValue(LAYERS)) { - case 2 -> TWO_LAYER_SHAPE; - case 3 -> THREE_LAYER_SHAPE; - default -> ONE_LAYER_SHAPE; - }; + int shapeIndex = state.getValue(LAYERS) - 1; + if(shapeIndex >= 0 && shapeIndex < SHAPES_BY_LAYER.length) { + return SHAPES_BY_LAYER[shapeIndex]; + } else { + return SHAPES_BY_LAYER[0]; + } } @Override @@ -77,11 +84,16 @@ protected void createBlockStateDefinition(StateDefinition.Builder Date: Wed, 13 Aug 2025 18:19:20 +0200 Subject: [PATCH 14/19] Added drift charge sound effect to burnout charge --- .../automobility/entity/AutomobileEntity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 96a7acec..01a1d97f 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -1583,7 +1583,13 @@ private void burnoutTick() { if (this.addedVelocity.length() > 0.05 || Math.abs(this.angularSpeed) > 0.05) { createDriftParticles(); } + + int prevTurboCharge = turboCharge; if (hSpeed < 0.08 && turboCharge <= SMALL_TURBO_TIME) turboCharge += 1; + + if (turboCharge >= SMALL_TURBO_TIME && prevTurboCharge < SMALL_TURBO_TIME) { + level().playLocalSound(getX(), getY(), getZ(), SoundEvents.WITHER_SHOOT, SoundSource.AMBIENT, 0.08f * getUnderwaterVolumeMultiplier(), 1.5f * getUnderwaterPitchMultiplier(), true); + } } if (!input.braking) { endBurnout(); From a95bdc2345a2325382844001c73b60c2001a229e Mon Sep 17 00:00:00 2001 From: Toastworth Date: Wed, 13 Aug 2025 23:25:33 +0200 Subject: [PATCH 15/19] Added light block-like offroad marker blocks --- .../automobility/AutomobilityClient.java | 17 +++ .../block/AutomobilityBlocks.java | 17 ++- .../block/LayeredOffroadBlock.java | 4 +- .../automobility/block/OffroadAreaBlock.java | 107 ++++++++++++++++++ .../automobility/block/OffroadBlock.java | 5 +- .../automobility/entity/AutomobileEntity.java | 2 +- .../automobility/item/CreativeTabQueue.java | 11 ++ .../automobility/blockstates/allow.json | 7 -- .../blockstates/off_road_area.json | 28 +++++ .../assets/automobility/lang/en_us.json | 2 + .../models/block/off_road_area_0.json | 5 + .../models/block/off_road_area_1.json | 5 + .../models/block/off_road_area_2.json | 5 + .../models/block/off_road_area_3.json | 5 + .../models/block/off_road_area_4.json | 5 + .../models/block/off_road_area_5.json | 5 + .../models/block/off_road_area_6.json | 5 + .../models/block/off_road_area_7.json | 5 + .../models/item/off_road_area.json | 16 +++ .../models/item/off_road_area_0.json | 6 + .../models/item/off_road_area_1.json | 6 + .../models/item/off_road_area_2.json | 6 + .../models/item/off_road_area_3.json | 6 + .../models/item/off_road_area_4.json | 6 + .../models/item/off_road_area_5.json | 6 + .../models/item/off_road_area_6.json | 6 + .../models/item/off_road_area_7.json | 6 + .../textures/item/off_road_area.png | Bin 0 -> 471 bytes .../textures/item/off_road_area_0.png | Bin 0 -> 485 bytes .../textures/item/off_road_area_1.png | Bin 0 -> 488 bytes .../textures/item/off_road_area_2.png | Bin 0 -> 486 bytes .../textures/item/off_road_area_3.png | Bin 0 -> 488 bytes .../textures/item/off_road_area_4.png | Bin 0 -> 488 bytes .../textures/item/off_road_area_5.png | Bin 0 -> 488 bytes .../textures/item/off_road_area_6.png | Bin 0 -> 485 bytes .../textures/item/off_road_area_7.png | Bin 0 -> 487 bytes .../main/resources/automobility.accesswidener | 2 + .../main/resources/automobility.mixins.json | 2 +- .../fabric/AutomobilityClientFabric.java | 14 +++ .../neoforge/AutomobilityClientNeoForge.java | 18 +++ .../resources/META-INF/accesstransformer.cfg | 1 + 41 files changed, 327 insertions(+), 14 deletions(-) create mode 100644 common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java delete mode 100644 common/src/main/resources/assets/automobility/blockstates/allow.json create mode 100644 common/src/main/resources/assets/automobility/blockstates/off_road_area.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_0.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_1.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_2.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_3.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_4.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_5.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_6.json create mode 100644 common/src/main/resources/assets/automobility/models/block/off_road_area_7.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_0.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_1.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_2.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_3.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_4.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_5.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_6.json create mode 100644 common/src/main/resources/assets/automobility/models/item/off_road_area_7.json create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_0.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_1.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_2.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_3.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_4.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_5.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_6.png create mode 100644 common/src/main/resources/assets/automobility/textures/item/off_road_area_7.png diff --git a/common/src/main/java/io/github/foundationgames/automobility/AutomobilityClient.java b/common/src/main/java/io/github/foundationgames/automobility/AutomobilityClient.java index 22c19f2c..f01c86c7 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/AutomobilityClient.java +++ b/common/src/main/java/io/github/foundationgames/automobility/AutomobilityClient.java @@ -28,15 +28,23 @@ import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.model.Model; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.client.renderer.entity.NoopRenderer; +import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.BlockItemStateProperties; import net.minecraft.world.level.GrassColor; +import net.minecraft.world.level.block.LightBlock; import java.io.IOException; +import java.util.HashSet; +import java.util.Set; import java.util.function.Function; public class AutomobilityClient { @@ -68,6 +76,15 @@ public static void init() { ) ) ); + + ClientLevel.MARKER_PARTICLE_ITEMS = new HashSet<>(ClientLevel.MARKER_PARTICLE_ITEMS); + ClientLevel.MARKER_PARTICLE_ITEMS.add(AutomobilityBlocks.OFF_ROAD_AREA.require().asItem()); + + //ItemProperties.register(Items.LIGHT, ResourceLocation.withDefaultNamespace("level"), (p_329788_, p_329789_, p_329790_, p_329791_) -> { + // BlockItemStateProperties blockitemstateproperties = p_329788_.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY); + // Integer integer = blockitemstateproperties.get(LightBlock.LEVEL); + // return integer != null ? (float)integer.intValue() / 16.0F : 1.0F; + //}); } public static void initBlocks() { diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java b/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java index 391bfd66..9a3035a9 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/AutomobilityBlocks.java @@ -18,11 +18,17 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LightBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.material.MapColor; import java.util.function.Function; import java.util.function.Supplier; @@ -49,9 +55,8 @@ public enum AutomobilityBlocks {; public static final Eventual DIRT_OFF_ROAD = register("dirt_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).noCollission(), AUtils.colorFromInt(0x594227)), Automobility.TAB); public static final Eventual SAND_OFF_ROAD = register("sand_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).noCollission(), AUtils.colorFromInt(0xC2B185)), Automobility.TAB); public static final Eventual SNOW_OFF_ROAD = register("snow_off_road", () -> new LayeredOffroadBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.SNOW_BLOCK).noCollission(), AUtils.colorFromInt(0xD0E7ED)), Automobility.TAB); - public static final Eventual LAUNCH_GEL = register("launch_gel", () -> new LaunchGelBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.CLAY).strength(0.1f).sound(SoundType.HONEY_BLOCK).noCollission()), Automobility.TAB); - + public static final Eventual OFF_ROAD_AREA = register("off_road_area", () -> new OffroadAreaBlock(BlockBehaviour.Properties.of().replaceable().strength(-1.0F, 3600000.8F).mapColor(waterloggedMapColor(MapColor.NONE)).noLootTable().noOcclusion()), (CreativeTabQueue) null); public static final Eventual ALLOW = register("allow", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.BEDROCK).sound(SoundType.METAL)), b -> new TooltipBlockItem(b, Component.translatable("tooltip.block.automobility.allow").withStyle(ChatFormatting.AQUA), new Item.Properties())); @@ -61,6 +66,10 @@ public enum AutomobilityBlocks {; Automobility.rl("autopilot_sign"), () -> Platform.get().blockEntity(AutopilotSignBlockEntity::new, AUTOPILOT_SIGN.require())); public static void init() { + for (int i = 1; i < 9; i++) { + int finalI = i; + Automobility.TAB.queueStack(() -> OffroadAreaBlock.setStrengthOnStack(new ItemStack(OFF_ROAD_AREA.require().asItem()), finalI)); + } } public static Eventual register(String name, Supplier block) { @@ -85,4 +94,8 @@ public static Eventual register(String name, Supplier block, Funct public static Eventual register(String name, Supplier block, Function item) { return register(name, block, item, null); } + + private static Function waterloggedMapColor(MapColor unwaterloggedMapColor) { + return (blockState) -> (Boolean)blockState.getValue(BlockStateProperties.WATERLOGGED) ? MapColor.WATER : unwaterloggedMapColor; + } } diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java index 04487460..935a6ae5 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -84,12 +85,11 @@ protected void createBlockStateDefinition(StateDefinition.Builder CODEC = Block.simpleCodec(OffroadAreaBlock::new); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final IntegerProperty STRENGTH = IntegerProperty.create("strength", 1, MAX_STRENGTH); + public MapCodec codec() { + return CODEC; + } + + public OffroadAreaBlock(BlockBehaviour.Properties properties) { + super(properties); + this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false).setValue(STRENGTH, 1)); + } + + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(WATERLOGGED); + builder.add(STRENGTH); + } + + protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { + if (!level.isClientSide && player.canUseGameMasterBlocks()) { + return InteractionResult.SUCCESS; + } else { + return InteractionResult.CONSUME; + } + } + + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return context.isHoldingItem(asItem()) ? Shapes.block() : Shapes.empty(); + } + + protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + return state.getFluidState().isEmpty(); + } + + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.INVISIBLE; + } + + protected float getShadeBrightness(BlockState state, BlockGetter level, BlockPos pos) { + return 1.0F; + } + + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + } + + return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + } + + protected FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state) { + return setStrengthOnStack(super.getCloneItemStack(level, pos, state), (Integer)state.getValue(STRENGTH)); + } + + public static ItemStack setStrengthOnStack(ItemStack stack, int strength) { + stack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(STRENGTH, strength)); + return stack; + } + + @Override + public float getSpeedMultiplier(BlockState blockState) { + int strength = blockState.getValue(OffroadAreaBlock.STRENGTH); + return 1.0f / (strength + 0.5f); + } + + @Override + public Vector3f getDebrisColor(BlockState blockState, BlockPos position, BlockGetter level) { + return AUtils.colorFromInt(level.getBlockState(position.below()).getMapColor(level, position).col); + } +} \ No newline at end of file diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java index f71b95b8..c9a5b815 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java @@ -1,9 +1,12 @@ package io.github.foundationgames.automobility.block; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import org.joml.Vector3f; public interface OffroadBlock { float getSpeedMultiplier(BlockState blockState); - Vector3f getDebrisColor(BlockState blockState); + Vector3f getDebrisColor(BlockState blockState, BlockPos position, BlockGetter level); } diff --git a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java index 01a1d97f..27e28e60 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java +++ b/common/src/main/java/io/github/foundationgames/automobility/entity/AutomobileEntity.java @@ -971,7 +971,7 @@ public void movementTick() { BlockState blockState = level().getBlockState(blockPosition()); float cap = stats.getComfortableSpeed() * block.getSpeedMultiplier(blockState); this.updateEngineSpeed(Math.min(cap, engineSpeed)); - this.debrisColor = block.getDebrisColor(blockState); + this.debrisColor = block.getDebrisColor(blockState, blockPosition(), level()); this.offRoad = true; } else this.offRoad = false; diff --git a/common/src/main/java/io/github/foundationgames/automobility/item/CreativeTabQueue.java b/common/src/main/java/io/github/foundationgames/automobility/item/CreativeTabQueue.java index 20e9ae7f..861627bb 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/item/CreativeTabQueue.java +++ b/common/src/main/java/io/github/foundationgames/automobility/item/CreativeTabQueue.java @@ -4,13 +4,16 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import java.util.ArrayList; import java.util.List; +import java.util.function.Supplier; public class CreativeTabQueue implements CreativeModeTab.DisplayItemsGenerator { public final ResourceLocation location; private final List> items = new ArrayList<>(); + private final List> itemStacks = new ArrayList<>(); public CreativeTabQueue(ResourceLocation location) { this.location = location; @@ -20,6 +23,10 @@ public void queue(Eventual item) { this.items.add(item); } + public void queueStack(Supplier itemStack) { + this.itemStacks.add(itemStack); + } + @Override public void accept(CreativeModeTab.ItemDisplayParameters params, CreativeModeTab.Output output) { items.forEach(i -> { @@ -29,5 +36,9 @@ public void accept(CreativeModeTab.ItemDisplayParameters params, CreativeModeTab output.accept(i.require()); } }); + + itemStacks.forEach(i -> { + output.accept(i.get()); + }); } } diff --git a/common/src/main/resources/assets/automobility/blockstates/allow.json b/common/src/main/resources/assets/automobility/blockstates/allow.json deleted file mode 100644 index 109a5f4c..00000000 --- a/common/src/main/resources/assets/automobility/blockstates/allow.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "automobility:block/allow" - } - } -} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/blockstates/off_road_area.json b/common/src/main/resources/assets/automobility/blockstates/off_road_area.json new file mode 100644 index 00000000..e26261d3 --- /dev/null +++ b/common/src/main/resources/assets/automobility/blockstates/off_road_area.json @@ -0,0 +1,28 @@ +{ + "variants": { + "strength=1": { + "model": "automobility:block/off_road_area_0" + }, + "strength=2": { + "model": "automobility:block/off_road_area_1" + }, + "strength=3": { + "model": "automobility:block/off_road_area_2" + }, + "strength=4": { + "model": "automobility:block/off_road_area_3" + }, + "strength=5": { + "model": "automobility:block/off_road_area_4" + }, + "strength=6": { + "model": "automobility:block/off_road_area_5" + }, + "strength=7": { + "model": "automobility:block/off_road_area_6" + }, + "strength=8": { + "model": "automobility:block/off_road_area_7" + } + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/lang/en_us.json b/common/src/main/resources/assets/automobility/lang/en_us.json index 298699a2..8c3deb9a 100644 --- a/common/src/main/resources/assets/automobility/lang/en_us.json +++ b/common/src/main/resources/assets/automobility/lang/en_us.json @@ -36,6 +36,8 @@ "block.automobility.dirt_off_road": "Dirt Off Road", "block.automobility.sand_off_road": "Sand Off Road", "block.automobility.snow_off_road": "Snow Off Road", + "block.automobility.off_road_area": "Off Road Area", + "block.automobility.launch_gel": "Launch Gel", "block.automobility.dash_panel": "Dash Panel", "block.automobility.sloped_dash_panel": "Sloped Dash Panel", diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_0.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_0.json new file mode 100644 index 00000000..cc6b73fa --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_0.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_0" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_1.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_1.json new file mode 100644 index 00000000..45301794 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_1.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_1" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_2.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_2.json new file mode 100644 index 00000000..0070ad35 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_2.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_2" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_3.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_3.json new file mode 100644 index 00000000..e08d92c2 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_3.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_3" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_4.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_4.json new file mode 100644 index 00000000..1f1c1918 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_4.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_4" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_5.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_5.json new file mode 100644 index 00000000..89d3ebeb --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_5.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_5" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_6.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_6.json new file mode 100644 index 00000000..b32c2a8b --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_6.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_6" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/block/off_road_area_7.json b/common/src/main/resources/assets/automobility/models/block/off_road_area_7.json new file mode 100644 index 00000000..092db330 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/block/off_road_area_7.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "automobility:item/off_road_area_7" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area.json b/common/src/main/resources/assets/automobility/models/item/off_road_area.json new file mode 100644 index 00000000..55951068 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area.json @@ -0,0 +1,16 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area" + }, + "overrides": [ + { "predicate": { "automobility:strength": 0.125 }, "model": "automobility:item/off_road_area_0" }, + { "predicate": { "automobility:strength": 0.25 }, "model": "automobility:item/off_road_area_1" }, + { "predicate": { "automobility:strength": 0.375 }, "model": "automobility:item/off_road_area_2" }, + { "predicate": { "automobility:strength": 0.5 }, "model": "automobility:item/off_road_area_3" }, + { "predicate": { "automobility:strength": 0.625 }, "model": "automobility:item/off_road_area_4" }, + { "predicate": { "automobility:strength": 0.75 }, "model": "automobility:item/off_road_area_5" }, + { "predicate": { "automobility:strength": 0.875 }, "model": "automobility:item/off_road_area_6" }, + { "predicate": { "automobility:strength": 1.0 }, "model": "automobility:item/off_road_area_7" } + ] +} diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_0.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_0.json new file mode 100644 index 00000000..71bf9cd8 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_0.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_0" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_1.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_1.json new file mode 100644 index 00000000..1819c72f --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_1.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_1" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_2.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_2.json new file mode 100644 index 00000000..498129ce --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_2.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_2" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_3.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_3.json new file mode 100644 index 00000000..9dba3c15 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_3.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_3" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_4.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_4.json new file mode 100644 index 00000000..94eb1553 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_4.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_4" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_5.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_5.json new file mode 100644 index 00000000..ac9211c9 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_5.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_5" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_6.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_6.json new file mode 100644 index 00000000..bb1421e4 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_6.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_6" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/models/item/off_road_area_7.json b/common/src/main/resources/assets/automobility/models/item/off_road_area_7.json new file mode 100644 index 00000000..b8fd56d1 --- /dev/null +++ b/common/src/main/resources/assets/automobility/models/item/off_road_area_7.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "automobility:item/off_road_area_7" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area.png new file mode 100644 index 0000000000000000000000000000000000000000..6a81f1e521e2c2c1d9da1634c0968166fff885fc GIT binary patch literal 471 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|^0G|-oc}XG7J`PX!Z2ABH|B)$OK;aqJpCn999M?Mpgz!Aj=DgrJ-z)>opje!QxCnwjm=E*f&u?c4j*ZSUd~J z27ymyj0`V;o`lh8mNEdPCa^QG096_o85=MzfS3xhk#zyYq$xl)2rvQ7Wdf@Vva|rQ zpt=kV3_!Blir>|3oY+B%!#rIaLo|X*&qeb!7;v~;v@W^xe;ThyXFo^H7Iu#Z6|D9Q zmt;i*H!f|6IDK!DgHE$%ro$#S5jVGx?P@v7hT42n{zq=)IUz1HW#xU#NmDJSZ?jwY am|6YLa^_>(SErVPZ1Z&Wb6Mw<&;$UBY;lPI literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_0.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_0.png new file mode 100644 index 0000000000000000000000000000000000000000..70231553b83ec8608368c5e829857e407121a54a GIT binary patch literal 485 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JI2$+F+?Lc_1s0i1_d7Hi#%FLartDO51^E+pqPc-nBbJ!#`#m()4@V1FBx`eOp)}F@rv-PCW m)h^yu(a&3_{`;kFzk_k#2iAhQo8Lx*?DTZ?b6Mw<&;$UVfq>os literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_1.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_1.png new file mode 100644 index 0000000000000000000000000000000000000000..7a49efb0258ad02a1e1e6b8c81c550dd3d12843f GIT binary patch literal 488 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JKod9F+?Lc^_(Lgvm%f4#V^(t-}e`aN-PS@zVV?z zKu~agmFlXx2PO`?E_^?A#%7cBlc;YKS7;SUo|(ozVGZNbiGn_d&4i2}xzx@RJl#;U p@W!&bM-5fqcWo%%Z};H||GrgDtkF4J-v0$z>*?y}vd$@?2>_Xgf$;zU literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_2.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_2.png new file mode 100644 index 0000000000000000000000000000000000000000..cc12cad56ee441677c2a468f60d0715181ae8869 GIT binary patch literal 486 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JJ!?1F+?Lc^_-(ng94B9#b3dfe&4^rC=$pleQ$}Z zl2YF-p-}l5yc52)85u9{VY@lYR&`ZZ4x8~4CY9{QOD8zO4x0&OAL;y6-5bI7M7k^S lmA2Z7`*nE|mHYmkNS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JKod9F+?Lc^_(N$5d|LSiyvg?{Jy_~Ys;CC(i=}W zm6hCjetFj@N;&LWsO6?NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JKod9F+?Lc^;|UH5d#kAz$)J}|H^Hew#=OVuwA)B zNU-p#d)=`%#R+*Ux>iq_xii)5#MU>ufuT=~W=xcxu!h-7S=mB*+e8a>zbl_DH}ag| p7fF7lZnk3g>&BD6U*G@PEWXN#HG27e0Z{lbc)I$ztaD0e0sxDFe{lc+ literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_5.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_5.png new file mode 100644 index 0000000000000000000000000000000000000000..74dceccd75ad40693635223492b5304aa50f1ea0 GIT binary patch literal 488 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JKod9F+?Lc^_(Lgvm%f4#WUpv@9H0G8MuUI-*|G; z(Z$8)>(u!h6NNo4cPyVWvogi}#MU>;fuT=~X6WiGL^69RE6-@lRY^PASv61ebVJR; o8_Vh*HT?Rvb3^fdyARL!?dHp{`bnRjAO^D5)78&qol`;+0Cr!0hX4Qo literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_6.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_6.png new file mode 100644 index 0000000000000000000000000000000000000000..ece1c12fc22099e66ffd23eca58b2c25b0d299f5 GIT binary patch literal 485 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JI2$+F+?Lc^_(N$5d#kAz+b*|e&4TP$qc+|m{ZZD zAt-pgPW9VAr}GMX9cRvTmpZZajdI}cojl8)vZ-V{WTvoePL%GnEL=3}`4J-p`wf}F lwuKH?L-|Xdy`KN)ApaqA*77M9>IEP>Jzf1=);T3K0RY2{e1rf1 literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_7.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_7.png new file mode 100644 index 0000000000000000000000000000000000000000..43242488761233dc2b1274024336b2d6bfcba64f GIT binary patch literal 487 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|-ocl+Fe0{rGBg*5v(Jl(V9|Ns9-rgQ-%FY_ur22va)L4LtNK@ecL z*St3pD8^af5n0T@z;_UY8Fx&~ehV_J#5JNMI6tkVJh3R1As{g`uSCz!HAKNw&rr`Y zC-0UWP|dc~2+uT6Pb~%xAcvJfijkFp5yZ(X0SLDkZs7w1ol-Fke%7i z0v68#vO(Zx86(3Bpl4w;nxzatsR`^1EI^e8M#ct=3m~R~Y-C*kF=+~r4FXI+bD6*@ zgDfq8ET}F+0|T(EQO7+Ihbl85JI>R^F+?Lc_1s0i1_d7HiYcp_=bheMv* z1q2JvhAXYp4`E(X?mTm5^eV@`#QaW6bxWRQPZ(8JJ7%V^+}+UY(rU&43gPnoq n<*1F0uh$hXDB5@L!xMJ%NnxyxGLJtj2HEQA>gTe~DWM4fERcVA literal 0 HcmV?d00001 diff --git a/common/src/main/resources/automobility.accesswidener b/common/src/main/resources/automobility.accesswidener index f985db3f..5a1a6b9b 100644 --- a/common/src/main/resources/automobility.accesswidener +++ b/common/src/main/resources/automobility.accesswidener @@ -5,3 +5,5 @@ accessible method net/minecraft/world/entity/Entity collectColliders (Lnet/minec accessible method net/minecraft/world/entity/Entity collectCandidateStepUpHeights (Lnet/minecraft/world/phys/AABB;Ljava/util/List;FF)[F accessible method net/minecraft/world/entity/Entity collideWithShapes (Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/AABB;Ljava/util/List;)Lnet/minecraft/world/phys/Vec3; accessible field net/minecraft/world/entity/Entity passengers Lcom/google/common/collect/ImmutableList; +accessible field net/minecraft/client/multiplayer/ClientLevel MARKER_PARTICLE_ITEMS Ljava/util/Set; +mutable field net/minecraft/client/multiplayer/ClientLevel MARKER_PARTICLE_ITEMS Ljava/util/Set; \ No newline at end of file diff --git a/common/src/main/resources/automobility.mixins.json b/common/src/main/resources/automobility.mixins.json index 7da5d389..180e35ae 100644 --- a/common/src/main/resources/automobility.mixins.json +++ b/common/src/main/resources/automobility.mixins.json @@ -14,9 +14,9 @@ "ShovelItemAccess" ], "client": [ + "EntityMixin", "EntityRenderDispatcherMixin", "EntityRenderersMixin", - "EntityMixin", "KeyMappingAccess", "LocalPlayerMixin", "MultiPlayerGameModeMixin", diff --git a/fabric/src/main/java/io/github/foundationgames/automobility/fabric/AutomobilityClientFabric.java b/fabric/src/main/java/io/github/foundationgames/automobility/fabric/AutomobilityClientFabric.java index 054ed1bd..219e5370 100644 --- a/fabric/src/main/java/io/github/foundationgames/automobility/fabric/AutomobilityClientFabric.java +++ b/fabric/src/main/java/io/github/foundationgames/automobility/fabric/AutomobilityClientFabric.java @@ -1,7 +1,9 @@ package io.github.foundationgames.automobility.fabric; +import io.github.foundationgames.automobility.Automobility; import io.github.foundationgames.automobility.AutomobilityClient; import io.github.foundationgames.automobility.block.AutomobilityBlocks; +import io.github.foundationgames.automobility.block.OffroadAreaBlock; import io.github.foundationgames.automobility.block.model.SlopeBakedModel; import io.github.foundationgames.automobility.block.model.SlopeUnbakedModel; import io.github.foundationgames.automobility.entity.AutomobileEntity; @@ -31,11 +33,16 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.PackType; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.component.BlockItemStateProperties; public class AutomobilityClientFabric implements ClientModInitializer { private static boolean wasRidingAutomobile = false; @@ -99,5 +106,12 @@ public > void ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(FabricAutomobileModels.INSTANCE); ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(FabricObjLoader.INSTANCE); + + ItemProperties.register(AutomobilityBlocks.OFF_ROAD_AREA.require().asItem(), + ResourceLocation.fromNamespaceAndPath(Automobility.MOD_ID, "strength"), (stack, level, living, id) -> { + BlockItemStateProperties blockitemstateproperties = stack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY); + Integer integer = blockitemstateproperties.get(OffroadAreaBlock.STRENGTH); + return integer != null ? (float)integer/OffroadAreaBlock.MAX_STRENGTH : 1; + }); } } diff --git a/neoforge/src/main/java/io/github/foundationgames/automobility/neoforge/AutomobilityClientNeoForge.java b/neoforge/src/main/java/io/github/foundationgames/automobility/neoforge/AutomobilityClientNeoForge.java index 650c5048..b91d0ec3 100644 --- a/neoforge/src/main/java/io/github/foundationgames/automobility/neoforge/AutomobilityClientNeoForge.java +++ b/neoforge/src/main/java/io/github/foundationgames/automobility/neoforge/AutomobilityClientNeoForge.java @@ -1,9 +1,11 @@ package io.github.foundationgames.automobility.neoforge; +import io.github.foundationgames.automobility.Automobility; import io.github.foundationgames.automobility.AutomobilityClient; import io.github.foundationgames.automobility.automobile.render.AutomobileModels; import io.github.foundationgames.automobility.automobile.render.obj.ObjLoader; import io.github.foundationgames.automobility.block.AutomobilityBlocks; +import io.github.foundationgames.automobility.block.OffroadAreaBlock; import io.github.foundationgames.automobility.block.model.SlopeBakedModel; import io.github.foundationgames.automobility.entity.AutomobileEntity; import io.github.foundationgames.automobility.neoforge.block.render.NeoForgeSlopeBakedModel; @@ -19,10 +21,15 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.component.BlockItemStateProperties; +import net.minecraft.world.level.block.LightBlock; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; @@ -60,6 +67,17 @@ public static void initClient(FMLClientSetupEvent setup) { evt.setFOV(AutomobilityClient.modifyBoostFov(Minecraft.getInstance(), evt.getFOV(), (float) evt.getPartialTick()))); } + @SubscribeEvent + public static void registerItemProperties(FMLClientSetupEvent evt) { + evt.enqueueWork(() -> + ItemProperties.register(AutomobilityBlocks.OFF_ROAD_AREA.require().asItem(), + ResourceLocation.fromNamespaceAndPath(Automobility.MOD_ID, "strength"), (stack, level, living, id) -> { + BlockItemStateProperties blockitemstateproperties = stack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY); + Integer integer = blockitemstateproperties.get(OffroadAreaBlock.STRENGTH); + return integer != null ? (float)integer/OffroadAreaBlock.MAX_STRENGTH : 1; + })); + } + @SubscribeEvent public static void registerParticleProviders(RegisterParticleProvidersEvent evt) { evt.registerSpriteSet(AutomobilityParticles.DRIFT_SMOKE.require(), DriftSmokeParticle.Factory::new); diff --git a/neoforge/src/main/resources/META-INF/accesstransformer.cfg b/neoforge/src/main/resources/META-INF/accesstransformer.cfg index d0917316..c2f75685 100644 --- a/neoforge/src/main/resources/META-INF/accesstransformer.cfg +++ b/neoforge/src/main/resources/META-INF/accesstransformer.cfg @@ -3,3 +3,4 @@ public net.minecraft.world.entity.Entity collectColliders(Lnet/minecraft/world/e public net.minecraft.world.entity.Entity collectCandidateStepUpHeights(Lnet/minecraft/world/phys/AABB;Ljava/util/List;FF)[F public net.minecraft.world.entity.Entity collideWithShapes(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/AABB;Ljava/util/List;)Lnet/minecraft/world/phys/Vec3; public net.minecraft.world.entity.Entity passengers +public-f net.minecraft.client.multiplayer.ClientLevel MARKER_PARTICLE_ITEMS \ No newline at end of file From 844510a639db63c8fec50a0d0ef34b3dce672d5e Mon Sep 17 00:00:00 2001 From: Toastworth Date: Wed, 13 Aug 2025 23:42:56 +0200 Subject: [PATCH 16/19] Version bump to 0.5.1 --- fabric/src/main/resources/fabric.mod.json | 2 +- gradle.properties | 2 +- neoforge/src/main/resources/META-INF/neoforge.mods.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 86113d98..6d80894c 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Automobility", "description": "Vehicles and whatnot", "authors": [ - "FoundationGames" + "FoundationGames", "Toastworth" ], "contact": { "homepage": "", diff --git a/gradle.properties b/gradle.properties index 1c30bf67..a452791e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,6 @@ fabric_api_version=0.115.1+1.21.1 jsonem_version=0.3+1.21 controlify_version=2.0.1+1.21 -mod_version = 0.5.0.h +mod_version = 0.5.1 maven_group = io.github.foundationgames archives_base_name = automobility diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 9f5cd011..007779b5 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -7,7 +7,7 @@ modId="automobility" version="${version}" displayName="Automobility" logoFile="automobility.png" -authors="FoundationGames" #optional +authors="FoundationGames, Toastworth" #optional description=''' Vehicles and whatnot ''' From 16e37a28f2ab99e346cbb2d02a5137e90eaee2a1 Mon Sep 17 00:00:00 2001 From: Toastworth Date: Thu, 14 Aug 2025 12:04:40 +0200 Subject: [PATCH 17/19] Improved off-road area textures --- .../automobility/block/LayeredOffroadBlock.java | 2 -- .../automobility/block/OffroadAreaBlock.java | 2 +- .../automobility/block/OffroadBlock.java | 1 - .../textures/item/off_road_area.png | Bin 471 -> 453 bytes .../textures/item/off_road_area_0.png | Bin 485 -> 450 bytes .../textures/item/off_road_area_1.png | Bin 488 -> 448 bytes .../textures/item/off_road_area_2.png | Bin 486 -> 452 bytes .../textures/item/off_road_area_3.png | Bin 488 -> 447 bytes .../textures/item/off_road_area_4.png | Bin 488 -> 454 bytes .../textures/item/off_road_area_5.png | Bin 488 -> 454 bytes .../textures/item/off_road_area_6.png | Bin 485 -> 455 bytes .../textures/item/off_road_area_7.png | Bin 487 -> 453 bytes 12 files changed, 1 insertion(+), 4 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java index 935a6ae5..9c012347 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java @@ -5,10 +5,8 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.IntegerProperty; diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java index 367c3fdb..b2adb543 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java @@ -41,7 +41,7 @@ public MapCodec codec() { public OffroadAreaBlock(BlockBehaviour.Properties properties) { super(properties); - this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false).setValue(STRENGTH, 1)); + this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false).setValue(STRENGTH, 2)); } protected void createBlockStateDefinition(StateDefinition.Builder builder) { diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java index c9a5b815..95ecd154 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadBlock.java @@ -2,7 +2,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import org.joml.Vector3f; diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area.png index 6a81f1e521e2c2c1d9da1634c0968166fff885fc..b963ce7bab8d6b15fa70226201c1afadd515d7db 100644 GIT binary patch delta 191 zcmcc4e3W^DqZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS1YyP<6SLn=Y%b%xS;ollf|-Hg=42+u_#7sqj(Z{wRc1itKAtX)AsWHG{RjCN z6gZp$|NWmY?X~rlP&E6zR+hLXzlhWmnaWD67lf~=a87&w+u(zCVe{0V{4pubYStkv oE1oj>8!j_WFEyI}=e9HR_YTI}Uegu+1I=adboFyt=akR{00yGGho^hC{Qv*|$doPy28J2epCzL{DFotc)I$ztaD0e0svCN3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1@8Fkzfai}r_ zs*dq=aSYK2PCa*#uR(#w`C_H@ssH~sO1^N~^5M|QT>{4ID%BowS2HaUo-%W%>MG~H z#Qe@#=MxRQuL(AiQnji!R}-yS1k={%k#IbhV3jRrK@LssDbd+wWl9_kp!w U?&i1AKzkTGUHx3vIVCg!0I@1ywg3PC diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_1.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_1.png index 7a49efb0258ad02a1e1e6b8c81c550dd3d12843f..f9f2edf2a8554cf15db14f98693f1e20069c8a67 100644 GIT binary patch delta 186 zcmaFCe1Lg^qZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS0Aa?gYn_}EyURHDmoYNDU}j+0Kbea$K7F;i^P=qgPji9F-923#Lo|YW`vbWc z6gZsC%l})q?__zs-0{#o5wQ}^pBcHzvff5Q3xwXPu-ts!()f6fT!RF|0hX=bxMzj* jFQ4&fm7eSA{jyQ=7ntgTe~DWM4fz&J%F delta 225 zcmX@W{DOIcqnAX0Pl)TgeQrSke)Ez-ntdFe?%DGH|NkRXx)>N3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1`8Fkzfai}r_ zs*d+`aSYK2PCe(y$E?WXeDRC5#rOS%q7sV&vu}JT5D*lcU!}UL?tzKJt_$B!ow3;@ z{Uqw!#1&dal4qu|PgujabfTcoVKX7)M=rJV1Wz~AEWEL-?omV4_gx!`_uGAV!oP2o X6KizNmiK>wRxxbP0l+XkKHatXD delta 223 zcmX@Y{ET^mqnAX0Pl)TgeQrSke)Ez-ntdFe?%DGH|NkRXx)>N3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1_8Fkzfai}r_ zs*d$^aSYK2PCe%+)S$rQeDPQCrQi2&Fp2~+OW#`}tEAL-ODI%+2JeJ#ZAQk+d)RKy zvQ=HxmBVKIgh?g4@zM#7u)}6T*+)8mRrf})J(2E8e5I|n;(lG8MCHDJ=lK0r#jr-- Tc*?f{Xc2>_tDnm{r-UW|$y;0= diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_3.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_3.png index 63a778275dfa8b70e046cfb9c36e84773c6f7cf8..a7a47f890d6728043e3a4adf2d9e93371589cbb3 100644 GIT binary patch delta 185 zcmaFCyq|f3qZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS0Aa?gYn_}EyURHDmoYNDU}j+0Kbea$K5ezS^P=qgPji9F-8@|!Lo|Yy_6Kqu zFyL`Az4!mz;VXGdey_RE;4h?8!co_A%j5PW9p*JIbEhn*@Mlr^_Ko3)?TN3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1`8Fkzfai}r_ zs*d+`aSYK2PCe(ycSM25`QiuJIlu4k;M#H~r1ZuUPGu#xo?qTIic$`{7HYX^8W*2t zD)OuL4iUBFO*_f!agA~5M8P@I+a_9ws=xXhqQm@&`KZxXVd*Q&pEpjufBpW?1FS3O Wvc|63r^*ksiow&>&t;ucLK6U<16>#Z diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_4.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_4.png index dc1239e7823b747376cc7efe0be4c4847b8eb2f5..559d78e6410f373c1dcf8c7e5d3c19c4ba54836a 100644 GIT binary patch delta 192 zcmaFCe2jU5qZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS0Aa?gYn_}EyURHDmoYNDU}j+0Kbea$K6kac^P=qgPji9FeLYzopr02NO~U;qFB delta 225 zcmX@c{DOIcqnAX0Pl)TgeQrSke)Ez-ntdFe?%DGH|NkRXx)>N3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1`8Fkzfai}r_ zs*d+`aSYK2PCXaRcf^3hIk3w2%)fG*rY$q4KWta-5E3lB>RxxOO>sirimugDX6{Ti zJF)eRZeZvWqZt#WC#+%iQdYK*-Zs%f-S5h0%Z)rI_(hUmshh3X{krkw@7MQ#HjA%v WVvSzDUw{K>6@#a%pUXO@geCw)Q(sd6 diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_5.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_5.png index 74dceccd75ad40693635223492b5304aa50f1ea0..d40fb194e5fa3ab15987a19af2c4e6fed5359149 100644 GIT binary patch delta 192 zcmaFCe2jU5qZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS0Aa?gYn_}EyURHDmoYNDU}j+0Kbea$K6kac^P=qgPji9FeLYfEn+p3t~gD9aCk+piOxx*1G86577}?c&Dd#M%kW74OgOv8#M~t( qqq3MvT$}w3uZG61TKVVO1!j(kj9+EtYqEd_GkCiCxvXN3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1`8Fkzfai}r_ zs*d+`aSYK2PCe(y$E?WXeDO?q!Mpm$S_Uqm**Bh?baZjC`8sv}#zbL{%N@(7%&bf? zKe6?Va$x8aqZzvT3X#lS%E~j^a#hlfc2><3J>5{V@W!&bM-9Ke?c7kj-|oXRe!KZH WtbWp`Cx`*9V(@hJb6Mw<&;$T4F<)r_ diff --git a/common/src/main/resources/assets/automobility/textures/item/off_road_area_6.png b/common/src/main/resources/assets/automobility/textures/item/off_road_area_6.png index ece1c12fc22099e66ffd23eca58b2c25b0d299f5..22fed4c56fc1fa2ad77b13ac60927d999ebf718c 100644 GIT binary patch delta 193 zcmaFLe4KfLqZLnpPl)T+{S5!FGQ8f-00e)M@)rUrmXaX9;Q#;sGdO6i`~u{27I;J! zGcfQS0Aa?gYn_}EyURHDmoYNDU}j+0Kbea$K5wN3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1@8Fkzfai}r_ zs*dq=aSYK2PCe(ycf^3hIq;Y7oZt5=STX~z8s=0qX$T5luT%Z@&*{9vUdNd;-K9=! zeWM)sdneDbr)(FVdQ&MBb@08F4qo&W#< delta 224 zcmX@g{G54$qnAX0Pl)TgeQrSke)Ez-ntdFe?%DGH|NkRXx)>N3F7qlq22va)L4LtN zK@ecL*St3pD8^af5n0T@z;_UY8Fx&~emk+cjPqt0Bf|@328Npxf5q1^8Fkzfai}r_ zs*dw?aSYK2PCa*#uR(#w`C_H@ssH~sCZ0&z^5Kx@b^*b{v*AkX^h21JlsnIy8NJG} zFEPKR@M}c{ysM Date: Thu, 14 Aug 2025 23:51:31 +0200 Subject: [PATCH 18/19] Improved off-road area strength scaling --- .../foundationgames/automobility/block/LayeredOffroadBlock.java | 2 +- .../foundationgames/automobility/block/OffroadAreaBlock.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java index 9c012347..03d4156b 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/LayeredOffroadBlock.java @@ -83,7 +83,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder Date: Thu, 14 Aug 2025 23:56:03 +0200 Subject: [PATCH 19/19] Changed off road area default strength to 4 --- .../foundationgames/automobility/block/OffroadAreaBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java index 36371873..8bedc351 100644 --- a/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java +++ b/common/src/main/java/io/github/foundationgames/automobility/block/OffroadAreaBlock.java @@ -41,7 +41,7 @@ public MapCodec codec() { public OffroadAreaBlock(BlockBehaviour.Properties properties) { super(properties); - this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false).setValue(STRENGTH, 2)); + this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, false).setValue(STRENGTH, 4)); } protected void createBlockStateDefinition(StateDefinition.Builder builder) {