Skip to content

Copper Golem + Copper Block Support#8244

Open
Absolutionism wants to merge 17 commits intoSkriptLang:dev/featurefrom
Absolutionism:dev/CopperGolem
Open

Copper Golem + Copper Block Support#8244
Absolutionism wants to merge 17 commits intoSkriptLang:dev/featurefrom
Absolutionism:dev/CopperGolem

Conversation

@Absolutionism
Copy link
Copy Markdown
Contributor

Problem

No proper support for setting and getting attributes of copper golems and copper blocks.

Solution

Removes 'copper golem' from SimpleEntityData and adds CopperGolemData allowing users to specify the copper state of the copper golem and whether they're waxed.
Adds a condition to check if a copper golem or a copper block is waxed.
Adds an effect to wax or unwax a copper golem or a copper block.
Adds an expression to get/set the time until the next oxidation for a copper golem.
Adds an expression to get/set the pose of a copper golem statue.
Adds an expression to get/set the copper state of a copper golem or a copper block.

Adds 'CopperState' that mimics 'WeatheringCopperState' for the versions that don't have it. Allowing easy use for getting and setting the copper states.

Registers ClassInfo for copper golem statue poses
Registers ClassInfo for 'CopperState' or 'WeatheringCopperState' if it exists.

Adds 'ReflectUtils' that is a utility class for common reflection and caches where possible. Reflection was needed for 'CopperState', 'ExprCopperState', and 'ExprCopperGolemOxidationTime' which led to the creation of ReflectUtils.

Testing Completed

EntityData.sk
EffWax.sk
ExprCopperGolemOxidationTime.sk
ExprCopperGolemPose.sk
ExprCopperState.sk
EffSecSpawn.sk

Supporting Information

N/A


Completes: none
Related: none

@Absolutionism Absolutionism requested a review from a team as a code owner October 18, 2025 00:57
@Absolutionism Absolutionism requested review from Burbulinis and TheMug06 and removed request for a team October 18, 2025 00:57
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Oct 18, 2025
@sovdeeth sovdeeth added the feature Pull request adding a new feature. label Oct 18, 2025
@sovdeeth sovdeeth moved this to In Review in 2.14 Releases Oct 18, 2025
@sovdeeth
Copy link
Copy Markdown
Member

Forgot to write this in the last review, but this should all be in the skriptlang package.

@Absolutionism Absolutionism requested a review from a team as a code owner October 23, 2025 20:35
@Absolutionism Absolutionism requested review from APickledWalrus and removed request for a team October 23, 2025 20:35
@Absolutionism Absolutionism added the 2.14 Targeting a 2.14.X version release. label Nov 2, 2025
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.14 Releases Nov 3, 2025
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Nov 3, 2025
Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good. I have some suggestions about the organization/modularization.

@github-project-automation github-project-automation bot moved this from Awaiting Merge to In Review in 2.14 Releases Nov 3, 2025
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Nov 3, 2025
# Conflicts:
#	src/main/java/org/skriptlang/skript/bukkit/misc/expressions/ExprTextOf.java
Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready :)

if (!(entity instanceof CopperGolem golem))
continue;
long worldTime = golem.getWorld().getGameTime();
golem.setOxidizing(Oxidizing.atTime(worldTime + ticks));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to check for negative values from overflow here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minecraft's internal code doesn't seem to have special handling for overflow when it comes to the game time of a world.
So if a world is alive long enough, it can return negative

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minecrafts Internal Code - ServerLevel.java

protected void tickTime() {
      if (this.tickTime) {
         long $$0 = this.levelData.getGameTime() + 1L;
         this.serverLevelData.setGameTime($$0);
         Profiler.get().push("scheduledFunctions");
         this.serverLevelData.getScheduledEvents().tick(this.server, $$0);
         Profiler.get().pop();
         if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
            this.setDayTime(this.levelData.getDayTime() + 1L);
         }
      }
   }

@skriptlang-automation skriptlang-automation bot removed the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Nov 8, 2025
@Absolutionism Absolutionism removed the 2.14 Targeting a 2.14.X version release. label Dec 14, 2025
# Conflicts:
#	src/main/java/ch/njol/skript/Skript.java
#	src/main/java/org/skriptlang/skript/bukkit/entity/EntityModule.java
#	src/main/resources/lang/default.lang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Pull request adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants