25w44a
This commit is contained in:
1 parent
b0ea03d1c3
commit
461e64d34c
22 files changed
+81
-125
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check https://fabricmc.net/develop/
|
# check https://fabricmc.net/develop/
|
||||||
minecraft_version=25w43a
|
minecraft_version=25w44a
|
||||||
loader_version=0.17.3
|
loader_version=0.17.3
|
||||||
jsr305_version=3.0.2
|
jsr305_version=3.0.2
|
||||||
fabric_version=0.134.0+1.21.9
|
fabric_version=0.134.0+1.21.9
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import carpet.utils.SpawnOverrides;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.monster.Husk;
|
|
||||||
import net.minecraft.world.level.ServerLevelAccessor;
|
|
||||||
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
@Mixin(Husk.class)
|
|
||||||
public class Husk_templesMixin
|
|
||||||
{
|
|
||||||
@Redirect(method = "checkHuskSpawnRules", at = @At(value = "INVOKE", target="Lnet/minecraft/world/level/ServerLevelAccessor;canSeeSky(Lnet/minecraft/core/BlockPos;)Z"))
|
|
||||||
private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos)
|
|
||||||
{
|
|
||||||
return serverWorldAccess.canSeeSky(pos) ||
|
|
||||||
(CarpetSettings.huskSpawningInTemples && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,8 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.level.GameRules;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@@ -23,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity
|
|||||||
@Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
|
@Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
|
||||||
private boolean shouldLogDeaths(LivingEntity livingEntity)
|
private boolean shouldLogDeaths(LivingEntity livingEntity)
|
||||||
{
|
{
|
||||||
return livingEntity.hasCustomName() && livingEntity.level() instanceof ServerLevel serverLevel && CarpetSettings.cleanLogs && serverLevel.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
return livingEntity.hasCustomName() && livingEntity.level() instanceof ServerLevel serverLevel && CarpetSettings.cleanLogs && serverLevel.getGameRules().get(GameRules.SHOW_DEATH_MESSAGES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
|||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import carpet.fakes.LevelInterface;
|
import carpet.fakes.LevelInterface;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -14,7 +15,6 @@ import net.minecraft.world.entity.Entity;
|
|||||||
import net.minecraft.world.entity.EntitySelector;
|
import net.minecraft.world.entity.EntitySelector;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.level.GameRules;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
@Mixin(LivingEntity.class)
|
@Mixin(LivingEntity.class)
|
||||||
@@ -44,7 +44,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
|||||||
int maxEntityCramming =-1;
|
int maxEntityCramming =-1;
|
||||||
if (CarpetSettings.maxEntityCollisions > 0)
|
if (CarpetSettings.maxEntityCollisions > 0)
|
||||||
{
|
{
|
||||||
maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
maxEntityCramming = serverLevel.getGameRules().get(GameRules.MAX_ENTITY_CRAMMING);
|
||||||
entities = ((LevelInterface) serverLevel).getOtherEntitiesLimited(
|
entities = ((LevelInterface) serverLevel).getOtherEntitiesLimited(
|
||||||
this,
|
this,
|
||||||
this.getBoundingBox(),
|
this.getBoundingBox(),
|
||||||
@@ -57,7 +57,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!entities.isEmpty()) {
|
if (!entities.isEmpty()) {
|
||||||
if (maxEntityCramming < 0) maxEntityCramming = serverLevel.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
if (maxEntityCramming < 0) maxEntityCramming = serverLevel.getGameRules().get(GameRules.MAX_ENTITY_CRAMMING);
|
||||||
if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) {
|
if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) {
|
||||||
int candidates = 0;
|
int candidates = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import carpet.utils.SpawnOverrides;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
|
import net.minecraft.world.entity.EntitySpawnReason;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import net.minecraft.world.entity.monster.Monster;
|
||||||
|
import net.minecraft.world.level.ServerLevelAccessor;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(Monster.class)
|
||||||
|
public class Monster_templesMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "checkSurfaceMonstersSpawnRules", at = @At(value = "INVOKE", target="Lnet/minecraft/world/level/ServerLevelAccessor;canSeeSky(Lnet/minecraft/core/BlockPos;)Z"))
|
||||||
|
private static boolean isSkylightOrTempleVisible(ServerLevelAccessor serverWorldAccess, BlockPos pos,
|
||||||
|
EntityType<? extends Mob> entityType, ServerLevelAccessor serverLevelAccessor, EntitySpawnReason entitySpawnReason, BlockPos blockPos, RandomSource randomSource)
|
||||||
|
{
|
||||||
|
return serverWorldAccess.canSeeSky(pos) ||
|
||||||
|
(CarpetSettings.huskSpawningInTemples && entityType == EntityType.HUSK && SpawnOverrides.isStructureAtPosition((ServerLevel)serverWorldAccess, BuiltinStructures.DESERT_PYRAMID, pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,8 @@ import net.minecraft.world.entity.LightningBolt;
|
|||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.gamerules.GameRule;
|
||||||
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
@@ -66,8 +67,8 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
|
|||||||
if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerLevel) (Object)this, blockPos, bl2?1:0);
|
if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerLevel) (Object)this, blockPos, bl2?1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Explosion.BlockInteraction getCMDestroyType(final GameRules.Key<GameRules.BooleanValue> rule) {
|
private Explosion.BlockInteraction getCMDestroyType(final GameRule<Boolean> rule) {
|
||||||
return getGameRules().getBoolean(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY;
|
return getGameRules().get(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "explode", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "explode", at = @At("HEAD"), cancellable = true)
|
||||||
@@ -76,9 +77,9 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
|
|||||||
if (EXPLOSION.isNeeded()) {
|
if (EXPLOSION.isNeeded()) {
|
||||||
Explosion.BlockInteraction var10000 = switch (explosionInteraction) {
|
Explosion.BlockInteraction var10000 = switch (explosionInteraction) {
|
||||||
case NONE -> Explosion.BlockInteraction.KEEP;
|
case NONE -> Explosion.BlockInteraction.KEEP;
|
||||||
case BLOCK -> this.getCMDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY);
|
case BLOCK -> this.getCMDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
|
||||||
case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP;
|
case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING) ? this.getCMDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP;
|
||||||
case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY);
|
case TNT -> this.getCMDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
|
||||||
case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK;
|
case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import net.minecraft.world.entity.EntitySpawnReason;
|
|||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LightningBolt;
|
import net.minecraft.world.entity.LightningBolt;
|
||||||
import net.minecraft.world.entity.animal.horse.SkeletonHorse;
|
import net.minecraft.world.entity.animal.horse.SkeletonHorse;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@@ -30,7 +30,7 @@ public class SummonCommand_lightningMixin
|
|||||||
ServerLevel world = (ServerLevel) entity.level();
|
ServerLevel world = (ServerLevel) entity.level();
|
||||||
BlockPos at = entity.blockPosition();
|
BlockPos at = entity.blockPosition();
|
||||||
DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at);
|
DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at);
|
||||||
boolean boolean_2 = world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D;
|
boolean boolean_2 = world.getGameRules().get(GameRules.SPAWN_MOBS) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D;
|
||||||
if (boolean_2) {
|
if (boolean_2) {
|
||||||
SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT);
|
SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT);
|
||||||
skeletonHorseEntity_1.setTrap(true);
|
skeletonHorseEntity_1.setTrap(true);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
|||||||
import net.minecraft.commands.CommandBuildContext;
|
import net.minecraft.commands.CommandBuildContext;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -667,7 +667,7 @@ public class ScriptCommand
|
|||||||
BoundingBox area = BoundingBox.fromCorners(a, b);
|
BoundingBox area = BoundingBox.fromCorners(a, b);
|
||||||
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
|
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
|
||||||
int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); // X Y Z
|
int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan(); // X Y Z
|
||||||
if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
|
if (int_1 > source.getLevel().getGameRules().get(GameRules.MAX_BLOCK_MODIFICATIONS))
|
||||||
{
|
{
|
||||||
Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
|
Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -719,7 +719,7 @@ public class ScriptCommand
|
|||||||
BoundingBox area = BoundingBox.fromCorners(a, b);
|
BoundingBox area = BoundingBox.fromCorners(a, b);
|
||||||
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
|
CarpetExpression cexpr = new CarpetExpression(host.main, expr, source, origin);
|
||||||
int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan();
|
int int_1 = area.getXSpan() * area.getYSpan() * area.getZSpan();
|
||||||
if (int_1 > source.getLevel().getGameRules().getInt(GameRules.RULE_COMMAND_MODIFICATION_BLOCK_LIMIT))
|
if (int_1 > source.getLevel().getGameRules().get(GameRules.MAX_BLOCK_MODIFICATIONS))
|
||||||
{
|
{
|
||||||
Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
|
Carpet.Messenger_message(source, "r too many blocks to evaluate: " + int_1);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.annotation;
|
package carpet.script.annotation;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.api;
|
package carpet.script.api;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.argument;
|
package carpet.script.argument;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.command;
|
package carpet.script.command;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.exception;
|
package carpet.script.exception;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
+2
-7
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.external;
|
package carpet.script.external;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.language;
|
package carpet.script.language;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script;
|
package carpet.script;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -29,9 +29,9 @@ public class BiomeInfo
|
|||||||
put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature()));
|
put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature()));
|
||||||
// todo add per postion query for environmental attributes as well
|
// todo add per postion query for environmental attributes as well
|
||||||
put("fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.FOG_COLOR));
|
put("fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.FOG_COLOR));
|
||||||
put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor
|
put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().foliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor
|
||||||
put("sky_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.SKY_COLOR));
|
put("sky_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.SKY_COLOR));
|
||||||
put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getWaterColor()));
|
put("water_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().waterColor()));
|
||||||
put("water_fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.WATER_FOG_COLOR));
|
put("water_fog_color", (w, b) -> fromEnvironmentalAttribute(w, b, EnvironmentAttributes.WATER_FOG_COLOR));
|
||||||
put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall()));
|
put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall()));
|
||||||
put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT)));
|
put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT)));
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import carpet.script.value.ValueConversions;
|
|||||||
import com.sun.management.OperatingSystemMXBean;
|
import com.sun.management.OperatingSystemMXBean;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.server.packs.PackType;
|
import net.minecraft.server.packs.PackType;
|
||||||
import net.minecraft.world.level.GameRules;
|
import net.minecraft.world.level.gamerules.GameRule;
|
||||||
|
import net.minecraft.world.level.gamerules.GameRuleTypeVisitor;
|
||||||
|
import net.minecraft.world.level.gamerules.GameRules;
|
||||||
import net.minecraft.world.level.border.WorldBorder;
|
import net.minecraft.world.level.border.WorldBorder;
|
||||||
import net.minecraft.world.level.storage.LevelData;
|
import net.minecraft.world.level.storage.LevelData;
|
||||||
import net.minecraft.world.level.storage.LevelResource;
|
import net.minecraft.world.level.storage.LevelResource;
|
||||||
@@ -166,12 +168,15 @@ public class SystemInfo
|
|||||||
put("world_gamerules", c -> {
|
put("world_gamerules", c -> {
|
||||||
Map<Value, Value> rules = new HashMap<>();
|
Map<Value, Value> rules = new HashMap<>();
|
||||||
GameRules gameRules = c.level().getGameRules();
|
GameRules gameRules = c.level().getGameRules();
|
||||||
gameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor()
|
gameRules.visitGameRuleTypes(new GameRuleTypeVisitor()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> key, GameRules.Type<T> type)
|
public void visitBoolean(GameRule<Boolean> gameRule) {
|
||||||
{
|
rules.put(StringValue.of(gameRule.id()), BooleanValue.of(gameRules.get(gameRule)));
|
||||||
rules.put(StringValue.of(key.getId()), StringValue.of(gameRules.getRule(key).toString()));
|
}
|
||||||
|
@Override
|
||||||
|
public void visitInteger(GameRule<Integer> gameRule) {
|
||||||
|
rules.put(StringValue.of(gameRule.id()), NumericValue.of(gameRules.get(gameRule)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return MapValue.wrap(rules);
|
return MapValue.wrap(rules);
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.utils;
|
package carpet.script.utils;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.utils.shapes;
|
package carpet.script.utils.shapes;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
@ParametersAreNonnullByDefault
|
@NullMarked
|
||||||
@FieldsAreNonnullByDefault
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
package carpet.script.value;
|
package carpet.script.value;
|
||||||
|
import org.jspecify.annotations.NullMarked;
|
||||||
import net.minecraft.FieldsAreNonnullByDefault;
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
"SaplingBlock_desertShrubsMixin",
|
"SaplingBlock_desertShrubsMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"Guardian_renewableSpongesMixin",
|
"Guardian_renewableSpongesMixin",
|
||||||
"Husk_templesMixin",
|
"Monster_templesMixin",
|
||||||
"ChunkGenerator_customMobSpawnsMixin",
|
"ChunkGenerator_customMobSpawnsMixin",
|
||||||
"ServerChunkCacheMixin",
|
"ServerChunkCacheMixin",
|
||||||
"NaturalSpawnerMixin",
|
"NaturalSpawnerMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user