This commit is contained in:
2025-10-01 20:58:38 +02:00
parent 4b3a2add69
commit d45b338b52
3 changed files with 13 additions and 15 deletions

View File

@@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.8 minecraft_version=1.21.9
yarn_mappings=1.21.8+build.1 yarn_mappings=1.21.9+build.1
loader_version=0.17.2 loader_version=0.17.2
# Mod Properties # Mod Properties
mod_version=1.1 mod_version=1.2
maven_group=com.kasetoatz maven_group=com.kasetoatz
archives_base_name=JukeboxBoat archives_base_name=JukeboxBoat
# Dependencies # Dependencies
# check this on https://modmuss50.me/fabric.html # check this on https://modmuss50.me/fabric.html
fabric_version=0.132.0+1.21.8 fabric_version=0.133.14+1.21.9

View File

@@ -18,8 +18,6 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.WorldEvents;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
@@ -159,7 +157,7 @@ public abstract class AbstractBoatEntityMixin implements IAbstractBoatEntity
{ {
jukebox = createJukebox(boat); jukebox = createJukebox(boat);
} }
boat.getServer().getPlayerManager().sendToAll(new PlaySoundFromEntityS2CPacket( boat.getEntityWorld().getServer().getPlayerManager().sendToAll(new PlaySoundFromEntityS2CPacket(
Registries.SOUND_EVENT.getEntry(sound), Registries.SOUND_EVENT.getEntry(sound),
SoundCategory.RECORDS, SoundCategory.RECORDS,
jukebox, jukebox,
@@ -187,7 +185,7 @@ public abstract class AbstractBoatEntityMixin implements IAbstractBoatEntity
{ {
return; return;
} }
if (boat.getWorld() instanceof ServerWorld world) if (boat.getEntityWorld() instanceof ServerWorld world)
{ {
jukebox.teleport(world, boat.getX(), boat.getY(), boat.getZ(), EnumSet.noneOf(PositionFlag.class), boat.getYaw() + 90, boat.getPitch(), false); jukebox.teleport(world, boat.getX(), boat.getY(), boat.getZ(), EnumSet.noneOf(PositionFlag.class), boat.getYaw() + 90, boat.getPitch(), false);
} }

View File

@@ -32,7 +32,7 @@ public class Util
public static SoundEvent getDiscSound(PlayerEntity player, ItemStack disc) public static SoundEvent getDiscSound(PlayerEntity player, ItemStack disc)
{ {
JukeboxPlayableComponent component = disc.get(DataComponentTypes.JUKEBOX_PLAYABLE); JukeboxPlayableComponent component = disc.get(DataComponentTypes.JUKEBOX_PLAYABLE);
Optional<Registry<JukeboxSong>> key = player.getWorld().getRegistryManager().getOptional(RegistryKeys.JUKEBOX_SONG); Optional<Registry<JukeboxSong>> key = player.getEntityWorld().getRegistryManager().getOptional(RegistryKeys.JUKEBOX_SONG);
if (component == null || key.isEmpty()) if (component == null || key.isEmpty())
{ {
return null; return null;
@@ -58,7 +58,7 @@ public class Util
public static DisplayEntity.BlockDisplayEntity createJukebox(BoatEntity boat) public static DisplayEntity.BlockDisplayEntity createJukebox(BoatEntity boat)
{ {
DisplayEntity.BlockDisplayEntity jukebox = new DisplayEntity.BlockDisplayEntity(EntityType.BLOCK_DISPLAY, boat.getWorld()); DisplayEntity.BlockDisplayEntity jukebox = new DisplayEntity.BlockDisplayEntity(EntityType.BLOCK_DISPLAY, boat.getEntityWorld());
jukebox.setBlockState(Blocks.JUKEBOX.getDefaultState()); jukebox.setBlockState(Blocks.JUKEBOX.getDefaultState());
jukebox.setTransformation(new AffineTransformation( jukebox.setTransformation(new AffineTransformation(
new Vector3f(-0.8f, 0.2f, -0.4f), new Vector3f(-0.8f, 0.2f, -0.4f),
@@ -66,7 +66,7 @@ public class Util
new Vector3f(0.8f, 0.8f, 0.8f), new Vector3f(0.8f, 0.8f, 0.8f),
new Quaternionf() new Quaternionf()
)); ));
boat.getWorld().spawnEntity(jukebox); boat.getEntityWorld().spawnEntity(jukebox);
((IBlockDisplayEntity)jukebox).jukeboxBoat$setUUID(jukebox.getUuidAsString()); ((IBlockDisplayEntity)jukebox).jukeboxBoat$setUUID(jukebox.getUuidAsString());
((IAbstractBoatEntity)boat).jukeboxBoat$setJukebox(jukebox.getUuidAsString()); ((IAbstractBoatEntity)boat).jukeboxBoat$setJukebox(jukebox.getUuidAsString());
return jukebox; return jukebox;
@@ -74,14 +74,14 @@ public class Util
public static void spawnPlaceholder(BoatEntity boat) public static void spawnPlaceholder(BoatEntity boat)
{ {
ArmorStandEntity placeholder = new ArmorStandEntity(boat.getWorld(), boat.getX(), boat.getY(), boat.getZ()); ArmorStandEntity placeholder = new ArmorStandEntity(boat.getEntityWorld(), boat.getX(), boat.getY(), boat.getZ());
IArmorStandEntity accessor = (IArmorStandEntity)placeholder; IArmorStandEntity accessor = (IArmorStandEntity)placeholder;
accessor.jukeboxBoat$setPlaceholder(true); accessor.jukeboxBoat$setPlaceholder(true);
accessor.jukeboxBoat$setMarker(true); accessor.jukeboxBoat$setMarker(true);
placeholder.setHideBasePlate(true); placeholder.setHideBasePlate(true);
placeholder.setInvisible(true); placeholder.setInvisible(true);
placeholder.setInvulnerable(true); placeholder.setInvulnerable(true);
boat.getWorld().spawnEntity(placeholder); boat.getEntityWorld().spawnEntity(placeholder);
placeholder.startRiding(boat); placeholder.startRiding(boat);
} }
@@ -108,7 +108,7 @@ public class Util
private static DisplayEntity.BlockDisplayEntity iterateJukeboxes(BoatEntity boat, String uuid) private static DisplayEntity.BlockDisplayEntity iterateJukeboxes(BoatEntity boat, String uuid)
{ {
if (boat.getWorld() instanceof ServerWorld world) if (boat.getEntityWorld() instanceof ServerWorld world)
{ {
for (Entity entity : world.iterateEntities()) for (Entity entity : world.iterateEntities())
{ {
@@ -133,7 +133,7 @@ public class Util
{ {
return null; return null;
} }
Entity possible = boat.getWorld().getEntity(UUID.fromString(uuid)); Entity possible = boat.getEntityWorld().getEntity(UUID.fromString(uuid));
if (possible instanceof DisplayEntity.BlockDisplayEntity jukebox) if (possible instanceof DisplayEntity.BlockDisplayEntity jukebox)
{ {
return jukebox; return jukebox;