diff --git a/gradle.properties b/gradle.properties index 8981a51..278613a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G # minecraft, mappings and loader dependencies # check these on https://modmuss50.me/fabric.html -minecraft_version=1.19.4 -quilt_mappings=10 -loader_version=0.14.14 +minecraft_version=1.20-rc1 +quilt_mappings=1 +loader_version=0.14.20 # mod properties -mod_version=1.1.0+mc1.19.4 +mod_version=1.1.0+mc1.20 maven_group=rainglow archives_base_name=rainglow @@ -16,4 +16,4 @@ archives_base_name=rainglow java_version=17 spruceui_version=4.2.0+1.19.4 mod_menu_version=6.1.0-rc.1 -fabric_api_version=0.76.0+1.19.4 +fabric_api_version=0.83.0+1.20 diff --git a/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java index 5fe6852..f91a84c 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java @@ -46,11 +46,11 @@ public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) { } // triggered when an allay duplicates, to apply the same colour as parent - @Redirect(method = "method_44363", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z")) + @Redirect(method = "duplicate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z")) public boolean spawnWithColour(World instance, Entity entity) { RainglowColour colour = RainglowColour.get(Rainglow.getColour(RainglowEntity.ALLAY, this.getDataTracker(), this.getRandom())); entity.getDataTracker().set(Rainglow.getTrackedColourData(RainglowEntity.ALLAY), colour.getId()); - return this.world.spawnEntity(entity); + return this.getWorld().spawnEntity(entity); } @Override diff --git a/src/main/java/io/ix0rai/rainglow/mixin/DyeItemMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/DyeItemMixin.java index 2c06407..014aecc 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/DyeItemMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/DyeItemMixin.java @@ -28,35 +28,35 @@ private void useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity String colour = getDye(stack); if (entity instanceof GlowSquidEntity glowSquid && glowSquid.isAlive() && !Rainglow.getColour(RainglowEntity.GLOW_SQUID, glowSquid.getDataTracker(), glowSquid.getRandom()).equals(colour)) { - glowSquid.world.playSoundFromEntity(user, glowSquid, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); - if (!user.world.isClient) { + glowSquid.getWorld().playSoundFromEntity(user, glowSquid, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (!user.getWorld().isClient()) { stack.decrement(1); } DataTracker tracker = glowSquid.getDataTracker(); tracker.set(Rainglow.getTrackedColourData(RainglowEntity.GLOW_SQUID), colour); - cir.setReturnValue(ActionResult.success(user.world.isClient)); + cir.setReturnValue(ActionResult.success(user.getWorld().isClient())); } else if (entity instanceof AllayEntity allayEntity && allayEntity.isAlive() && !Rainglow.getColour(RainglowEntity.ALLAY, allayEntity.getDataTracker(), allayEntity.getRandom()).equals(colour)) { - allayEntity.world.playSoundFromEntity(user, allayEntity, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); - if (!user.world.isClient) { + allayEntity.getWorld().playSoundFromEntity(user, allayEntity, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (!user.getWorld().isClient()) { stack.decrement(1); } DataTracker tracker = allayEntity.getDataTracker(); tracker.set(Rainglow.getTrackedColourData(RainglowEntity.ALLAY), colour); - cir.setReturnValue(ActionResult.success(user.world.isClient)); + cir.setReturnValue(ActionResult.success(user.getWorld().isClient())); } else if (entity instanceof SlimeEntity slimeEntity && slimeEntity.isAlive() && !Rainglow.getColour(RainglowEntity.SLIME, slimeEntity.getDataTracker(), slimeEntity.getRandom()).equals(colour)) { - slimeEntity.world.playSoundFromEntity(user, slimeEntity, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); - if (!user.world.isClient) { + slimeEntity.getWorld().playSoundFromEntity(user, slimeEntity, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (!user.getWorld().isClient()) { stack.decrement(1); } DataTracker tracker = slimeEntity.getDataTracker(); tracker.set(Rainglow.getTrackedColourData(RainglowEntity.SLIME), colour); - cir.setReturnValue(ActionResult.success(user.world.isClient)); + cir.setReturnValue(ActionResult.success(user.getWorld().isClient())); } cir.setReturnValue(ActionResult.PASS); diff --git a/src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java index 103c6b4..695e561 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java @@ -61,7 +61,7 @@ public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) { public boolean spawnWithParentColour(World instance, Entity entity) { RainglowColour colour = RainglowColour.get(Rainglow.getColour(RainglowEntity.SLIME, this.getDataTracker(), this.random)); entity.getDataTracker().set(Rainglow.getTrackedColourData(RainglowEntity.SLIME), colour.getId()); - return this.world.spawnEntity(entity); + return this.getWorld().spawnEntity(entity); } /** @@ -84,7 +84,7 @@ public void tick(CallbackInfo ci) { float g = this.random.nextFloat() * 0.5F + 0.5F; float h = MathHelper.sin(f) * (float)size * 0.5F * g; float k = MathHelper.cos(f) * (float)size * 0.5F * g; - this.world.addParticle(this.getParticles(), this.getX() + (double)h, this.getY(), this.getZ() + (double)k, index, 100.0, 0.0); + this.getWorld().addParticle(this.getParticles(), this.getX() + (double)h, this.getY(), this.getZ() + (double)k, index, 100.0, 0.0); } } diff --git a/src/main/resources/rainglow.accesswidener b/src/main/resources/rainglow.accesswidener index e3aa024..686ef2c 100644 --- a/src/main/resources/rainglow.accesswidener +++ b/src/main/resources/rainglow.accesswidener @@ -12,6 +12,3 @@ accessible method net/minecraft/client/particle/SquidInkParticle (Lne accessible field net/minecraft/client/particle/Particle velocityX D accessible field net/minecraft/client/particle/Particle velocityY D accessible field net/minecraft/client/particle/Particle velocityZ D - -accessible field net/minecraft/entity/passive/AllayEntity field_39471 J -