Skip to content

Commit

Permalink
chore: merge earlier api additions
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
  • Loading branch information
gabizou committed Sep 28, 2024
2 parents 49414fa + ed1dd0a commit 47a830a
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SpongeAPI
48 changes: 48 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
<sha256 value="4bd3a99d40069d70ffdc288fb28914940a03b4d5111ced4d9cfa2123c94e5fe3" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-lib" version="2.32.0">
<artifact name="spotless-lib-2.32.0.jar">
<sha256 value="4bac6126b5d668865d805ac61aa0e25288b910deb33f274764ee78deb691b2ec" origin="Generated by Gradle"/>
</artifact>
<artifact name="spotless-lib-2.32.0.module">
<sha256 value="87a704f5a5e997ee76cf63e3039fa8ad248a331ef1578b5f897ed54360196213" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-lib" version="2.40.0">
<artifact name="spotless-lib-2.40.0.jar">
<sha256 value="a3319a8776a6ccee1ed436904ed1016565fd032eca848c25a425126c1937675d" origin="Generated by Gradle"/>
Expand All @@ -99,6 +107,14 @@
<sha256 value="b0f19d6b7684ffaf1d418edd15ced98020590b06c57ecaf44405f4895051805c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-lib-extra" version="2.32.0">
<artifact name="spotless-lib-extra-2.32.0.jar">
<sha256 value="8bc4906062dc966c056862fc9260ac7d0593660b843ad65c11b156e9dccb64a1" origin="Generated by Gradle"/>
</artifact>
<artifact name="spotless-lib-extra-2.32.0.module">
<sha256 value="6bc74b16a7310decb67ecf07d6f5ce1bdc7af9b8791de93e4f07f38b2c68b10a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-lib-extra" version="2.40.0">
<artifact name="spotless-lib-extra-2.40.0.jar">
<sha256 value="ffe34464ed38737d8c990f889b9d5bf3b6fec2fbbea00bd4abdd928ee34f5316" origin="Generated by Gradle"/>
Expand All @@ -107,6 +123,14 @@
<sha256 value="5476870783ce612a03b4339ad346b5d5137d6b77d20141726d859109d61914f7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-plugin-gradle" version="6.13.0">
<artifact name="spotless-plugin-gradle-6.13.0.jar">
<sha256 value="26cef0979c390871f5c165fa28601e10096092ec96d7358a0bf5ccda86096c49" origin="Generated by Gradle"/>
</artifact>
<artifact name="spotless-plugin-gradle-6.13.0.module">
<sha256 value="0652e3bd61b3ae777aee2c08c379ddf3ef0e0b554f8ae040861e017c27400556" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.diffplug.spotless" name="spotless-plugin-gradle" version="6.20.0">
<artifact name="spotless-plugin-gradle-6.20.0.jar">
<sha256 value="3dba892f4893793df0d024596f4d8b190517cd40cd12b558170a01dfb3c22c33" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -975,6 +999,14 @@
<sha256 value="43c2b9b142e7055d1f2a5827f10944925d22747d9756b3250c07aab47538a971" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.googlecode.javaewah" name="JavaEWAH" version="1.1.13">
<artifact name="JavaEWAH-1.1.13.jar">
<sha256 value="4c0fda2b1d317750d7ea324e36c70b2bc48310c0aaae67b98df0915d696d7111" origin="Generated by Gradle"/>
</artifact>
<artifact name="JavaEWAH-1.1.13.pom">
<sha256 value="9725b1fe9c6810d977750bb84415ea1082c4b488d4a839f9704bb4f5e8fc17f4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.googlecode.javaewah" name="JavaEWAH" version="1.2.3">
<artifact name="JavaEWAH-1.2.3.jar">
<sha256 value="d65226949713c4c61a784f41c51167e7b0316f93764398ebba9e4336b3d954c2" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -4355,6 +4387,14 @@
<sha256 value="a8417745cfa2d95d6a9711e9413fca984fc5666b7627bad1540cf27d462ae813" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jgit" name="org.eclipse.jgit" version="5.13.1.202206130422-r">
<artifact name="org.eclipse.jgit-5.13.1.202206130422-r.jar">
<sha256 value="d679365a6c8e55c1496701099f5e5765433f68dcb659759416ba5b222eb5055c" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.eclipse.jgit-5.13.1.202206130422-r.pom">
<sha256 value="3cc4bebf9c936578eae2b6d24fb2a912d89993a54fd0e2fbc1c8abc049878515" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jgit" name="org.eclipse.jgit" version="6.6.0.202305301015-r">
<artifact name="org.eclipse.jgit-6.6.0.202305301015-r.jar">
<sha256 value="e304555d5b20df3b91cc77c12424af70be30d42a29c7ed8c27b3f06f7337a8e3" origin="Generated by Gradle"/>
Expand All @@ -4368,6 +4408,11 @@
<sha256 value="a18fd7d0c41fda8d8f1c4a24b5000a866456147a24746ee6cc4731e788a18dee" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jgit" name="org.eclipse.jgit-parent" version="5.13.1.202206130422-r">
<artifact name="org.eclipse.jgit-parent-5.13.1.202206130422-r.pom">
<sha256 value="de65fc76ed8f44a57785ee164918dc3d4f55ee3fea6a47bc7cb1baa19ef1bc83" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jgit" name="org.eclipse.jgit-parent" version="6.6.0.202305301015-r">
<artifact name="org.eclipse.jgit-parent-6.6.0.202305301015-r.pom">
<sha256 value="ac82cab68c517ffebbc5c6e76a022d71ef5d40036c9c4e0ef901f0e9c78a3a59" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -5639,6 +5684,9 @@
</artifact>
</component>
<component group="org.slf4j" name="slf4j-api" version="1.7.30">
<artifact name="slf4j-api-1.7.30.jar">
<sha256 value="cdba07964d1bb40a0761485c6b1e8c2f8fd9eb1d19c53928ac0d7f9510105c57" origin="Generated by Gradle"/>
</artifact>
<artifact name="slf4j-api-1.7.30.pom">
<sha256 value="7e0747751e9b67e19dcb5206f04ea22cc03d250c422426402eadd03513f2c314" origin="Generated by Gradle"/>
</artifact>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ public static void tickTileEntity(final TrackedWorldBridge mixinWorldServer, fin
return;
}
final net.minecraft.world.level.block.entity.BlockEntity blockEntity = tickingBlockEntity.get();
if (!((org.spongepowered.api.block.entity.BlockEntity) blockEntity).isTicking()) {
return;
}
final BlockEntityBridge mixinTileEntity = (BlockEntityBridge) tickingBlockEntity.get();
final BlockPos pos = blockEntity.getBlockPos();
final @Nullable LevelChunkBridge chunk = ((ActiveChunkReferantBridge) blockEntity).bridge$getActiveChunk();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public abstract class BlockEntityMixin_API implements BlockEntity {
//@formatter:on

@Nullable private LocatableBlock api$LocatableBlock;
private boolean api$canTickRequested = false;
private boolean api$canTick;
private boolean api$isTicking = true;

public ServerLocation location() {
return ServerLocation.of((ServerWorld) this.level, VecHelper.toVector3i(this.shadow$getBlockPos()));
Expand Down Expand Up @@ -144,6 +147,31 @@ public void remove() {
}
}

@Override
public boolean canTick() {
if (!this.api$canTickRequested) {
this.api$canTick = this.shadow$getBlockState().getTicker(this.level, this.type) != null;
this.api$canTickRequested = true;
}

return api$canTick;
}

@Override
public boolean isTicking() {
return !this.remove && this.canTick() && this.api$isTicking;
}

@Override
public boolean setTicking(final boolean ticking) {
if (this.isRemoved() || !this.canTick()) {
return false;
}

this.api$isTicking = ticking;
return true;
}

@Override
public final BlockEntityType type() {
return (BlockEntityType) this.type;
Expand Down

0 comments on commit 47a830a

Please sign in to comment.