Skip to content

Commit

Permalink
update to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Jun 6, 2023
1 parent f195c18 commit 23adbfc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ 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

# other dependencies
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
4 changes: 2 additions & 2 deletions src/main/java/io/ix0rai/rainglow/mixin/AllayEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/io/ix0rai/rainglow/mixin/DyeItemMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/ix0rai/rainglow/mixin/SlimeEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/rainglow.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ accessible method net/minecraft/client/particle/SquidInkParticle <init> (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

0 comments on commit 23adbfc

Please sign in to comment.