-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle BlockTag changes for pathnode and block predicates
Re-enable util.block_tracking and ai.pathing packages as they should work correctly now.
- Loading branch information
Showing
10 changed files
with
81 additions
and
62 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/pathing/BootstrapMixin.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
common/src/main/java/net/caffeinemc/mods/lithium/mixin/ai/pathing/FuelValuesMixin.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,32 @@ | ||
package net.caffeinemc.mods.lithium.mixin.ai.pathing; | ||
|
||
import net.caffeinemc.mods.lithium.common.ai.pathing.BlockStatePathingCache; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.world.flag.FeatureFlagSet; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.entity.FuelValues; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
/** | ||
* Hook into the initialization of fuel values, because those are always updated after block tags are modified, | ||
* and we must update our cache path node information which is also based on block tags. | ||
*/ | ||
@Mixin(FuelValues.class) | ||
public class FuelValuesMixin { | ||
|
||
@Inject( | ||
method = "vanillaBurnTimes(Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/world/flag/FeatureFlagSet;I)Lnet/minecraft/world/level/block/entity/FuelValues;", | ||
at = @At(value = "RETURN") | ||
) | ||
private static void initializeCachedBlockData(HolderLookup.Provider provider, FeatureFlagSet featureFlagSet, int i, CallbackInfoReturnable<FuelValues> cir) { | ||
// Initialize / Reinitialize the cached path node types. | ||
// This is called before burn times are set in the minecraft server, but we don't care about the updated burn times | ||
for (BlockState blockState : Block.BLOCK_STATE_REGISTRY) { | ||
((BlockStatePathingCache) blockState).lithium$initializePathNodeTypeCache(); | ||
} | ||
} | ||
} |
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
23 changes: 0 additions & 23 deletions
23
...n/src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/BootstrapMixin.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
.../src/main/java/net/caffeinemc/mods/lithium/mixin/util/block_tracking/FuelValuesMixin.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,32 @@ | ||
package net.caffeinemc.mods.lithium.mixin.util.block_tracking; | ||
|
||
import net.caffeinemc.mods.lithium.common.block.BlockStateFlagHolder; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.world.flag.FeatureFlagSet; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.entity.FuelValues; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
/** | ||
* Hook into the initialization of fuel values, because those are always updated after block tags are modified, | ||
* and we must update our cache path node information which is also based on block tags. | ||
*/ | ||
@Mixin(FuelValues.class) | ||
public class FuelValuesMixin { | ||
|
||
@Inject( | ||
method = "vanillaBurnTimes(Lnet/minecraft/core/HolderLookup$Provider;Lnet/minecraft/world/flag/FeatureFlagSet;I)Lnet/minecraft/world/level/block/entity/FuelValues;", | ||
at = @At(value = "RETURN") | ||
) | ||
private static void initializeCachedBlockData(HolderLookup.Provider provider, FeatureFlagSet featureFlagSet, int i, CallbackInfoReturnable<FuelValues> cir) { | ||
// Initialize / Reinitialize the cached block flags. | ||
// This is called before burn times are set in the minecraft server, but we don't care about the updated burn times | ||
for (BlockState blockState : Block.BLOCK_STATE_REGISTRY) { | ||
((BlockStateFlagHolder) blockState).lithium$initializeFlags(); | ||
} | ||
} | ||
} |
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
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