Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.21.4 #444

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
14 changes: 7 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// "maven-publish"
kotlin("jvm") version "2.0.21"
id("fabric-loom") version "1.8-SNAPSHOT"
kotlin("jvm") version "2.1.0"
id("fabric-loom") version "1.9-SNAPSHOT"
}

val version = "0.0.1"
val group = "one.oktw"

val fabricVersion = "0.108.0+1.21.3"
val galaxyLibVersion = "c328418"
val fabricVersion = "0.114.3+1.21.4"
val galaxyLibVersion = "bcf8f61"

repositories {
mavenCentral()
Expand Down Expand Up @@ -42,9 +42,9 @@ loom {

dependencies {
// Core
minecraft(group = "com.mojang", name = "minecraft", version = "1.21.3")
mappings(group = "net.fabricmc", name = "yarn", version = "1.21.3+build.2", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.16.9")
minecraft(group = "com.mojang", name = "minecraft", version = "1.21.4")
mappings(group = "net.fabricmc", name = "yarn", version = "1.21.4+build.8", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.16.10")

// fabric api
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = fabricVersion) {
Expand Down
2 changes: 1 addition & 1 deletion docker
Submodule docker updated 1 files
+6 −6 Dockerfile
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OKTW Galaxy Project
* Copyright (C) 2018-2020
* Copyright (C) 2018-2024
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
Expand All @@ -25,17 +25,17 @@
@Mixin(AbstractFurnaceBlockEntity.class)
public interface AbstractFurnaceBlockEntityAccessor {
@Accessor
int getBurnTime();
int getLitTimeRemaining();

@Accessor
void setBurnTime(int i);
void setLitTimeRemaining(int i);

@Accessor
int getCookTime();
int getCookingTimeSpent();

@Accessor
void setCookTime(int i);
void setCookingTimeSpent(int i);

@Accessor
int getCookTimeTotal();
int getCookingTotalTime();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OKTW Galaxy Project
* Copyright (C) 2018-2021
* Copyright (C) 2018-2024
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
Expand Down Expand Up @@ -57,7 +57,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_RealTime {
@Redirect(method = "tick",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;burnTime:I",
target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;litTimeRemaining:I",
opcode = Opcodes.PUTFIELD,
ordinal = 0
)
Expand All @@ -66,29 +66,29 @@ public abstract class AbstractFurnaceBlockEntityMixin_RealTime {
final int ticks = (int) ((RealTimeTrackingBridge) self.getWorld()).realTimeBridge$getRealTimeTicks();

AbstractFurnaceBlockEntityAccessor accessor = (AbstractFurnaceBlockEntityAccessor) self;
final int burnTime = accessor.getBurnTime();
final int burnTime = accessor.getLitTimeRemaining();
if (burnTime != 1 && burnTime < ticks) {
accessor.setBurnTime(1); // last cook tick
accessor.setLitTimeRemaining(1); // last cook tick
} else {
accessor.setBurnTime(Math.max(0, burnTime - ticks));
accessor.setLitTimeRemaining(Math.max(0, burnTime - ticks));
}
}

@Redirect(
method = "tick",
at = @At(value = "FIELD", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;cookTime:I", opcode = Opcodes.PUTFIELD, ordinal = 0))
at = @At(value = "FIELD", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;cookingTimeSpent:I", opcode = Opcodes.PUTFIELD, ordinal = 0))
private static void realTimeImpl$adjustForRealTimeCookTime(final AbstractFurnaceBlockEntity self, final int modifier) {
final int ticks = (int) ((RealTimeTrackingBridge) self.getWorld()).realTimeBridge$getRealTimeTicks();

AbstractFurnaceBlockEntityAccessor accessor = (AbstractFurnaceBlockEntityAccessor) self;
accessor.setCookTime(Math.min(accessor.getCookTimeTotal(), accessor.getCookTime() + ticks));
accessor.setCookingTimeSpent(Math.min(accessor.getCookingTotalTime(), accessor.getCookingTimeSpent() + ticks));
}

@Redirect(
method = "tick",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;cookTime:I",
target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;cookingTimeSpent:I",
opcode = Opcodes.PUTFIELD
),
slice = @Slice(
Expand All @@ -106,6 +106,6 @@ public abstract class AbstractFurnaceBlockEntityMixin_RealTime {
final int ticks = (int) ((RealTimeTrackingBridge) self.getWorld()).realTimeBridge$getRealTimeTicks();

AbstractFurnaceBlockEntityAccessor accessor = (AbstractFurnaceBlockEntityAccessor) self;
accessor.setCookTime(MathHelper.clamp(accessor.getCookTime() - (2 * ticks), 0, accessor.getCookTimeTotal()));
accessor.setCookingTimeSpent(MathHelper.clamp(accessor.getCookingTimeSpent() - (2 * ticks), 0, accessor.getCookingTotalTime()));
}
}
2 changes: 1 addition & 1 deletion src/main/kotlin/one/oktw/galaxy/block/CustomBlock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ open class CustomBlock(final override val identifier: Identifier, val baseBlock:
protected val blockEntityType: BlockEntityType<CustomBlockEntity> = Registry.register(
Registries.BLOCK_ENTITY_TYPE,
identifier,
FabricBlockEntityTypeBuilder.create({ pos, _ -> createBlockEntity(pos) }, BARRIER).build(null)
FabricBlockEntityTypeBuilder.create({ pos, _ -> createBlockEntity(pos) }, BARRIER).build()
)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ open class ModelCustomBlockEntity(type: BlockEntityType<*>, pos: BlockPos, priva
set(direction) {
if (facing != null && direction != null && direction in allowedFacing) {
field = direction
(world as? ServerWorld)?.getEntity(entityUUID)?.yaw = direction.asRotation()
(world as? ServerWorld)?.getEntity(entityUUID)?.yaw = direction.positiveHorizontalDegrees
}
}
open val allowedFacing: List<Direction> = emptyList()
Expand Down Expand Up @@ -93,7 +93,7 @@ open class ModelCustomBlockEntity(type: BlockEntityType<*>, pos: BlockPos, priva

private fun spawnEntity() {
val entity: ArmorStandEntity = EntityType.getEntityFromNbt(armorStandNbt, world, SpawnReason.COMMAND).get() as ArmorStandEntity
entity.refreshPositionAndAngles(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, facing?.asRotation() ?: 0.0F, 0.0F)
entity.refreshPositionAndAngles(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, facing?.positiveHorizontalDegrees ?: 0.0F, 0.0F)
entity.equipStack(EquipmentSlot.HEAD, modelItem)
entity.addCommandTag("BLOCK")
entity.addCommandTag(getId().toString())
Expand Down
154 changes: 77 additions & 77 deletions src/main/kotlin/one/oktw/galaxy/item/Button.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,84 +22,84 @@ import net.minecraft.item.Items.DIAMOND_HOE
import net.minecraft.text.Text
import net.minecraft.util.Identifier

class Button private constructor(id: String, modelData: Int) : CustomItem(Identifier.of("galaxy", "item/gui/button/$id"), DIAMOND_HOE, modelData) {
class Button private constructor(id: String) : CustomItem(Identifier.of("galaxy", "item/gui/button/$id"), DIAMOND_HOE) {
companion object {
val BLANK = registry.register(Button("blank", 1300000))
val ARROWHEAD_UP = registry.register(Button("arrowhead_up", 1300001))
val ARROWHEAD_DOWN = registry.register(Button("arrowhead_down", 1300002))
val ARROWHEAD_LEFT = registry.register(Button("arrowhead_left", 1300003))
val ARROWHEAD_RIGHT = registry.register(Button("arrowhead_right", 1300004))
val ARROW_UP = registry.register(Button("arrow_up", 1300005))
val ARROW_DOWN = registry.register(Button("arrow_down", 1300006))
val ARROW_LEFT = registry.register(Button("arrow_left", 1300007))
val ARROW_RIGHT = registry.register(Button("arrow_right", 1300008))
val CROSS_MARK = registry.register(Button("cross_mark", 1300009))
val CHECK_MARK = registry.register(Button("check_mark", 1300010))
val MINUS = registry.register(Button("minus", 1300011))
val PLUS = registry.register(Button("plus", 1300012))
val ZERO_TO_NINE = registry.register(Button("zero_to_nine", 1300013))
val A_TO_Z = registry.register(Button("a_to_z", 1300014))
val POWER_OFF = registry.register(Button("power_off", 1300015))
val POWER_ON = registry.register(Button("power_on", 1300016))
val STARS = registry.register(Button("stars", 1300017))
val UPGRADE = registry.register(Button("upgrade", 1300018))
val EXCLAMATION_MARK = registry.register(Button("exclamation_mark", 1300019))
val QUESTION_MARK = registry.register(Button("question_mark", 1300020))
val COG = registry.register(Button("cog", 1300021))
val LIST = registry.register(Button("list", 1300022))
val LEAVE = registry.register(Button("leave", 1300023))
val ENTER = registry.register(Button("enter", 1300024))
val SUQARES = registry.register(Button("suqares", 1300025))
val WRITE = registry.register(Button("write", 1300026))
val MESSAGE = registry.register(Button("message", 1300027))
val ANONYMOUS = registry.register(Button("anonymous", 1300028))
val PERSON = registry.register(Button("person", 1300029))
val MEMBER = registry.register(Button("member", 1300030))
val ADMINISTRATOR = registry.register(Button("administrator", 1300031))
val PEOPLE = registry.register(Button("people", 1300032))
val GALAXY = registry.register(Button("galaxy", 1300033))
val GALAXY_WITH_MINUS_SIGN = registry.register(Button("galaxy_with_minus_sign", 1300034))
val GALAXY_WITH_PLUS_SIGN = registry.register(Button("galaxy_with_plus_sign", 1300035))
val GALAXY_WITH_EXCLAMATION_MARK = registry.register(Button("galaxy_with_exclamation_mark", 1300036))
val GALAXY_WITH_QUESTION_MARK = registry.register(Button("galaxy_with_question_mark", 1300037))
val GALAXY_WITH_COG = registry.register(Button("galaxy_with_cog", 1300038))
val GALAXY_WITH_CHECK_MARK = registry.register(Button("galaxy_with_check_mark", 1300039))
val PLANET_NEUTRAL = registry.register(Button("planet_neutral", 1300040))
val PLANET_HOT = registry.register(Button("planet_hot", 1300041))
val PLANET_DARK = registry.register(Button("planet_dark", 1300042))
val PLANET_WITH_LIST = registry.register(Button("planet_with_list", 1300043))
val UNKNOWN_PLANET = registry.register(Button("unknown_planet", 1300044))
val UNKNOWN_PLANET_WITH_PLUS_SIGN = registry.register(Button("unknown_planet_with_plus_sign", 1300045))
val PERSON_WITH_MINUS_SIGN = registry.register(Button("person_with_minus_sign", 1300046))
val PERSON_WITH_PLUS_SIGN = registry.register(Button("person_with_plus_sign", 1300047))
val PERSON_WITH_EXCLAMATION_MARK = registry.register(Button("person_with_exclamation_mark", 1300048))
val PERSON_WITH_QUESTION_MARK = registry.register(Button("person_with_question_mark", 1300049))
val PERSON_WITH_COG = registry.register(Button("person_with_cog", 1300050))
val NUMBER_0 = registry.register(Button("number_0", 1300051))
val NUMBER_1 = registry.register(Button("number_1", 1300052))
val NUMBER_2 = registry.register(Button("number_2", 1300053))
val NUMBER_3 = registry.register(Button("number_3", 1300054))
val NUMBER_4 = registry.register(Button("number_4", 1300055))
val NUMBER_5 = registry.register(Button("number_5", 1300056))
val NUMBER_6 = registry.register(Button("number_6", 1300057))
val NUMBER_7 = registry.register(Button("number_7", 1300058))
val NUMBER_8 = registry.register(Button("number_8", 1300059))
val NUMBER_9 = registry.register(Button("number_9", 1300060))
val UNDERSCORE = registry.register(Button("underscore", 1300061))
val INFO = registry.register(Button("info", 1300062))
val MAGNIFIER = registry.register(Button("magnifier", 1300063))
val STARDUST_JAR = registry.register(Button("stardust_jar", 1300064))
val DISABLED_BLANK = registry.register(Button("disabled_blank", 1310000))
val DISABLED_ARROWHEAD_UP = registry.register(Button("disabled_arrowhead_up", 1310001))
val DISABLED_ARROWHEAD_DOWN = registry.register(Button("disabled_arrowhead_down", 1310002))
val DISABLED_ARROWHEAD_LEFT = registry.register(Button("disabled_arrowhead_left", 1310003))
val DISABLED_ARROWHEAD_RIGHT = registry.register(Button("disabled_arrowhead_right", 1310004))
val DISABLED_ARROW_UP = registry.register(Button("disabled_arrow_up", 1310005))
val DISABLED_ARROW_DOWN = registry.register(Button("disabled_arrow_down", 1310006))
val DISABLED_ARROW_LEFT = registry.register(Button("disabled_arrow_left", 1310007))
val DISABLED_ARROW_RIGHT = registry.register(Button("disabled_arrow_right", 1310008))
val DISABLED_CROSS_MARK = registry.register(Button("disabled_cross_mark", 1310009))
val DISABLED_CHECK_MARK = registry.register(Button("disabled_check_mark", 1310010))
val BLANK = registry.register(Button("blank"))
val ARROWHEAD_UP = registry.register(Button("arrowhead_up"))
val ARROWHEAD_DOWN = registry.register(Button("arrowhead_down"))
val ARROWHEAD_LEFT = registry.register(Button("arrowhead_left"))
val ARROWHEAD_RIGHT = registry.register(Button("arrowhead_right"))
val ARROW_UP = registry.register(Button("arrow_up"))
val ARROW_DOWN = registry.register(Button("arrow_down"))
val ARROW_LEFT = registry.register(Button("arrow_left"))
val ARROW_RIGHT = registry.register(Button("arrow_right"))
val CROSS_MARK = registry.register(Button("cross_mark"))
val CHECK_MARK = registry.register(Button("check_mark"))
val MINUS = registry.register(Button("minus"))
val PLUS = registry.register(Button("plus"))
val ZERO_TO_NINE = registry.register(Button("zero_to_nine"))
val A_TO_Z = registry.register(Button("a_to_z"))
val POWER_OFF = registry.register(Button("power_off"))
val POWER_ON = registry.register(Button("power_on"))
val STARS = registry.register(Button("stars"))
val UPGRADE = registry.register(Button("upgrade"))
val EXCLAMATION_MARK = registry.register(Button("exclamation_mark"))
val QUESTION_MARK = registry.register(Button("question_mark"))
val COG = registry.register(Button("cog"))
val LIST = registry.register(Button("list"))
val LEAVE = registry.register(Button("leave"))
val ENTER = registry.register(Button("enter"))
val SUQARES = registry.register(Button("suqares"))
val WRITE = registry.register(Button("write"))
val MESSAGE = registry.register(Button("message"))
val ANONYMOUS = registry.register(Button("anonymous"))
val PERSON = registry.register(Button("person"))
val MEMBER = registry.register(Button("member"))
val ADMINISTRATOR = registry.register(Button("administrator"))
val PEOPLE = registry.register(Button("people"))
val GALAXY = registry.register(Button("galaxy"))
val GALAXY_WITH_MINUS_SIGN = registry.register(Button("galaxy_with_minus_sign"))
val GALAXY_WITH_PLUS_SIGN = registry.register(Button("galaxy_with_plus_sign"))
val GALAXY_WITH_EXCLAMATION_MARK = registry.register(Button("galaxy_with_exclamation_mark"))
val GALAXY_WITH_QUESTION_MARK = registry.register(Button("galaxy_with_question_mark"))
val GALAXY_WITH_COG = registry.register(Button("galaxy_with_cog"))
val GALAXY_WITH_CHECK_MARK = registry.register(Button("galaxy_with_check_mark"))
val PLANET_NEUTRAL = registry.register(Button("planet_neutral"))
val PLANET_HOT = registry.register(Button("planet_hot"))
val PLANET_DARK = registry.register(Button("planet_dark"))
val PLANET_WITH_LIST = registry.register(Button("planet_with_list"))
val UNKNOWN_PLANET = registry.register(Button("unknown_planet"))
val UNKNOWN_PLANET_WITH_PLUS_SIGN = registry.register(Button("unknown_planet_with_plus_sign"))
val PERSON_WITH_MINUS_SIGN = registry.register(Button("person_with_minus_sign"))
val PERSON_WITH_PLUS_SIGN = registry.register(Button("person_with_plus_sign"))
val PERSON_WITH_EXCLAMATION_MARK = registry.register(Button("person_with_exclamation_mark"))
val PERSON_WITH_QUESTION_MARK = registry.register(Button("person_with_question_mark"))
val PERSON_WITH_COG = registry.register(Button("person_with_cog"))
val NUMBER_0 = registry.register(Button("number_0"))
val NUMBER_1 = registry.register(Button("number_1"))
val NUMBER_2 = registry.register(Button("number_2"))
val NUMBER_3 = registry.register(Button("number_3"))
val NUMBER_4 = registry.register(Button("number_4"))
val NUMBER_5 = registry.register(Button("number_5"))
val NUMBER_6 = registry.register(Button("number_6"))
val NUMBER_7 = registry.register(Button("number_7"))
val NUMBER_8 = registry.register(Button("number_8"))
val NUMBER_9 = registry.register(Button("number_9"))
val UNDERSCORE = registry.register(Button("underscore"))
val INFO = registry.register(Button("info"))
val MAGNIFIER = registry.register(Button("magnifier"))
val STARDUST_JAR = registry.register(Button("stardust_jar"))
val DISABLED_BLANK = registry.register(Button("disabled_blank"))
val DISABLED_ARROWHEAD_UP = registry.register(Button("disabled_arrowhead_up"))
val DISABLED_ARROWHEAD_DOWN = registry.register(Button("disabled_arrowhead_down"))
val DISABLED_ARROWHEAD_LEFT = registry.register(Button("disabled_arrowhead_left"))
val DISABLED_ARROWHEAD_RIGHT = registry.register(Button("disabled_arrowhead_right"))
val DISABLED_ARROW_UP = registry.register(Button("disabled_arrow_up"))
val DISABLED_ARROW_DOWN = registry.register(Button("disabled_arrow_down"))
val DISABLED_ARROW_LEFT = registry.register(Button("disabled_arrow_left"))
val DISABLED_ARROW_RIGHT = registry.register(Button("disabled_arrow_right"))
val DISABLED_CROSS_MARK = registry.register(Button("disabled_cross_mark"))
val DISABLED_CHECK_MARK = registry.register(Button("disabled_check_mark"))
}

override fun getName(): Text = Text.literal("").styled { it.withItalic(false) }
Expand Down
Loading
Loading