Skip to content

Commit

Permalink
initial 1.21 port
Browse files Browse the repository at this point in the history
  • Loading branch information
orifu committed Jun 2, 2024
1 parent 79b3726 commit 3f8acba
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ repositories {
maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://maven.quiltmc.org/repository/release/" }
maven { url = "https://repo.sleeping.town/" }

flatDir { dirs 'lib' }
}

configurations {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# minecraft, mappings and loader dependencies
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.6
quilt_mappings=6
minecraft_version=1.21-pre1
quilt_mappings=1
loader_version=0.15.11

# mod properties
mod_version=1.3.1+mc1.20.6
mod_version=1.3.2+mc1.21
maven_group=rainglow
archives_base_name=rainglow

# other dependencies
java_version=21
mod_menu_version=10.0.0-beta.1
fabric_api_version=0.98.0+1.20.6
mod_menu_version=unknown
fabric_api_version=0.99.4+1.21
2 changes: 1 addition & 1 deletion src/main/java/io/ix0rai/rainglow/Rainglow.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void onInitialize() {
}

public static Identifier id(String id) {
return new Identifier(MOD_ID, id);
return Identifier.method_60655(MOD_ID, id);
}

public static String generateRandomColourId(World world, RandomGenerator random) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ private void save() {
}

@Override
public void init() {
public void method_60325() {
HeaderFooterLayoutWidget headerFooterWidget = new HeaderFooterLayoutWidget(this, 61, 33);
headerFooterWidget.addToHeader(new TextWidget(TITLE, this.textRenderer), settings -> settings.alignHorizontallyCenter().setBottomPadding(28));

if (!this.isConfirming) {
ButtonListWidget buttonListWidget = headerFooterWidget.addToContents(new ButtonListWidget(this.client, this.width, this.height, this));
ButtonListWidget buttonListWidget = headerFooterWidget.addToContents(new ButtonListWidget(this.client, this.width, this));
createColourToggles();
buttonListWidget.addEntries(this.options.toArray(new Option<?>[0]));

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/ix0rai/rainglow/data/RainglowColour.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public Identifier getTexture(RainglowEntity entityType) {
switch (entity) {
case GLOW_SQUID -> {
String textureName = RainglowEntity.GLOW_SQUID.getDefaultColour() == this ? "glow_squid" : this.getId();
this.textures.put(entity, new Identifier("textures/entity/squid/" + textureName + ".png"));
this.textures.put(entity, Identifier.method_60656("textures/entity/squid/" + textureName + ".png"));
}
case ALLAY -> {
String textureName = RainglowEntity.ALLAY.getDefaultColour() == this ? "allay" : this.getId();
this.textures.put(entity, new Identifier("textures/entity/allay/" + textureName + ".png"));
this.textures.put(entity, Identifier.method_60656("textures/entity/allay/" + textureName + ".png"));
}
case SLIME -> {
String textureName = RainglowEntity.SLIME.getDefaultColour() == this ? "slime" : this.getId();
this.textures.put(entity, new Identifier("textures/entity/slime/" + textureName + ".png"));
this.textures.put(entity, Identifier.method_60656("textures/entity/slime/" + textureName + ".png"));
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ protected void initDataTracker(Builder builder, CallbackInfo ci) {

@Inject(method = "writeCustomDataToNbt", at = @At("TAIL"))
public void writeCustomDataToNbt(NbtCompound nbt, CallbackInfo ci) {
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom());
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random);
nbt.putString(Rainglow.CUSTOM_NBT_KEY, colour.getId());
}

@Inject(method = "readCustomDataFromNbt", at = @At("TAIL"))
public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) {
this.setVariant(RainglowEntity.GLOW_SQUID.readNbt(this.getWorld(), nbt, this.getRandom()));
this.setVariant(RainglowEntity.GLOW_SQUID.readNbt(this.getWorld(), nbt, this.random));
}

/**
Expand All @@ -49,7 +49,7 @@ public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) {
*/
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true)
public void tickMovement(CallbackInfo ci) {
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom());
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random);

if (colour != RainglowColour.BLUE) {
// we add 100 to g to let the mixin know that we want to override the method
Expand All @@ -60,7 +60,7 @@ public void tickMovement(CallbackInfo ci) {

@Override
public RainglowColour getVariant() {
return Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom());
return Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random);
}

@Override
Expand All @@ -85,7 +85,7 @@ protected SquidEntityMixin(EntityType<? extends WaterCreatureEntity> entityType,
private int spawnParticles(ServerWorld instance, ParticleEffect particle, double x, double y, double z, int count, double deltaX, double deltaY, double deltaZ, double speed) {
if (((Object) this) instanceof GlowSquidEntity) {
// send in custom colour data
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom());
RainglowColour colour = Rainglow.getColour(this.getWorld(), RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random);
int index = colour.ordinal();
// round x to 1 decimal place and append index data to the next two
return ((ServerWorld) this.getWorld()).spawnParticles(particle, (Math.round(x * 10)) / 10D + index / 1000D, y + 0.5, z, 0, deltaX, deltaY, deltaZ, speed);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"fabricloader": ">=0.14.19",
"fabric-resource-loader-v0": "*",
"fabric-networking-api-v1": "*",
"minecraft": ">=1.20.6"
"minecraft": ">=1.21-"
},

"suggests": {
Expand Down

0 comments on commit 3f8acba

Please sign in to comment.