portal caching, ignored item not creating portals issue on purpose
This commit is contained in:
1 parent
c84210429d
commit
c7739f1963
5 files changed
+149
-26
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.PortalForcerInterface;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.PortalBlock;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.IWorld;
|
||||
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;
|
||||
|
||||
@Mixin(PortalBlock.class)
|
||||
public class PortalBlock_portalCachingMixin
|
||||
{
|
||||
@Inject(method = "createPortalAt", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/PortalBlock$AreaHelper;createPortal()V"
|
||||
))
|
||||
private void onCreatePortal(IWorld iWorld_1, BlockPos blockPos_1, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (!iWorld_1.isClient() && CarpetSettings.getBool("portalCaching"))
|
||||
{
|
||||
((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getStateForNeighborUpdate", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/Block;getDefaultState()Lnet/minecraft/block/BlockState;"
|
||||
))
|
||||
private void getAirBlockState(BlockState blockState_1, Direction direction_1, BlockState blockState_2, IWorld iWorld_1, BlockPos blockPos_1, BlockPos blockPos_2, CallbackInfoReturnable<BlockState> cir)
|
||||
{
|
||||
if (!iWorld_1.isClient() && CarpetSettings.getBool("portalCaching"))
|
||||
{
|
||||
((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user