This commit is contained in:
gnembon committed 2023-04-20 22:13:32 +02:00
1 parent 97ab52a917
commit d68c252180
11 files changed
+23 -35

No files matched your search

+2 -2
View File
@@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check https://fabricmc.net/develop/
minecraft_version=23w14a
minecraft_version=23w16a
loader_version=0.14.19
jsr305_version=3.0.2
fabric_version=0.77.0+1.19.4
fabric_version=0.78.0+1.20
# Mod Properties
mod_version = 1.4.104
@@ -29,7 +29,6 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
@@ -99,13 +99,14 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
@Shadow
protected abstract boolean promoteChunkMap();
@Shadow
protected abstract CompletableFuture<Either<List<ChunkAccess>, ChunkLoadingFailure>> getChunkRangeFuture (final ChunkPos centerChunk, final int margin, final IntFunction<ChunkStatus> distanceToStatus);
@Shadow
protected abstract Iterable<ChunkHolder> getChunks();
@Shadow protected abstract CompletableFuture<Either<List<ChunkAccess>, ChunkLoadingFailure>> getChunkRangeFuture(final ChunkHolder chunkHolder, final int i, final IntFunction<ChunkStatus> intFunction);
//@Shadow protected abstract void postLoadProtoChunk(final ServerLevel serverLevel, final List<CompoundTag> list);
ThreadLocal<Boolean> generated = ThreadLocal.withInitial(() -> null);
// in protoChunkToFullChunk
@@ -289,7 +290,8 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
if (!(chunk.getStatus().isOrAfter(ChunkStatus.LIGHT.getParent()))) return;
((ServerLightingProviderInterface) this.lightEngine).removeLightData(chunk);
this.addRelightTicket(pos);
final CompletableFuture<?> lightFuture = this.getChunkRangeFuture (pos, 1, (pos_) -> ChunkStatus.LIGHT)
ChunkHolder chunkHolder = this.updatingChunkMap.get(pos.toLong());
final CompletableFuture<?> lightFuture = this.getChunkRangeFuture(chunkHolder, 1, (pos_) -> ChunkStatus.LIGHT)
.thenCompose(
either -> either.map(
list -> ((ServerLightingProviderInterface) this.lightEngine).relight(chunk),
@@ -414,7 +416,7 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
{
final ChunkPos pos = chunk.getPos();
lightFutures.add(this.getChunkRangeFuture (pos, 1, (pos_) -> ChunkStatus.LIGHT).thenCompose(
lightFutures.add(this.getChunkRangeFuture (this.updatingChunkMap.get(pos.toLong()), 1, (pos_) -> ChunkStatus.LIGHT).thenCompose(
either -> either.map(
list -> ((ServerLightingProviderInterface) this.lightEngine).relight(chunk),
unloaded -> {
@@ -19,7 +19,7 @@ public class FlowingFluid_liquidDamageDisabledMixin
method = "canHoldFluid",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/material/Material;blocksMotion()Z"
target = "Lnet/minecraft/world/level/block/state/BlockState;blocksMotion()Z"
),
cancellable = true
)
@@ -7,8 +7,8 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.Tier;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(PickaxeItem.class)
@@ -21,9 +21,10 @@ public class PickaxeItem_missingToolsMixin extends DiggerItem
@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
Material material = state.getMaterial();
if (CarpetSettings.missingTools && material == Material.GLASS)
return speed;
if (CarpetSettings.missingTools && state.getBlock().getSoundType(state) == SoundType.GLASS)
{
return speed;
}
return super.getDestroySpeed(stack, state);
}
}
@@ -8,13 +8,13 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SculkSensorBlockEntity.VibrationConfig.class)
@Mixin(SculkSensorBlockEntity.VibrationUser.class)
public class SculkSensorBlockEntityVibrationConfig_sculkSensorRangeMixin
{
@Inject(method = "getListenerRadius", at = @At("HEAD"), cancellable = true)
private void sculkSensorRange(CallbackInfoReturnable<Integer> cir)
{
if (CarpetSettings.sculkSensorRange != SculkSensorBlockEntity.VibrationConfig.LISTENER_RANGE) {
if (CarpetSettings.sculkSensorRange != SculkSensorBlockEntity.VibrationUser.LISTENER_RANGE) {
cir.setReturnValue(CarpetSettings.sculkSensorRange);
}
}
@@ -527,7 +527,7 @@ public class WorldAccess
booleanStateTest(c, "flammable", lv, (s, p) -> s.ignitedByLava()));
expression.addContextFunction("transparent", -1, (c, t, lv) ->
booleanStateTest(c, "transparent", lv, (s, p) -> !s.getMaterial().isSolid()));
booleanStateTest(c, "transparent", lv, (s, p) -> !s.isSolid()));
/*this.expr.addContextFunction("opacity", -1, (c, t, lv) ->
genericStateTest(c, "opacity", lv, (s, p, w) -> new NumericValue(s.getOpacity(w, p))));
@@ -1162,8 +1162,7 @@ public class WorldAccess
expression.addContextFunction("material", -1, (c, t, lv) -> {
c.host.issueDeprecation("material(...)"); // deprecated for block_state()
return stateStringQuery(c, "material", lv, (s, p) ->
Colors.materialName.getOrDefault(s.getMaterial(), "unknown"));
return StringValue.of("unknown");
});
expression.addContextFunction("map_colour", -1, (c, t, lv) ->
@@ -1,7 +1,6 @@
package carpet.script.utils;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import java.util.Map;
@@ -154,13 +153,4 @@ public class Colors
entry(MaterialColor.RAW_IRON , "raw_iron" ),
entry(MaterialColor.GLOW_LICHEN , "glow_lichen" )
);
public static final Map<Material, String> materialName = Map.ofEntries(
entry(Material.PLANT , "plant" ),
entry(Material.DEPRECATED_REPLACEABLE, "vegetation" ),
entry(Material.SAND , "sand" ),
entry(Material.WOOD , "wood" ),
entry(Material.GLASS , "glass" ),
entry(Material.STONE , "stone" )
);
}
@@ -45,7 +45,7 @@ public class SnoopyCommandSource extends CommandSourceStack
super(CommandSource.NULL, original.getPosition(), original.getRotation(), original.getLevel(), Vanilla.MinecraftServer_getRunPermissionLevel(original.getServer()),
original.getTextName(), original.getDisplayName(), original.getServer(), original.getEntity(), false,
(ctx, succ, res) -> {
}, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer()));
}, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(original.getServer()), i -> {});
this.output = CommandSource.NULL;
this.position = original.getPosition();
this.world = original.getLevel();
@@ -92,7 +92,7 @@ public class SnoopyCommandSource extends CommandSourceStack
{
super(output, pos, rot, world, level,
simpleName, name, server, entity, false,
consumer, entityAnchor, context, TaskChainer.immediate(server));
consumer, entityAnchor, context, TaskChainer.immediate(server), i -> {});
this.output = output;
this.position = pos;
this.rotation = rot;
+1 -5
View File
@@ -19,7 +19,6 @@ import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.Vec3;
@@ -28,7 +27,6 @@ public class BlockInfo
public static List<Component> blockInfo(BlockPos pos, ServerLevel world)
{
BlockState state = world.getBlockState(pos);
Material material = state.getMaterial();
Block block = state.getBlock();
String metastring = "";
final Registry<Block> blocks = world.registryAccess().registryOrThrow(Registries.BLOCK);
@@ -51,9 +49,8 @@ public class BlockInfo
Math.max(world.getBrightness(LightLayer.BLOCK, pos),world.getBrightness(LightLayer.SKY, pos)) ,
Math.max(world.getBrightness(LightLayer.BLOCK, pos.above()),world.getBrightness(LightLayer.SKY, pos.above())))));
lst.add(Messenger.s(String.format(" - Brightness in: %.2f, above: %.2f", world.getLightLevelDependentMagicValue(pos), world.getLightLevelDependentMagicValue(pos.above()))));
lst.add(Messenger.s(String.format(" - Is opaque: %s", material.isSolid() )));
lst.add(Messenger.s(String.format(" - Is opaque: %s", state.isSolid() )));
//lst.add(Messenger.s(String.format(" - Light opacity: %d", state.getOpacity(world,pos))));
lst.add(Messenger.s(String.format(" - Blocks light: %s", state.getMaterial().isSolidBlocking())));
//lst.add(Messenger.s(String.format(" - Emitted light: %d", state.getLightValue())));
//lst.add(Messenger.s(String.format(" - Picks neighbour light value: %s", state.useNeighborBrightness(world, pos))));
lst.add(Messenger.s(""));
@@ -62,7 +59,6 @@ public class BlockInfo
lst.add(Messenger.s(String.format(" - Blocks movement in air: %s", !state.isPathfindable(world,pos, PathComputationType.AIR))));
lst.add(Messenger.s(String.format(" - Blocks movement in liquids: %s", !state.isPathfindable(world,pos, PathComputationType.WATER))));
lst.add(Messenger.s(String.format(" - Can burn: %s", state.ignitedByLava())));
lst.add(Messenger.s(String.format(" - Requires a tool: %s", !material.isReplaceable()))); //?maybe
lst.add(Messenger.s(String.format(" - Hardness: %.2f", state.getDestroySpeed(world, pos))));
lst.add(Messenger.s(String.format(" - Blast resistance: %.2f", block.getExplosionResistance())));
lst.add(Messenger.s(String.format(" - Ticks randomly: %s", block.isRandomlyTicking(state))));
+1
View File
@@ -8,6 +8,7 @@ accessible class net/minecraft/world/level/border/WorldBorder$BorderExtent
accessible class net/minecraft/world/level/border/WorldBorder$StaticBorderExtent
accessible class net/minecraft/server/MinecraftServer$ReloadableResources
accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$VibrationUser
accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;