-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add thread safety for block patterns
- Loading branch information
Showing
14 changed files
with
111 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...java/no2/worldthreader/common/mixin_support/interfaces/BeforeThreadingInitialization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package no2.worldthreader.common.mixin_support.interfaces; | ||
|
||
public interface BeforeThreadingInitialization { | ||
void worldthreader$initBeforeThreading(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ty/OptionalDispenseItemBehaviorMixin.java → ...or/OptionalDispenseItemBehaviorMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 3 additions & 15 deletions
18
...compatibility/RedstoneWireBlockMixin.java → ...lock_behavior/RedstoneWireBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...reader/mixin/threading_compatibility/block_behavior/patterns/CarvedPumpkinBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package no2.worldthreader.mixin.threading_compatibility.block_behavior.patterns; | ||
|
||
import net.minecraft.world.level.block.CarvedPumpkinBlock; | ||
import net.minecraft.world.level.block.state.pattern.BlockPattern; | ||
import no2.worldthreader.common.mixin_support.interfaces.BeforeThreadingInitialization; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(CarvedPumpkinBlock.class) | ||
public abstract class CarvedPumpkinBlockMixin implements BeforeThreadingInitialization { | ||
|
||
@Shadow | ||
public abstract BlockPattern getOrCreateSnowGolemBase(); | ||
|
||
@Shadow | ||
public abstract BlockPattern getOrCreateIronGolemBase(); | ||
|
||
@Shadow | ||
public abstract BlockPattern getOrCreateSnowGolemFull(); | ||
|
||
@Shadow | ||
public abstract BlockPattern getOrCreateIronGolemFull(); | ||
|
||
|
||
@Override | ||
public void worldthreader$initBeforeThreading() { | ||
this.getOrCreateSnowGolemBase(); | ||
this.getOrCreateSnowGolemFull(); | ||
|
||
this.getOrCreateIronGolemBase(); | ||
this.getOrCreateIronGolemFull(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...eader/mixin/threading_compatibility/block_behavior/patterns/EndPortalFrameBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package no2.worldthreader.mixin.threading_compatibility.block_behavior.patterns; | ||
|
||
import net.minecraft.world.level.block.EndPortalFrameBlock; | ||
import net.minecraft.world.level.block.state.pattern.BlockPattern; | ||
import no2.worldthreader.common.mixin_support.interfaces.BeforeThreadingInitialization; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(EndPortalFrameBlock.class) | ||
public abstract class EndPortalFrameBlockMixin implements BeforeThreadingInitialization { | ||
|
||
@Shadow | ||
public static native BlockPattern getOrCreatePortalShape(); | ||
|
||
|
||
@Override | ||
public void worldthreader$initBeforeThreading() { | ||
getOrCreatePortalShape(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...threader/mixin/threading_compatibility/block_behavior/patterns/WitherSkullBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package no2.worldthreader.mixin.threading_compatibility.block_behavior.patterns; | ||
|
||
import net.minecraft.world.level.block.WitherSkullBlock; | ||
import net.minecraft.world.level.block.state.pattern.BlockPattern; | ||
import no2.worldthreader.common.mixin_support.interfaces.BeforeThreadingInitialization; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(WitherSkullBlock.class) | ||
public abstract class WitherSkullBlockMixin implements BeforeThreadingInitialization { | ||
|
||
@Shadow | ||
public static native BlockPattern getOrCreateWitherBase(); | ||
|
||
@Shadow | ||
public static native BlockPattern getOrCreateWitherFull(); | ||
|
||
|
||
@Override | ||
public void worldthreader$initBeforeThreading() { | ||
getOrCreateWitherBase(); | ||
getOrCreateWitherFull(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ng_compatibility/WeatherCommandMixin.java → ...ibility/commands/WeatherCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._compatibility/WhitelistCommandMixin.java → ...ility/commands/WhitelistCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ompatibility/WorldBorderCommandMixin.java → ...ity/commands/WorldBorderCommandMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters