23w17a
This commit is contained in:
1 parent
15b120f729
commit
07033af7dd
44 files changed
+309
-265
No files matched your search
@@ -29,7 +29,7 @@ public abstract class ArmorStand_scarpetMarkerMixin extends LivingEntity
|
||||
@Inject(method = "readAdditionalSaveData", at = @At("HEAD"))
|
||||
private void checkScarpetMarkerUnloaded(CallbackInfo ci)
|
||||
{
|
||||
if (!level.isClientSide)
|
||||
if (!level().isClientSide)
|
||||
{
|
||||
if (getTags().contains(Auxiliary.MARKER_STRING))
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.world.level.chunk.DataLayer;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
import net.minecraft.world.level.lighting.BlockLightSectionStorage;
|
||||
import net.minecraft.world.level.lighting.BlockLightSectionStorage.BlockDataLayerStorageMap;
|
||||
import net.minecraft.world.level.lighting.LayerLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LayerLightSectionStorage;
|
||||
|
||||
@Mixin(BlockLightSectionStorage.class)
|
||||
@@ -24,7 +24,7 @@ public abstract class BlockLightSectionStorage_scarpetChunkCreationMixin extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processRelight(final LayerLightEngine<?, ?> lightProvider, final long cPos)
|
||||
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
||||
{
|
||||
final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider;
|
||||
|
||||
@@ -62,4 +62,10 @@ public abstract class BlockLightSectionStorage_scarpetChunkCreationMixin extends
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightLevelByLong(long blockPos)
|
||||
{
|
||||
return getLightValue(blockPos);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
|
||||
|
||||
@Inject(method = "playerTouch", at = @At("HEAD"))
|
||||
private void addXP(Player player, CallbackInfo ci) {
|
||||
if (CarpetSettings.xpNoCooldown && !level.isClientSide) {
|
||||
if (CarpetSettings.xpNoCooldown && !level().isClientSide) {
|
||||
player.takeXpDelay = 0;
|
||||
// reducing the count to 1 and leaving vanilla to deal with it
|
||||
while (this.count > 1) {
|
||||
|
||||
@@ -24,11 +24,11 @@ public abstract class Guardian_renewableSpongesMixin extends Monster
|
||||
@Override
|
||||
public void thunderHit(ServerLevel serverWorld, LightningBolt lightningEntity)
|
||||
{ // isRemoved()
|
||||
if (!this.level.isClientSide && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian))
|
||||
if (!this.level().isClientSide && !this.isRemoved() && CarpetSettings.renewableSponges && !((Object)this instanceof ElderGuardian))
|
||||
{
|
||||
ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level);
|
||||
ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level());
|
||||
elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
elderGuardian.finalizeSpawn(serverWorld ,this.level.getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData)null, (CompoundTag)null);
|
||||
elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData)null, (CompoundTag)null);
|
||||
elderGuardian.setNoAi(this.isNoAi());
|
||||
|
||||
if (this.hasCustomName())
|
||||
@@ -37,7 +37,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster
|
||||
elderGuardian.setCustomNameVisible(this.isCustomNameVisible());
|
||||
}
|
||||
|
||||
this.level.addFreshEntity(elderGuardian);
|
||||
this.level().addFreshEntity(elderGuardian);
|
||||
this.discard(); // discard remove();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,7 +13,7 @@ import static carpet.CarpetSettings.FungusGrowthMode.*;
|
||||
|
||||
@Mixin(HugeFungusFeature.class)
|
||||
public class HugeFungusFeatureMixin {
|
||||
@ModifyArgs(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/HugeFungusFeature;placeStem(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/feature/HugeFungusConfiguration;Lnet/minecraft/core/BlockPos;IZ)V"))
|
||||
@ModifyArgs(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/HugeFungusFeature;placeStem(Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/feature/HugeFungusConfiguration;Lnet/minecraft/core/BlockPos;IZ)V"))
|
||||
private void mixin(Args args) {
|
||||
boolean natural = !((HugeFungusConfiguration) args.get(2)).planted;
|
||||
args.set(5, natural && ((boolean) args.get(5)) ||
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.LightStorageInterface;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import carpet.fakes.ChunkLightProviderInterface;
|
||||
import carpet.fakes.Lighting_scarpetChunkCreationInterface;
|
||||
import net.minecraft.world.level.chunk.DataLayer;
|
||||
import net.minecraft.world.level.lighting.LayerLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LayerLightSectionStorage;
|
||||
|
||||
@Mixin(LayerLightEngine.class)
|
||||
@Mixin(LightEngine.class)
|
||||
public abstract class LayerLightEngine_scarpetChunkCreationMixin implements Lighting_scarpetChunkCreationInterface, ChunkLightProviderInterface
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
protected LayerLightSectionStorage<?> storage;
|
||||
|
||||
@Shadow protected abstract void clearQueuedSectionBlocks(final long l);
|
||||
|
||||
@Override
|
||||
public void removeLightData(final long pos)
|
||||
{
|
||||
@@ -31,6 +33,13 @@ public abstract class LayerLightEngine_scarpetChunkCreationMixin implements Ligh
|
||||
}
|
||||
|
||||
@Override
|
||||
@Invoker("getLevel")
|
||||
public abstract int callGetCurrentLevelFromSection(DataLayer array, long blockPos);
|
||||
public int callGetCurrentLevelFromSection(DataLayer array, long blockPos) {
|
||||
return ((LightStorageInterface)storage).getLightLevelByLong(blockPos);
|
||||
};
|
||||
|
||||
@Override
|
||||
public void clearQueuedSectionBlocksPublicAccess(long sectionPos)
|
||||
{
|
||||
clearQueuedSectionBlocks(sectionPos);
|
||||
}
|
||||
}
|
||||
+10
-8
@@ -1,10 +1,12 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import carpet.fakes.Lighting_scarpetChunkCreationInterface;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.level.chunk.DataLayer;
|
||||
import net.minecraft.world.level.lighting.DataLayerStorageMap;
|
||||
import net.minecraft.world.level.lighting.LayerLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LayerLightSectionStorage;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -25,8 +27,8 @@ public abstract class LayerLightSectionStorage_scarpetChunkCreationMixin impleme
|
||||
@Shadow
|
||||
protected abstract DataLayer getDataLayer(final long sectionPos, final boolean cached);
|
||||
|
||||
@Shadow
|
||||
protected abstract void clearQueuedSectionBlocks(final LayerLightEngine<?, ?> storage, final long blockChunkPos);
|
||||
//@Shadow
|
||||
//protected abstract void clearQueuedSectionBlocks(final LightEngine<?, ?> storage, final long blockChunkPos);
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
@@ -42,7 +44,7 @@ public abstract class LayerLightSectionStorage_scarpetChunkCreationMixin impleme
|
||||
@Final
|
||||
protected Long2ObjectMap<DataLayer> queuedSections;
|
||||
|
||||
@Shadow protected abstract void enableLightSources(final long l, final boolean bl);
|
||||
//@Shadow protected abstract void enableLightSources(final long l, final boolean bl);
|
||||
|
||||
@Unique
|
||||
private final LongSet removedChunks = new LongOpenHashSet();
|
||||
@@ -63,10 +65,10 @@ public abstract class LayerLightSectionStorage_scarpetChunkCreationMixin impleme
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "markNewInconsistencies(Lnet/minecraft/world/level/lighting/LayerLightEngine;ZZ)V",
|
||||
method = "markNewInconsistencies",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void processData(final LayerLightEngine<?, ?> lightProvider, final boolean doSkylight, final boolean skipEdgeLightPropagation, final CallbackInfo ci)
|
||||
private void processData(final LightEngine<?, ?> lightProvider, final CallbackInfo ci)
|
||||
{
|
||||
// Process light removal
|
||||
|
||||
@@ -80,7 +82,7 @@ public abstract class LayerLightSectionStorage_scarpetChunkCreationMixin impleme
|
||||
|
||||
if (this.storingLightForSection(sectionPos))
|
||||
{
|
||||
this.clearQueuedSectionBlocks(lightProvider, sectionPos);
|
||||
((Lighting_scarpetChunkCreationInterface)lightProvider).clearQueuedSectionBlocksPublicAccess(sectionPos);
|
||||
|
||||
if (this.changedSections.add(sectionPos))
|
||||
this.updatingSectionData.copyDataLayer(sectionPos);
|
||||
@@ -108,7 +110,7 @@ public abstract class LayerLightSectionStorage_scarpetChunkCreationMixin impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processRelight(final LayerLightEngine<?, ?> lightProvider, final long pos)
|
||||
public void processRelight(final LightEngine<?, ?> lightProvider, final long pos)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import carpet.fakes.Lighting_scarpetChunkCreationInterface;
|
||||
import net.minecraft.world.level.lighting.LayerLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
@Mixin(LevelLightEngine.class)
|
||||
@@ -13,11 +13,11 @@ public abstract class LevelLightEngine_scarpetChunkCreationMixin implements Ligh
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private LayerLightEngine<?, ?> blockEngine;
|
||||
private LightEngine<?, ?> blockEngine;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private LayerLightEngine<?, ?> skyEngine;
|
||||
private LightEngine<?, ?> skyEngine;
|
||||
|
||||
@Override
|
||||
public void removeLightData(final long pos)
|
||||
|
||||
@@ -22,6 +22,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity
|
||||
@Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
|
||||
private boolean shouldLogDeaths(LivingEntity livingEntity)
|
||||
{
|
||||
return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
||||
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof Player)
|
||||
{
|
||||
Player self = (Player)(Object)(this);
|
||||
if (self.getAbilities().flying && ! onGround )
|
||||
if (self.getAbilities().flying && ! onGround() )
|
||||
return (float)(1.0-CarpetSettings.creativeFlyDrag);
|
||||
}
|
||||
return original;
|
||||
@@ -43,7 +43,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
||||
if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof Player)
|
||||
{
|
||||
Player self = (Player)(Object)(this);
|
||||
if (self.getAbilities().flying && !onGround)
|
||||
if (self.getAbilities().flying && !onGround())
|
||||
cir.setReturnValue( getFlyingSpeed() * (float)CarpetSettings.creativeFlySpeed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
||||
int maxEntityCramming =-1;
|
||||
if (CarpetSettings.maxEntityCollisions > 0)
|
||||
{
|
||||
maxEntityCramming = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
entities = ((LevelInterface) this.level).getOtherEntitiesLimited(
|
||||
maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
entities = ((LevelInterface) this.level()).getOtherEntitiesLimited(
|
||||
this,
|
||||
this.getBoundingBox(),
|
||||
EntitySelector.pushableBy(this),
|
||||
@@ -46,11 +46,11 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
||||
}
|
||||
else
|
||||
{
|
||||
entities = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
||||
entities = this.level().getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
||||
}
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
if (maxEntityCramming < 0) maxEntityCramming = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
if (maxEntityCramming < 0) maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) {
|
||||
int candidates = 0;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class MerchantResultSlot_scarpetEventMixin {
|
||||
target = "Lnet/minecraft/world/item/trading/Merchant;notifyTrade(Lnet/minecraft/world/item/trading/MerchantOffer;)V")
|
||||
)
|
||||
private void onTrade(Player player, ItemStack stack, CallbackInfo ci) {
|
||||
if(PLAYER_TRADES.isNeeded() && !player.level.isClientSide())
|
||||
if(PLAYER_TRADES.isNeeded() && !player.level().isClientSide())
|
||||
{
|
||||
PLAYER_TRADES.onTrade((ServerPlayer) player, merchant, slots.getActiveOffer());
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class Player_parrotMixin extends LivingEntity
|
||||
private void onTickMovement(CallbackInfo ci)
|
||||
{
|
||||
boolean parrots_will_drop = !CarpetSettings.persistentParrots || this.abilities.invulnerable;
|
||||
if (!this.level.isClientSide && ((parrots_will_drop && this.fallDistance > 0.5F) || this.isInWater() || this.abilities.flying || isSleeping()))
|
||||
if (!this.level().isClientSide && ((parrots_will_drop && this.fallDistance > 0.5F) || this.isInWater() || this.abilities.flying || isSleeping()))
|
||||
{
|
||||
this.removeEntitiesOnShoulder();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity
|
||||
@Inject(method = "touch", at = @At("HEAD"))
|
||||
private void onEntityCollision(Entity entity, CallbackInfo ci)
|
||||
{
|
||||
if (PLAYER_COLLIDES_WITH_ENTITY.isNeeded() && !level.isClientSide)
|
||||
if (PLAYER_COLLIDES_WITH_ENTITY.isNeeded() && !level().isClientSide)
|
||||
{
|
||||
PLAYER_COLLIDES_WITH_ENTITY.onEntityHandAction((ServerPlayer)(Object)this, entity, null);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity
|
||||
@Inject(method = "interactOn", cancellable = true, at = @At("HEAD"))
|
||||
private void doInteract(Entity entity, InteractionHand hand, CallbackInfoReturnable<InteractionResult> cir)
|
||||
{
|
||||
if (!level.isClientSide && PLAYER_INTERACTS_WITH_ENTITY.isNeeded())
|
||||
if (!level().isClientSide && PLAYER_INTERACTS_WITH_ENTITY.isNeeded())
|
||||
{
|
||||
if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) {
|
||||
cir.setReturnValue(InteractionResult.PASS);
|
||||
@@ -78,7 +78,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity
|
||||
@Inject(method = "attack", at = @At("HEAD"), cancellable = true)
|
||||
private void onAttack(Entity target, CallbackInfo ci)
|
||||
{
|
||||
if (!level.isClientSide && PLAYER_ATTACKS_ENTITY.isNeeded() && target.isAttackable())
|
||||
if (!level().isClientSide && PLAYER_ATTACKS_ENTITY.isNeeded() && target.isAttackable())
|
||||
{
|
||||
if(PLAYER_ATTACKS_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, target, null)) {
|
||||
ci.cancel();
|
||||
|
||||
@@ -72,11 +72,11 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac
|
||||
private void onExplode(CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__tnt && logHelper != null)
|
||||
logHelper.onExploded(getX(), getY(), getZ(), this.level.getGameTime());
|
||||
logHelper.onExploded(getX(), getY(), getZ(), this.level().getGameTime());
|
||||
|
||||
if (mergedTNT > 1)
|
||||
for (int i = 0; i < mergedTNT - 1; i++)
|
||||
this.level.explode(this, this.getX(), this.getY() + (double)(this.getBbHeight() / 16.0F),
|
||||
this.level().explode(this, this.getX(), this.getY() + (double)(this.getBbHeight() / 16.0F),
|
||||
this.getZ(),
|
||||
4.0F,
|
||||
Level.ExplosionInteraction.TNT);
|
||||
@@ -90,9 +90,9 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac
|
||||
// Merge code for combining tnt into a single entity if they happen to exist in the same spot, same fuse, no motion CARPET-XCOM
|
||||
if(CarpetSettings.mergeTNT){
|
||||
Vec3 velocity = getDeltaMovement();
|
||||
if(!level.isClientSide && mergeBool && velocity.x == 0 && velocity.y == 0 && velocity.z == 0){
|
||||
if(!level().isClientSide && mergeBool && velocity.x == 0 && velocity.y == 0 && velocity.z == 0){
|
||||
mergeBool = false;
|
||||
for(Entity entity : level.getEntities(this, this.getBoundingBox())){
|
||||
for(Entity entity : level().getEntities(this, this.getBoundingBox())){
|
||||
if(entity instanceof PrimedTnt && !entity.isRemoved()){
|
||||
PrimedTnt entityTNTPrimed = (PrimedTnt)entity;
|
||||
Vec3 tntVelocity = entityTNTPrimed.getDeltaMovement();
|
||||
@@ -113,7 +113,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac
|
||||
{
|
||||
// Merge code, merge only tnt that have had a chance to move CARPET-XCOM
|
||||
Vec3 velocity = getDeltaMovement();
|
||||
if(!level.isClientSide && (velocity.y != 0 || velocity.x != 0 || velocity.z != 0)){
|
||||
if(!level().isClientSide && (velocity.y != 0 || velocity.x != 0 || velocity.z != 0)){
|
||||
mergeBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ServerGamePacketListenerImplMixin
|
||||
// We should force onto the main thread here
|
||||
// ServerNetworkHandler.handleData can possibly mutate data that isn't
|
||||
// thread safe, and also allows for client commands to be executed
|
||||
PacketUtils.ensureRunningOnSameThread(packet, (ServerGamePacketListener) this, player.getLevel());
|
||||
PacketUtils.ensureRunningOnSameThread(packet, (ServerGamePacketListener) this, player.serverLevel());
|
||||
ServerNetworkHandler.handleData(packet.getData(), player);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
|
||||
private void logPreviousCoordinates(ServerLevel serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
previousLocation = position();
|
||||
previousDimension = level.dimension(); //dimension type
|
||||
previousDimension = level().dimension(); //dimension type
|
||||
}
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.chunk.DataLayer;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
import net.minecraft.world.level.lighting.BlockLightSectionStorage.BlockDataLayerStorageMap;
|
||||
import net.minecraft.world.level.lighting.LayerLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LayerLightSectionStorage;
|
||||
import net.minecraft.world.level.lighting.SkyLightSectionStorage;
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
||||
super(lightType, chunkProvider, lightData);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
/*@Shadow
|
||||
@Final
|
||||
private LongSet sectionsToAddSourcesTo;
|
||||
|
||||
@@ -37,10 +37,11 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
||||
@Shadow
|
||||
@Final
|
||||
private LongSet sectionsWithSources;
|
||||
*/
|
||||
|
||||
@Shadow protected abstract boolean isAboveData(final long pos);
|
||||
|
||||
@Shadow protected abstract boolean lightOnInSection(final long sectionPos);
|
||||
//@Shadow protected abstract boolean lightOnInSection(final long sectionPos);
|
||||
|
||||
@Override
|
||||
public void processRemoveLightData(final long cPos)
|
||||
@@ -48,16 +49,18 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
||||
for (int y = -1; y < 17; ++y)
|
||||
{
|
||||
final long sectionPos = SectionPos.asLong(SectionPos.x(cPos), y, SectionPos.z(cPos));
|
||||
|
||||
/* do something with this later
|
||||
this.sectionsToAddSourcesTo.remove(sectionPos);
|
||||
this.sectionsToRemoveSourcesFrom.remove(sectionPos);
|
||||
|
||||
this.sectionsWithSources.remove(sectionPos);
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processRelight(final LayerLightEngine<?, ?> lightProvider, final long cPos)
|
||||
public void processRelight(final LightEngine<?, ?> lightProvider, final long cPos)
|
||||
{
|
||||
final DynamicGraphMinFixedPoint_resetChunkInterface levelPropagator = (DynamicGraphMinFixedPoint_resetChunkInterface) lightProvider;
|
||||
|
||||
@@ -114,4 +117,10 @@ public abstract class SkyLightSectionStorage_scarpetChunkCreationMixin extends L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightLevelByLong(long blockPos)
|
||||
{
|
||||
return getLightValue(blockPos);
|
||||
}
|
||||
}
|
||||
+12
-4
@@ -35,6 +35,8 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
||||
@Final
|
||||
private ChunkMap chunkMap;
|
||||
|
||||
//@Shadow public abstract void propagateLightSources(final ChunkPos chunkPos);
|
||||
|
||||
@Override
|
||||
@Invoker("updateChunkStatus")
|
||||
public abstract void invokeUpdateChunkStatus(ChunkPos pos);
|
||||
@@ -46,7 +48,7 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
||||
chunk.setLightCorrect(false);
|
||||
|
||||
this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
super.enableLightSources(pos, false);
|
||||
super.setLightEnabled(pos, false);
|
||||
((Lighting_scarpetChunkCreationInterface) this).removeLightData(SectionPos.getZeroNode(SectionPos.asLong(pos.x, 0, pos.z)));
|
||||
},
|
||||
() -> "Remove light data " + pos
|
||||
@@ -58,8 +60,14 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
||||
{
|
||||
final ChunkPos pos = chunk.getPos();
|
||||
|
||||
this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
super.enableLightSources(pos, true);
|
||||
propagateLightSources(pos);
|
||||
/*this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
|
||||
super.setLightEnabled(pos, true);
|
||||
|
||||
chunk.findBlockLightSources((lightPos, state) -> {
|
||||
final int lightEmission = state.getLightEmission();
|
||||
enqueueIncrease(lightPos.asLong(), LightEngine.QueueEntry.increaseLightFromEmission(lightEmission, isEmptyShape(state)));
|
||||
});
|
||||
|
||||
chunk.getLights().forEach(
|
||||
blockPos -> super.onBlockEmissionIncrease(blockPos, chunk.getLightEmission(blockPos))
|
||||
@@ -68,7 +76,7 @@ public abstract class ThreadedLevelLightEngine_scarpetChunkCreationMixin extends
|
||||
((Lighting_scarpetChunkCreationInterface) this).relight(SectionPos.getZeroNode(SectionPos.asLong(pos.x, 0, pos.z)));
|
||||
},
|
||||
() -> "Relight chunk " + pos
|
||||
));
|
||||
));*/
|
||||
|
||||
return CompletableFuture.runAsync(
|
||||
Util.name(() -> {
|
||||
|
||||
@@ -16,7 +16,11 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
@Mixin(ThreadedLevelLightEngine.class)
|
||||
public abstract class ThreadedLevelLightEngine_scarpetMixin extends LevelLightEngine implements ServerLightingProviderInterface
|
||||
{
|
||||
@Shadow public abstract void checkBlock(BlockPos pos);
|
||||
//@Shadow public abstract void checkBlock(BlockPos pos);
|
||||
|
||||
//@Shadow public abstract void setLightEnabled(final ChunkPos chunkPos, final boolean bl);
|
||||
|
||||
//@Shadow public abstract void propagateLightSources(final ChunkPos chunkPos);
|
||||
|
||||
public ThreadedLevelLightEngine_scarpetMixin(LightChunkGetter chunkProvider, boolean hasBlockLight, boolean hasSkyLight)
|
||||
{
|
||||
@@ -34,18 +38,19 @@ public abstract class ThreadedLevelLightEngine_scarpetMixin extends LevelLightEn
|
||||
//ChunkPos pos = new ChunkPos(x, z);
|
||||
int j;
|
||||
for(j = -1; j < 17; ++j) { // skip some recomp
|
||||
super.queueSectionData(LightLayer.BLOCK, SectionPos.of(pos, j), new DataLayer(), false);
|
||||
super.queueSectionData(LightLayer.SKY, SectionPos.of(pos, j), new DataLayer(), false);
|
||||
super.queueSectionData(LightLayer.BLOCK, SectionPos.of(pos, j), new DataLayer());
|
||||
super.queueSectionData(LightLayer.SKY, SectionPos.of(pos, j), new DataLayer());
|
||||
}
|
||||
for(j = 0; j < 16; ++j) {
|
||||
super.updateSectionStatus(SectionPos.of(pos, j), true);
|
||||
}
|
||||
|
||||
super.enableLightSources(pos, true);
|
||||
setLightEnabled(pos, true);
|
||||
|
||||
chunk.getLights().forEach((blockPos) -> {
|
||||
super.onBlockEmissionIncrease(blockPos, chunk.getLightEmission(blockPos));
|
||||
});
|
||||
propagateLightSources(pos);
|
||||
// chunk.getLights().forEach((blockPos) -> {
|
||||
// super.onBlockEmissionIncrease(blockPos, chunk.getLightEmission(blockPos));
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class Villager_aiMixin extends AbstractVillager
|
||||
//boolean work = false;
|
||||
boolean sleep = false;
|
||||
boolean panic = this.brain.isActive(Activity.PANIC);
|
||||
long currentTime = this.level.getGameTime();
|
||||
long currentTime = this.level().getGameTime();
|
||||
if (optional_11.isPresent()) {
|
||||
sleep = (currentTime - optional_11.get()) < 24000L;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public abstract class Villager_aiMixin extends AbstractVillager
|
||||
if (itemStack_1.getItem() == Items.EMERALD)
|
||||
{
|
||||
GlobalPos bedPos = this.brain.getMemory(MemoryModuleType.HOME).orElse(null);
|
||||
if (bedPos == null || bedPos.dimension() != level.dimension()) // get Dimension
|
||||
if (bedPos == null || bedPos.dimension() != level().dimension()) // get Dimension
|
||||
{
|
||||
setUnhappy();
|
||||
((ServerLevel) getCommandSenderWorld()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, Blocks.BARRIER.defaultBlockState()), getX(), getY() + getEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
|
||||
|
||||
Reference in new issue
Block a user