25w02a
This commit is contained in:
1 parent
d9c7334400
commit
b16eec89e7
34 files changed
+250
-298
No files matched your search
+3
-3
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check https://fabricmc.net/develop/
|
# check https://fabricmc.net/develop/
|
||||||
minecraft_version=1.21.4
|
minecraft_version=25w02a
|
||||||
loader_version=0.16.9
|
loader_version=0.16.10
|
||||||
jsr305_version=3.0.2
|
jsr305_version=3.0.2
|
||||||
fabric_version=0.110.5+1.21.4
|
fabric_version=0.110.5+1.21.4
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
|
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
|
||||||
# This is needed because CF uses too vague names for prereleases and release candidates
|
# This is needed because CF uses too vague names for prereleases and release candidates
|
||||||
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
|
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
|
||||||
release-curse-versions = Minecraft 1.21:1.21.4
|
release-curse-versions = Minecraft 1.21:1.21.5-Snapshot
|
||||||
# Whether or not to build another branch on release
|
# Whether or not to build another branch on release
|
||||||
release-extra-branch = false
|
release-extra-branch = false
|
||||||
# The name of the second branch to release
|
# The name of the second branch to release
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public class DrawCommand
|
|||||||
}
|
}
|
||||||
if (CarpetSettings.fillUpdates)
|
if (CarpetSettings.fillUpdates)
|
||||||
{
|
{
|
||||||
list.forEach(blockpos1 -> world.blockUpdated(blockpos1, world.getBlockState(blockpos1).getBlock()));
|
list.forEach(blockpos1 -> world.updateNeighborsAt(blockpos1, world.getBlockState(blockpos1).getBlock()));
|
||||||
}
|
}
|
||||||
Messenger.m(ctx.getSource(), "gi Filled " + affected + " blocks");
|
Messenger.m(ctx.getSource(), "gi Filled " + affected + " blocks");
|
||||||
return affected;
|
return affected;
|
||||||
@@ -290,7 +290,7 @@ public class DrawCommand
|
|||||||
|
|
||||||
if (CarpetSettings.fillUpdates)
|
if (CarpetSettings.fillUpdates)
|
||||||
{
|
{
|
||||||
list.forEach(p -> world.blockUpdated(p, world.getBlockState(p).getBlock()));
|
list.forEach(p -> world.updateNeighborsAt(p, world.getBlockState(p).getBlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Messenger.m(source, "gi Filled " + affected + " blocks");
|
Messenger.m(source, "gi Filled " + affected + " blocks");
|
||||||
@@ -389,7 +389,7 @@ public class DrawCommand
|
|||||||
|
|
||||||
for (BlockPos blockpos1 : list) {
|
for (BlockPos blockpos1 : list) {
|
||||||
Block blokc = world.getBlockState(blockpos1).getBlock();
|
Block blokc = world.getBlockState(blockpos1).getBlock();
|
||||||
world.blockUpdated(blockpos1, blokc);
|
world.updateNeighborsAt(blockpos1, blokc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +440,7 @@ public class DrawCommand
|
|||||||
|
|
||||||
for (BlockPos blockpos1 : list) {
|
for (BlockPos blockpos1 : list) {
|
||||||
Block blokc = world.getBlockState(blockpos1).getBlock();
|
Block blokc = world.getBlockState(blockpos1).getBlock();
|
||||||
world.blockUpdated(blockpos1, blokc);
|
world.updateNeighborsAt(blockpos1, blokc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package carpet.fakes;
|
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
|
||||||
import net.minecraft.server.level.ChunkHolder;
|
|
||||||
import net.minecraft.server.level.Ticket;
|
|
||||||
import net.minecraft.util.SortedArraySet;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
|
||||||
|
|
||||||
public interface ChunkTicketManagerInterface
|
|
||||||
{
|
|
||||||
void changeSpawnChunks(ChunkPos pos, int distance);
|
|
||||||
|
|
||||||
Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> getTicketsByPosition();
|
|
||||||
|
|
||||||
void replaceHolder(ChunkHolder oldHolder, ChunkHolder newHolder);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
import net.minecraft.server.level.Ticket;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TicketsFetcherInterface
|
||||||
|
{
|
||||||
|
Long2ObjectOpenHashMap<List<Ticket>> getTicketsByPosition();
|
||||||
|
}
|
||||||
@@ -6,5 +6,5 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||||||
|
|
||||||
public interface WorldChunkInterface
|
public interface WorldChunkInterface
|
||||||
{
|
{
|
||||||
BlockState setBlockStateWithBlockEntity(BlockPos blockPos, BlockState newBlockState, BlockEntity newBlockEntity, boolean boolean1);
|
BlockState setBlockStateWithBlockEntity(BlockPos blockPos, BlockState newBlockState, BlockEntity newBlockEntity, int flags);
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,10 @@ package carpet.mixins;
|
|||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.PickaxeItem;
|
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@@ -14,12 +14,8 @@ import net.minecraft.world.level.block.Block;
|
|||||||
import net.minecraft.world.level.block.BuddingAmethystBlock;
|
import net.minecraft.world.level.block.BuddingAmethystBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
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.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
@Mixin(BuddingAmethystBlock.class)
|
@Mixin(BuddingAmethystBlock.class)
|
||||||
public class BuddingAmethystBlock_movableAmethystMixin extends Block {
|
public class BuddingAmethystBlock_movableAmethystMixin extends Block {
|
||||||
@@ -33,7 +29,7 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block {
|
|||||||
// doing it here rather than though loottables since loottables are loaded on reload
|
// doing it here rather than though loottables since loottables are loaded on reload
|
||||||
// drawback - not controlled via loottables, but hey
|
// drawback - not controlled via loottables, but hey
|
||||||
if (CarpetSettings.movableAmethyst &&
|
if (CarpetSettings.movableAmethyst &&
|
||||||
stack.getItem() instanceof PickaxeItem &&
|
stack.is(ItemTags.PICKAXES) &&
|
||||||
EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH), stack) > 0
|
EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH), stack) > 0
|
||||||
)
|
)
|
||||||
popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance());
|
popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
|||||||
import carpet.utils.SpawnOverrides;
|
import carpet.utils.SpawnOverrides;
|
||||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.util.random.WeightedList;
|
||||||
import net.minecraft.world.level.StructureManager;
|
import net.minecraft.world.level.StructureManager;
|
||||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -11,7 +12,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.util.random.WeightedRandomList;
|
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||||
@@ -31,10 +31,10 @@ public abstract class ChunkGenerator_customMobSpawnsMixin
|
|||||||
target = "Ljava/util/Map$Entry;getKey()Ljava/lang/Object;"
|
target = "Ljava/util/Map$Entry;getKey()Ljava/lang/Object;"
|
||||||
), cancellable = true)
|
), cancellable = true)
|
||||||
private void checkCMSpawns(Holder<Biome> holder, StructureManager structureFeatureManager, MobCategory mobCategory, BlockPos blockPos,
|
private void checkCMSpawns(Holder<Biome> holder, StructureManager structureFeatureManager, MobCategory mobCategory, BlockPos blockPos,
|
||||||
CallbackInfoReturnable<WeightedRandomList<MobSpawnSettings.SpawnerData>> cir,
|
CallbackInfoReturnable<WeightedList<MobSpawnSettings.SpawnerData>> cir,
|
||||||
Map<Structure, LongSet> map, Iterator<?> var6, Map.Entry<Structure, LongSet> entry)
|
Map<Structure, LongSet> map, Iterator<?> var6, Map.Entry<Structure, LongSet> entry)
|
||||||
{
|
{
|
||||||
WeightedRandomList<MobSpawnSettings.SpawnerData> res = SpawnOverrides.test(structureFeatureManager, entry.getValue(), mobCategory, entry.getKey(), blockPos);
|
WeightedList<MobSpawnSettings.SpawnerData> res = SpawnOverrides.test(structureFeatureManager, entry.getValue(), mobCategory, entry.getKey(), blockPos);
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
cir.setReturnValue(res);
|
cir.setReturnValue(res);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import carpet.fakes.ChunkHolderInterface;
|
import carpet.fakes.ChunkHolderInterface;
|
||||||
import carpet.fakes.ChunkTicketManagerInterface;
|
|
||||||
import carpet.fakes.ServerLightingProviderInterface;
|
import carpet.fakes.ServerLightingProviderInterface;
|
||||||
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
|
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
|
||||||
import carpet.script.utils.WorldTools;
|
import carpet.script.utils.WorldTools;
|
||||||
@@ -165,7 +164,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
|
|||||||
this.world.getServer().execute(() -> CHUNK_LOADED.onChunkEvent(this.world, chpos, generated));
|
this.world.getServer().execute(() -> CHUNK_LOADED.onChunkEvent(this.world, chpos, generated));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private void addTicket(ChunkPos pos, ChunkStatus status)
|
private void addTicket(ChunkPos pos, ChunkStatus status)
|
||||||
@@ -180,7 +178,6 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Unique
|
@Unique
|
||||||
private void addRelightTicket(ChunkPos pos)
|
private void addRelightTicket(ChunkPos pos)
|
||||||
{
|
{
|
||||||
@@ -195,7 +192,7 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
|
|||||||
() -> "release relight ticket " + pos
|
() -> "release relight ticket " + pos
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
@Unique
|
@Unique
|
||||||
private void tickTicketManager()
|
private void tickTicketManager()
|
||||||
{
|
{
|
||||||
@@ -220,7 +217,7 @@ public abstract class ChunkMap_scarpetChunkCreationMixin implements ThreadedAnvi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Unique
|
@Unique
|
||||||
private Set<ChunkPos> loadExistingChunksFromDisk(Set<ChunkPos> requestedChunks)
|
private Set<ChunkPos> loadExistingChunksFromDisk(Set<ChunkPos> requestedChunks)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ public abstract class CloneCommands_fillUpdatesMixin
|
|||||||
{
|
{
|
||||||
@Redirect(method = "clone", at = @At(
|
@Redirect(method = "clone", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
||||||
))
|
))
|
||||||
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1);
|
if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import net.minecraft.server.level.ChunkHolder;
|
|
||||||
import net.minecraft.server.level.DistanceManager;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import carpet.fakes.ChunkTicketManagerInterface;
|
|
||||||
|
|
||||||
@Mixin(DistanceManager.class)
|
|
||||||
public abstract class DistanceManager_scarpetChunkCreationMixin implements ChunkTicketManagerInterface
|
|
||||||
{
|
|
||||||
@Shadow
|
|
||||||
@Final
|
|
||||||
private Set<ChunkHolder> chunksToUpdateFutures;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void replaceHolder(final ChunkHolder oldHolder, final ChunkHolder newHolder)
|
|
||||||
{
|
|
||||||
this.chunksToUpdateFutures.remove(oldHolder);
|
|
||||||
this.chunksToUpdateFutures.add(newHolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,25 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.fakes.ChunkTicketManagerInterface;
|
import carpet.fakes.TicketsFetcherInterface;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
import net.minecraft.server.level.DistanceManager;
|
import net.minecraft.server.level.DistanceManager;
|
||||||
import net.minecraft.server.level.Ticket;
|
import net.minecraft.server.level.Ticket;
|
||||||
import net.minecraft.util.SortedArraySet;
|
import net.minecraft.world.level.TicketStorage;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
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 java.util.List;
|
||||||
|
|
||||||
@Mixin(DistanceManager.class)
|
@Mixin(DistanceManager.class)
|
||||||
public abstract class DistanceManager_scarpetMixin implements ChunkTicketManagerInterface
|
public abstract class DistanceManager_scarpetMixin implements TicketsFetcherInterface
|
||||||
{
|
{
|
||||||
@Shadow @Final private Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> tickets;
|
@Shadow @Final private TicketStorage ticketStorage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> getTicketsByPosition()
|
public Long2ObjectOpenHashMap<List<Ticket>> getTicketsByPosition()
|
||||||
{
|
{
|
||||||
return tickets;
|
return ((TicketsFetcherInterface)ticketStorage).getTicketsByPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.fakes.ChunkTicketManagerInterface;
|
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
|
||||||
import net.minecraft.server.level.DistanceManager;
|
|
||||||
import net.minecraft.server.level.Ticket;
|
|
||||||
import net.minecraft.server.level.TicketType;
|
|
||||||
import net.minecraft.util.SortedArraySet;
|
|
||||||
import net.minecraft.util.Unit;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
@Mixin(DistanceManager.class)
|
|
||||||
public abstract class DistanceManager_spawnChunksMixin implements ChunkTicketManagerInterface
|
|
||||||
{
|
|
||||||
@Shadow @Final private Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> tickets;
|
|
||||||
|
|
||||||
@Shadow protected abstract void removeTicket(long pos, Ticket<?> ticket);
|
|
||||||
|
|
||||||
@Shadow public abstract <T> void addRegionTicket(TicketType<T> type, ChunkPos pos, int radius, T argument);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeSpawnChunks(ChunkPos chunkPos, int distance)
|
|
||||||
{
|
|
||||||
long pos = chunkPos.toLong();
|
|
||||||
SortedArraySet<Ticket<?>> set = tickets.get(pos);
|
|
||||||
Ticket<?> existingTicket = null;
|
|
||||||
if (set != null)
|
|
||||||
{
|
|
||||||
Iterator<Ticket<?>> iter = set.iterator();
|
|
||||||
while(iter.hasNext())
|
|
||||||
{
|
|
||||||
Ticket<?> ticket = iter.next();
|
|
||||||
if (ticket.getType() == TicketType.START)
|
|
||||||
{
|
|
||||||
existingTicket = ticket;
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set.add(existingTicket);
|
|
||||||
}
|
|
||||||
// the reason we are removing the ticket this way is that there are sideeffects of removal
|
|
||||||
if (existingTicket != null)
|
|
||||||
{
|
|
||||||
removeTicket(pos, existingTicket);
|
|
||||||
}
|
|
||||||
// set optionally new spawn ticket
|
|
||||||
if (distance > 0)
|
|
||||||
addRegionTicket(TicketType.START, chunkPos, distance, Unit.INSTANCE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,7 +32,7 @@ public abstract class EntityMixin implements EntityInterface
|
|||||||
return partialTicks == 1.0F ? this.yRot : Mth.lerp(partialTicks, this.yRotO, this.yRot);
|
return partialTicks == 1.0F ? this.yRot : Mth.lerp(partialTicks, this.yRotO, this.yRot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "isControlledByLocalInstance", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "isLocalInstanceAuthoritative", at = @At("HEAD"), cancellable = true)
|
||||||
private void isFakePlayer(CallbackInfoReturnable<Boolean> cir)
|
private void isFakePlayer(CallbackInfoReturnable<Boolean> cir)
|
||||||
{
|
{
|
||||||
if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide);
|
if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide);
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ public abstract class FillCommandMixin
|
|||||||
{
|
{
|
||||||
@Redirect(method = "fillBlocks", at = @At(
|
@Redirect(method = "fillBlocks", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
||||||
))
|
))
|
||||||
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1);
|
if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.component.Tool;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.SoundType;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Mixin(Item.class)
|
||||||
|
public class Item_missingToolsMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "getDestroySpeed", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void getDestroySpeed(ItemStack itemStack, BlockState blockState, CallbackInfoReturnable<Float> cir) {
|
||||||
|
if (CarpetSettings.missingTools && blockState.getSoundType() == SoundType.GLASS && itemStack.is(ItemTags.PICKAXES))
|
||||||
|
{
|
||||||
|
Tool tool = itemStack.get(DataComponents.TOOL);
|
||||||
|
if (tool != null) {
|
||||||
|
cir.setReturnValue(tool.getMiningSpeed(Blocks.STONE.defaultBlockState()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ package carpet.mixins;
|
|||||||
|
|
||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -25,20 +27,25 @@ public class LevelChunk_fillUpdatesMixin
|
|||||||
|
|
||||||
@Redirect(method = "setBlockState", at = @At(
|
@Redirect(method = "setBlockState", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/level/block/state/BlockState;onRemove(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V"
|
target = "Lnet/minecraft/world/level/block/entity/BlockEntity;preRemoveSideEffects(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V"
|
||||||
))
|
))
|
||||||
private void onRemovedBlock(BlockState blockState, Level world, BlockPos pos, BlockState state, boolean moved)
|
private void onPreRemoveSideEffects(BlockEntity blockEntity, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.impendingFillSkipUpdates.get()) // doing due dilligence from AbstractBlock onStateReplaced
|
if (!CarpetSettings.impendingFillSkipUpdates.get())
|
||||||
{
|
{
|
||||||
if (blockState.hasBlockEntity() && !blockState.is(state.getBlock()))
|
blockEntity.preRemoveSideEffects(blockPos_1, blockState_1, boolean_1);
|
||||||
{
|
|
||||||
world.removeBlockEntity(pos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
@Redirect(method = "setBlockState", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/level/block/state/BlockState;affectNeighborsAfterRemoval(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Z)V"
|
||||||
|
))
|
||||||
|
private void onAffectNeighborsAfterRemoval(final BlockState instance, final ServerLevel serverLevel, final BlockPos blockPos, final boolean b)
|
||||||
{
|
{
|
||||||
blockState.onRemove(world, pos, state, moved);
|
if (!CarpetSettings.impendingFillSkipUpdates.get())
|
||||||
|
{
|
||||||
|
instance.affectNeighborsAfterRemoval(serverLevel, blockPos, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,10 @@ import carpet.CarpetSettings;
|
|||||||
import carpet.fakes.WorldChunkInterface;
|
import carpet.fakes.WorldChunkInterface;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.SectionPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.util.profiling.Profiler;
|
||||||
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
@@ -19,6 +23,7 @@ import net.minecraft.world.level.chunk.LevelChunkSection;
|
|||||||
import net.minecraft.world.level.chunk.UpgradeData;
|
import net.minecraft.world.level.chunk.UpgradeData;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
||||||
|
import net.minecraft.world.level.lighting.LightEngine;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -74,72 +79,107 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W
|
|||||||
// todo update me to the new version
|
// todo update me to the new version
|
||||||
@Override
|
@Override
|
||||||
public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity,
|
public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity,
|
||||||
boolean boolean_1)
|
int flags)
|
||||||
{
|
{
|
||||||
int x = blockPos_1.getX() & 15;
|
boolean boolean_1 = (flags & 64) != 0;
|
||||||
int y = blockPos_1.getY();
|
int y = blockPos_1.getY();
|
||||||
int z = blockPos_1.getZ() & 15;
|
|
||||||
LevelChunkSection chunkSection = this.getSection(this.getSectionIndex(y));
|
LevelChunkSection chunkSection = this.getSection(this.getSectionIndex(y));
|
||||||
if (chunkSection.hasOnlyAir())
|
|
||||||
{
|
boolean hadOnlyAir = chunkSection.hasOnlyAir();
|
||||||
if (newBlockState.isAir())
|
|
||||||
|
if (hadOnlyAir && newBlockState.isAir())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
boolean boolean_2 = chunkSection.hasOnlyAir();
|
int x = blockPos_1.getX() & 15;
|
||||||
BlockState oldBlockState = chunkSection.setBlockState(x, y & 15, z, newBlockState);
|
int chunkY = blockPos_1.getY() & 15;
|
||||||
|
int z = blockPos_1.getZ() & 15;
|
||||||
|
BlockState oldBlockState = chunkSection.setBlockState(x, chunkY, z, newBlockState);
|
||||||
if (oldBlockState == newBlockState)
|
if (oldBlockState == newBlockState)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Block newBlock = newBlockState.getBlock();
|
Block newBlock = newBlockState.getBlock();
|
||||||
Block oldBlock = oldBlockState.getBlock();
|
this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING).update(x, y, z, newBlockState);
|
||||||
((Heightmap) this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING)).update(x, y, z, newBlockState);
|
this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES).update(x, y, z, newBlockState);
|
||||||
((Heightmap) this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES)).update(x, y, z, newBlockState);
|
this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR).update(x, y, z, newBlockState);
|
||||||
((Heightmap) this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR)).update(x, y, z, newBlockState);
|
this.heightmaps.get(Heightmap.Types.WORLD_SURFACE).update(x, y, z, newBlockState);
|
||||||
((Heightmap) this.heightmaps.get(Heightmap.Types.WORLD_SURFACE)).update(x, y, z, newBlockState);
|
boolean hasOnlyAir = chunkSection.hasOnlyAir();
|
||||||
boolean boolean_3 = chunkSection.hasOnlyAir();
|
if (hadOnlyAir != hasOnlyAir)
|
||||||
if (boolean_2 != boolean_3)
|
|
||||||
{
|
{
|
||||||
this.level.getChunkSource().getLightEngine().updateSectionStatus(blockPos_1, boolean_3);
|
this.level.getChunkSource().getLightEngine().updateSectionStatus(blockPos_1, hasOnlyAir);
|
||||||
|
this.level.getChunkSource().onSectionEmptinessChanged(chunkPos.x, SectionPos.blockToSectionCoord(y), chunkPos.z, hasOnlyAir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.level.isClientSide)
|
if (LightEngine.hasDifferentLightProperties(oldBlockState, newBlockState)) {
|
||||||
{
|
ProfilerFiller profiler = Profiler.get();
|
||||||
if (!(oldBlock instanceof MovingPistonBlock))//this is a movableTE special case, if condition wasn't there it would remove the blockentity that was carried for some reason
|
profiler.push("updateSkyLightSources");
|
||||||
oldBlockState.onRemove(this.level, blockPos_1, newBlockState, boolean_1);//this kills it
|
skyLightSources.update(this, x, chunkY, z);
|
||||||
}
|
profiler.popPush("queueCheckLight");
|
||||||
else if (oldBlock != newBlock && oldBlock instanceof EntityBlock)
|
level.getChunkSource().getLightEngine().checkBlock(blockPos_1);
|
||||||
{
|
profiler.pop();
|
||||||
this.level.removeBlockEntity(blockPos_1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunkSection.getBlockState(x, y & 15, z).getBlock() != newBlock)
|
boolean hadBlockEntity = oldBlockState.hasBlockEntity();
|
||||||
|
boolean blockChanged = !oldBlockState.is(newBlock);
|
||||||
|
|
||||||
|
boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0;
|
||||||
|
|
||||||
|
if (blockChanged) {
|
||||||
|
if (level instanceof ServerLevel serverLevel && !(oldBlockState.getBlock() instanceof MovingPistonBlock)) {
|
||||||
|
if (hadBlockEntity && sideEffects) {
|
||||||
|
final BlockEntity blockEntity = level.getBlockEntity(blockPos_1);
|
||||||
|
if (blockEntity != null) {
|
||||||
|
blockEntity.preRemoveSideEffects(blockPos_1, oldBlockState, boolean_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hadBlockEntity) {
|
||||||
|
removeBlockEntity(blockPos_1);
|
||||||
|
}
|
||||||
|
if ((flags & Block.UPDATE_NEIGHBORS) != 0) { // scary change // so many other places that used to call this regardless if the UPDATE_NEIGHBORS flag was set
|
||||||
|
oldBlockState.affectNeighborsAfterRemoval(serverLevel, blockPos_1, boolean_1);
|
||||||
|
}
|
||||||
|
} else if (hadBlockEntity) {
|
||||||
|
removeBlockEntity(blockPos_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (chunkSection.getBlockState(x, chunkY, z).getBlock() != newBlock)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (!level.isClientSide && sideEffects) {
|
||||||
|
// this updates stuff, schedule ticks - do we want that since its only be called from MovingPistonBlock really?
|
||||||
|
newBlockState.onPlace(level, blockPos_1, oldBlockState, boolean_1);
|
||||||
|
}
|
||||||
|
|
||||||
BlockEntity oldBlockEntity = null;
|
BlockEntity oldBlockEntity = null;
|
||||||
if (oldBlockState.hasBlockEntity())
|
if (oldBlockState.hasBlockEntity())
|
||||||
{
|
{
|
||||||
oldBlockEntity = this.getBlockEntity(blockPos_1, LevelChunk.EntityCreationType.CHECK);
|
oldBlockEntity = this.getBlockEntity(blockPos_1, LevelChunk.EntityCreationType.CHECK);
|
||||||
if (oldBlockEntity != null)
|
if (oldBlockEntity != null && !oldBlockEntity.isValidBlockState(oldBlockState))
|
||||||
{
|
{
|
||||||
oldBlockEntity.setBlockState(oldBlockState);
|
oldBlockEntity.setBlockState(oldBlockState);
|
||||||
updateBlockEntityTicker(oldBlockEntity);
|
updateBlockEntityTicker(oldBlockEntity);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if (oldBlockState.hasBlockEntity())
|
|
||||||
{
|
{
|
||||||
if (newBlockEntity == null)
|
if (newBlockEntity == null)
|
||||||
{
|
{
|
||||||
newBlockEntity = ((EntityBlock) newBlock).newBlockEntity(blockPos_1, newBlockState);
|
newBlockEntity = ((EntityBlock) newBlock).newBlockEntity(blockPos_1, newBlockState);
|
||||||
|
if (newBlockEntity != null)
|
||||||
|
{
|
||||||
|
addAndRegisterBlockEntity(newBlockEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newBlockEntity != oldBlockEntity && newBlockEntity != null)
|
if (newBlockEntity != oldBlockEntity && newBlockEntity != null)
|
||||||
{
|
{
|
||||||
@@ -149,15 +189,9 @@ public abstract class LevelChunk_movableBEMixin extends ChunkAccess implements W
|
|||||||
updateBlockEntityTicker(newBlockEntity);
|
updateBlockEntityTicker(newBlockEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.level.isClientSide)
|
|
||||||
{
|
|
||||||
newBlockState.onPlace(this.level, blockPos_1, oldBlockState, boolean_1); //This can call setblockstate! (e.g. hopper does)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
markUnsaved();
|
markUnsaved();
|
||||||
return oldBlockState;
|
return oldBlockState;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -23,11 +23,11 @@ public abstract class Level_fillUpdatesMixin
|
|||||||
|
|
||||||
@Redirect(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At( //setBlockState main
|
@Redirect(method = "setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;II)Z", at = @At( //setBlockState main
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/level/Level;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
target = "Lnet/minecraft/world/level/Level;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
||||||
))
|
))
|
||||||
private void updateNeighborsMaybe(Level world, BlockPos blockPos, Block block)
|
private void updateNeighborsMaybe(Level world, BlockPos blockPos, Block block)
|
||||||
{
|
{
|
||||||
if (!CarpetSettings.impendingFillSkipUpdates.get()) world.blockUpdated(blockPos, block);
|
if (!CarpetSettings.impendingFillSkipUpdates.get()) world.updateNeighborsAt(blockPos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,16 +34,12 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract void sendBlockUpdated(BlockPos var1, BlockState var2, BlockState var3, int var4);
|
public abstract void sendBlockUpdated(BlockPos var1, BlockState var2, BlockState var3, int var4);
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public abstract void updateNeighborsAt(BlockPos blockPos_1, Block block_1);
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public abstract void onBlockStateChange(BlockPos blockPos_1, BlockState blockState_1, BlockState blockState_2);
|
|
||||||
|
|
||||||
@Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block);
|
@Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block);
|
||||||
|
|
||||||
@Shadow public abstract boolean isDebug();
|
@Shadow public abstract boolean isDebug();
|
||||||
|
|
||||||
|
@Shadow public abstract void updatePOIOnBlockStateChange(final BlockPos blockPos, final BlockState blockState, final BlockState blockState2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 2No2Name
|
* @author 2No2Name
|
||||||
*/
|
*/
|
||||||
@@ -57,7 +53,7 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
|||||||
BlockState blockState_2;
|
BlockState blockState_2;
|
||||||
if (newBlockEntity != null && block_1 instanceof EntityBlock)
|
if (newBlockEntity != null && block_1 instanceof EntityBlock)
|
||||||
{
|
{
|
||||||
blockState_2 = ((WorldChunkInterface) worldChunk_1).setBlockStateWithBlockEntity(blockPos_1, blockState_1, newBlockEntity, (int_1 & 64) != 0);
|
blockState_2 = ((WorldChunkInterface) worldChunk_1).setBlockStateWithBlockEntity(blockPos_1, blockState_1, newBlockEntity, int_1);
|
||||||
if (newBlockEntity instanceof LidBlockEntity)
|
if (newBlockEntity instanceof LidBlockEntity)
|
||||||
{
|
{
|
||||||
scheduleTick(blockPos_1, block_1, 5);
|
scheduleTick(blockPos_1, block_1, 5);
|
||||||
@@ -65,24 +61,15 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
blockState_2 = worldChunk_1.setBlockState(blockPos_1, blockState_1, (int_1 & 64) != 0);
|
blockState_2 = worldChunk_1.setBlockState(blockPos_1, blockState_1, int_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockState_2 == null)
|
if (blockState_2 == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
BlockState blockState_3 = this.getBlockState(blockPos_1);
|
|
||||||
|
|
||||||
if (blockState_3 != blockState_2 && (blockState_3.getLightBlock() != blockState_2.getLightBlock() || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion()))
|
BlockState blockState_3 = this.getBlockState(blockPos_1);
|
||||||
{
|
|
||||||
ProfilerFiller profiler = Profiler.get();
|
|
||||||
profiler.push("queueCheckLight");
|
|
||||||
this.getChunkSource().getLightEngine().checkBlock(blockPos_1);
|
|
||||||
profiler.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blockState_3 == blockState_1)
|
if (blockState_3 == blockState_1)
|
||||||
{
|
{
|
||||||
@@ -112,9 +99,8 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
|||||||
blockState_1.updateNeighbourShapes(this, blockPos_1, int_2); // updateNeighbours
|
blockState_1.updateNeighbourShapes(this, blockPos_1, int_2); // updateNeighbours
|
||||||
blockState_1.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare
|
blockState_1.updateIndirectNeighbourShapes(this, blockPos_1, int_2); // prepare
|
||||||
}
|
}
|
||||||
this.onBlockStateChange(blockPos_1, blockState_2, blockState_3);
|
updatePOIOnBlockStateChange(blockPos_1, blockState_2, blockState_3);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import net.minecraft.core.component.DataComponents;
|
|
||||||
import net.minecraft.tags.TagKey;
|
|
||||||
import net.minecraft.world.item.DiggerItem;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.PickaxeItem;
|
|
||||||
import net.minecraft.world.item.ToolMaterial;
|
|
||||||
import net.minecraft.world.item.component.Tool;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.SoundType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
|
|
||||||
@Mixin(PickaxeItem.class)
|
|
||||||
public class PickaxeItem_missingToolsMixin extends DiggerItem
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
protected PickaxeItem_missingToolsMixin(final ToolMaterial toolMaterial, final TagKey<Block> tagKey, final float f, final float g, final Properties properties)
|
|
||||||
{
|
|
||||||
super(toolMaterial, tagKey, f, g, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getDestroySpeed(ItemStack stack, BlockState state) {
|
|
||||||
if (CarpetSettings.missingTools && state.getSoundType() == SoundType.GLASS)
|
|
||||||
{
|
|
||||||
final Tool tool = stack.get(DataComponents.TOOL);
|
|
||||||
return tool != null ? tool.getMiningSpeed(Blocks.STONE.defaultBlockState()) : super.getDestroySpeed(stack, state);
|
|
||||||
}
|
|
||||||
return super.getDestroySpeed(stack, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -119,7 +119,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
|
|||||||
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
|
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
|
@Redirect(method = "affectNeighborsAfterRemoval", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;Z)V"))
|
||||||
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
|
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o, boolean sup) {
|
||||||
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
|
fastUpdate(world_1, blockPos_1, blockState_1, o, sup);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ public class SetBlockCommand_fillUpdatesMixin
|
|||||||
{
|
{
|
||||||
@Redirect(method = "setBlock", at = @At(
|
@Redirect(method = "setBlock", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/level/ServerLevel;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
target = "Lnet/minecraft/server/level/ServerLevel;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
||||||
))
|
))
|
||||||
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
private static void conditionalUpdating(ServerLevel serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.fillUpdates) serverWorld.blockUpdated(blockPos_1, block_1);
|
if (CarpetSettings.fillUpdates) serverWorld.updateNeighborsAt(blockPos_1, block_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,12 +15,12 @@ public class StructureTemplate_fillUpdatesMixin
|
|||||||
{
|
{
|
||||||
@Redirect( method = "placeInWorld", at = @At(
|
@Redirect( method = "placeInWorld", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/level/ServerLevelAccessor;blockUpdated(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
target = "Lnet/minecraft/world/level/ServerLevelAccessor;updateNeighborsAt(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;)V"
|
||||||
))
|
))
|
||||||
private void skipUpdateNeighbours(ServerLevelAccessor serverWorldAccess, BlockPos pos, Block block)
|
private void skipUpdateNeighbours(ServerLevelAccessor serverWorldAccess, BlockPos pos, Block block)
|
||||||
{
|
{
|
||||||
if (!CarpetSettings.impendingFillSkipUpdates.get())
|
if (!CarpetSettings.impendingFillSkipUpdates.get())
|
||||||
serverWorldAccess.blockUpdated(pos, block);
|
serverWorldAccess.updateNeighborsAt(pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "placeInWorld", at = @At(
|
@Redirect(method = "placeInWorld", at = @At(
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.TicketsFetcherInterface;
|
||||||
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
|
import net.minecraft.server.level.Ticket;
|
||||||
|
import net.minecraft.world.level.TicketStorage;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mixin(TicketStorage.class)
|
||||||
|
public class TicketStorage_scarpetMixin implements TicketsFetcherInterface
|
||||||
|
{
|
||||||
|
@Shadow @Final private Long2ObjectOpenHashMap<List<Ticket>> tickets;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long2ObjectOpenHashMap<List<Ticket>> getTicketsByPosition()
|
||||||
|
{
|
||||||
|
return tickets;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -675,10 +675,7 @@ public class ScriptCommand
|
|||||||
if (replacement == null || replacement.test(
|
if (replacement == null || replacement.test(
|
||||||
new BlockInWorld(world, mbpos, true)))
|
new BlockInWorld(world, mbpos, true)))
|
||||||
{
|
{
|
||||||
BlockEntity tileentity = world.getBlockEntity(mbpos);
|
if (block.place(world, mbpos, 2 & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS))
|
||||||
Clearable.tryClear(tileentity);
|
|
||||||
|
|
||||||
if (block.place(world, mbpos, 2))
|
|
||||||
{
|
{
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
@@ -701,7 +698,7 @@ public class ScriptCommand
|
|||||||
{
|
{
|
||||||
mbpos.set(x + area.minX(), y + area.minY(), z + area.minZ());
|
mbpos.set(x + area.minX(), y + area.minY(), z + area.minZ());
|
||||||
Block blokc = world.getBlockState(mbpos).getBlock();
|
Block blokc = world.getBlockState(mbpos).getBlock();
|
||||||
world.blockUpdated(mbpos, blokc);
|
world.updateNeighborsAt(mbpos, blokc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||||||
import net.minecraft.server.level.Ticket;
|
import net.minecraft.server.level.Ticket;
|
||||||
import net.minecraft.server.level.TicketType;
|
import net.minecraft.server.level.TicketType;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.level.ServerExplosion;
|
import net.minecraft.world.level.ServerExplosion;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
@@ -99,12 +100,10 @@ import net.minecraft.world.entity.ai.village.poi.PoiRecord;
|
|||||||
import net.minecraft.world.entity.ai.village.poi.PoiType;
|
import net.minecraft.world.entity.ai.village.poi.PoiType;
|
||||||
import net.minecraft.world.entity.item.FallingBlockEntity;
|
import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.DiggerItem;
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.ShearsItem;
|
import net.minecraft.world.item.ShearsItem;
|
||||||
import net.minecraft.world.item.SwordItem;
|
|
||||||
import net.minecraft.world.item.TridentItem;
|
import net.minecraft.world.item.TridentItem;
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
@@ -149,7 +148,7 @@ public class WorldAccess
|
|||||||
DIRECTION_MAP.put("x", Direction.EAST);
|
DIRECTION_MAP.put("x", Direction.EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<String, TicketType<?>> ticketTypes = Map.of(
|
private static final Map<String, TicketType> ticketTypes = Map.of(
|
||||||
"portal", TicketType.PORTAL,
|
"portal", TicketType.PORTAL,
|
||||||
"teleport", TicketType.ENDER_PEARL,
|
"teleport", TicketType.ENDER_PEARL,
|
||||||
"unknown", TicketType.UNKNOWN
|
"unknown", TicketType.UNKNOWN
|
||||||
@@ -646,7 +645,7 @@ public class WorldAccess
|
|||||||
{
|
{
|
||||||
ServerLevel world = ((CarpetContext) c).level();
|
ServerLevel world = ((CarpetContext) c).level();
|
||||||
DistanceManager foo = world.getChunkSource().chunkMap.getDistanceManager();
|
DistanceManager foo = world.getChunkSource().chunkMap.getDistanceManager();
|
||||||
Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> levelTickets = Vanilla.ChunkTicketManager_getTicketsByPosition(foo);
|
Long2ObjectOpenHashMap<List<Ticket>> levelTickets = Vanilla.ChunkTicketManager_getTicketsByPosition(foo);
|
||||||
|
|
||||||
List<Value> res = new ArrayList<>();
|
List<Value> res = new ArrayList<>();
|
||||||
if (lv.isEmpty())
|
if (lv.isEmpty())
|
||||||
@@ -654,7 +653,7 @@ public class WorldAccess
|
|||||||
for (long key : levelTickets.keySet())
|
for (long key : levelTickets.keySet())
|
||||||
{
|
{
|
||||||
ChunkPos chpos = new ChunkPos(key);
|
ChunkPos chpos = new ChunkPos(key);
|
||||||
for (Ticket<?> ticket : levelTickets.get(key))
|
for (Ticket ticket : levelTickets.get(key))
|
||||||
{
|
{
|
||||||
res.add(ListValue.of(
|
res.add(ListValue.of(
|
||||||
new StringValue(ticket.getType().toString()),
|
new StringValue(ticket.getType().toString()),
|
||||||
@@ -669,10 +668,10 @@ public class WorldAccess
|
|||||||
{
|
{
|
||||||
BlockArgument blockArgument = BlockArgument.findIn((CarpetContext) c, lv, 0);
|
BlockArgument blockArgument = BlockArgument.findIn((CarpetContext) c, lv, 0);
|
||||||
BlockPos pos = blockArgument.block.getPos();
|
BlockPos pos = blockArgument.block.getPos();
|
||||||
SortedArraySet<Ticket<?>> tickets = levelTickets.get(new ChunkPos(pos).toLong());
|
List<Ticket> tickets = levelTickets.get(new ChunkPos(pos).toLong());
|
||||||
if (tickets != null)
|
if (tickets != null)
|
||||||
{
|
{
|
||||||
for (Ticket<?> ticket : tickets)
|
for (Ticket ticket : tickets)
|
||||||
{
|
{
|
||||||
res.add(ListValue.of(
|
res.add(ListValue.of(
|
||||||
new StringValue(ticket.getType().toString()),
|
new StringValue(ticket.getType().toString()),
|
||||||
@@ -819,8 +818,7 @@ public class WorldAccess
|
|||||||
Boolean[] result = new Boolean[]{true};
|
Boolean[] result = new Boolean[]{true};
|
||||||
cc.server().executeBlocking(() ->
|
cc.server().executeBlocking(() ->
|
||||||
{
|
{
|
||||||
Clearable.tryClear(world.getBlockEntity(targetPos));
|
boolean success = world.setBlock(targetPos, finalSourceBlockState, Block.UPDATE_CLIENTS | Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS );
|
||||||
boolean success = world.setBlock(targetPos, finalSourceBlockState, 2);
|
|
||||||
if (finalData != null)
|
if (finalData != null)
|
||||||
{
|
{
|
||||||
BlockEntity be = world.getBlockEntity(targetPos);
|
BlockEntity be = world.getBlockEntity(targetPos);
|
||||||
@@ -914,11 +912,11 @@ public class WorldAccess
|
|||||||
//postMine() durability from item classes
|
//postMine() durability from item classes
|
||||||
float hardness = state.getDestroySpeed(world, where);
|
float hardness = state.getDestroySpeed(world, where);
|
||||||
int damageAmount = 0;
|
int damageAmount = 0;
|
||||||
if ((item instanceof DiggerItem && hardness > 0.0) || item instanceof ShearsItem)
|
if ((tool.is(ItemTags.PICKAXES) && hardness > 0.0) || item instanceof ShearsItem)
|
||||||
{
|
{
|
||||||
damageAmount = 1;
|
damageAmount = 1;
|
||||||
}
|
}
|
||||||
else if (item instanceof TridentItem || item instanceof SwordItem)
|
else if (item instanceof TridentItem || tool.is(ItemTags.SWORDS))
|
||||||
{
|
{
|
||||||
damageAmount = 2;
|
damageAmount = 2;
|
||||||
}
|
}
|
||||||
@@ -1678,7 +1676,7 @@ public class WorldAccess
|
|||||||
throw new InternalExpressionException("'add_chunk_ticket' requires block position, ticket type and radius");
|
throw new InternalExpressionException("'add_chunk_ticket' requires block position, ticket type and radius");
|
||||||
}
|
}
|
||||||
String type = lv.get(locator.offset).getString();
|
String type = lv.get(locator.offset).getString();
|
||||||
TicketType<?> ticket = ticketTypes.get(type.toLowerCase(Locale.ROOT));
|
TicketType ticket = ticketTypes.get(type.toLowerCase(Locale.ROOT));
|
||||||
if (ticket == null)
|
if (ticket == null)
|
||||||
{
|
{
|
||||||
throw new InternalExpressionException("Unknown ticket type: " + type);
|
throw new InternalExpressionException("Unknown ticket type: " + type);
|
||||||
@@ -1692,15 +1690,15 @@ public class WorldAccess
|
|||||||
ChunkPos target = new ChunkPos(pos);
|
ChunkPos target = new ChunkPos(pos);
|
||||||
if (ticket == TicketType.PORTAL) // portal
|
if (ticket == TicketType.PORTAL) // portal
|
||||||
{
|
{
|
||||||
cc.level().getChunkSource().addRegionTicket(TicketType.PORTAL, target, radius, pos);
|
cc.level().getChunkSource().addTicketWithRadius(TicketType.PORTAL, target, radius);
|
||||||
}
|
}
|
||||||
else if (ticket == TicketType.ENDER_PEARL) // post teleport
|
else if (ticket == TicketType.ENDER_PEARL) // post teleport
|
||||||
{
|
{
|
||||||
cc.level().getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, target, radius, target);
|
cc.level().getChunkSource().addTicketWithRadius(TicketType.ENDER_PEARL, target, radius);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cc.level().getChunkSource().addRegionTicket(TicketType.UNKNOWN, target, radius, target);
|
cc.level().getChunkSource().addTicketWithRadius(TicketType.UNKNOWN, target, radius);
|
||||||
}
|
}
|
||||||
return new NumericValue(ticket.timeout());
|
return new NumericValue(ticket.timeout());
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@ import carpet.CarpetSettings;
|
|||||||
import carpet.fakes.BiomeInterface;
|
import carpet.fakes.BiomeInterface;
|
||||||
import carpet.fakes.BlockPredicateInterface;
|
import carpet.fakes.BlockPredicateInterface;
|
||||||
import carpet.fakes.BlockStateArgumentInterface;
|
import carpet.fakes.BlockStateArgumentInterface;
|
||||||
import carpet.fakes.ChunkTicketManagerInterface;
|
import carpet.fakes.TicketsFetcherInterface;
|
||||||
import carpet.fakes.CommandDispatcherInterface;
|
import carpet.fakes.CommandDispatcherInterface;
|
||||||
import carpet.fakes.EntityInterface;
|
import carpet.fakes.EntityInterface;
|
||||||
import carpet.fakes.InventoryBearerInterface;
|
import carpet.fakes.InventoryBearerInterface;
|
||||||
@@ -122,9 +122,9 @@ public class Vanilla
|
|||||||
return ((ServerWorldInterface) world).getWorldPropertiesCM();
|
return ((ServerWorldInterface) world).getWorldPropertiesCM();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> ChunkTicketManager_getTicketsByPosition(DistanceManager ticketManager)
|
public static Long2ObjectOpenHashMap<List<Ticket>> ChunkTicketManager_getTicketsByPosition(DistanceManager ticketManager)
|
||||||
{
|
{
|
||||||
return ((ChunkTicketManagerInterface) ticketManager).getTicketsByPosition();
|
return ((TicketsFetcherInterface) ticketManager).getTicketsByPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DensityFunction.Visitor RandomState_getVisitor(RandomState randomState)
|
public static DensityFunction.Visitor RandomState_getVisitor(RandomState randomState)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class EntityTools
|
|||||||
*/
|
*/
|
||||||
public static void genericJump(Entity e)
|
public static void genericJump(Entity e)
|
||||||
{
|
{
|
||||||
if (!e.onGround() && !e.isInWaterOrBubble() && !e.isInLava())
|
if (!e.onGround() && !e.isInLiquid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.minecraft.world.phys.Vec3;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -147,11 +148,11 @@ public class Messenger
|
|||||||
Style previousStyle = previousMessage.getStyle();
|
Style previousStyle = previousMessage.getStyle();
|
||||||
MutableComponent ret = previousMessage;
|
MutableComponent ret = previousMessage;
|
||||||
previousMessage.setStyle(switch (desc.charAt(0)) {
|
previousMessage.setStyle(switch (desc.charAt(0)) {
|
||||||
case '?' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message.substring(1)));
|
case '?' -> previousStyle.withClickEvent(new ClickEvent.SuggestCommand(message.substring(1)));
|
||||||
case '!' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, message.substring(1)));
|
case '!' -> previousStyle.withClickEvent(new ClickEvent.RunCommand(message.substring(1)));
|
||||||
case '^' -> previousStyle.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, c(message.substring(1))));
|
case '^' -> previousStyle.withHoverEvent(new HoverEvent.ShowText(c(message.substring(1))));
|
||||||
case '@' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, message.substring(1)));
|
case '@' -> previousStyle.withClickEvent(new ClickEvent.OpenUrl(URI.create(message.substring(1))));
|
||||||
case '&' -> previousStyle.withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, message.substring(1)));
|
case '&' -> previousStyle.withClickEvent(new ClickEvent.CopyToClipboard(message.substring(1)));
|
||||||
default -> { // Create a new component
|
default -> { // Create a new component
|
||||||
ret = Component.literal(str);
|
ret = Component.literal(str);
|
||||||
ret.setStyle(parseStyle(desc));
|
ret.setStyle(parseStyle(desc));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.tags.FluidTags;
|
import net.minecraft.tags.FluidTags;
|
||||||
|
import net.minecraft.util.random.Weighted;
|
||||||
import net.minecraft.world.entity.AgeableMob;
|
import net.minecraft.world.entity.AgeableMob;
|
||||||
import net.minecraft.world.entity.EntitySpawnReason;
|
import net.minecraft.world.entity.EntitySpawnReason;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@@ -162,9 +163,10 @@ public class PerimeterDiagnostics
|
|||||||
if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
|
if (sle == null || !worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap().contains(sle))
|
||||||
{
|
{
|
||||||
sle = null;
|
sle = null;
|
||||||
for (MobSpawnSettings.SpawnerData sle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap())
|
for (Weighted<MobSpawnSettings.SpawnerData> wsle: worldServer.getChunkSource().getGenerator().getMobsAt(worldServer.getBiome(pos), worldServer.structureManager(), ctype, pos).unwrap())
|
||||||
{
|
{
|
||||||
if (el.getType() == sle.type)
|
MobSpawnSettings.SpawnerData sle = wsle.value();
|
||||||
|
if (el.getType() == sle.type())
|
||||||
{
|
{
|
||||||
this.sle = sle;
|
this.sle = sle;
|
||||||
break;
|
break;
|
||||||
@@ -176,7 +178,7 @@ public class PerimeterDiagnostics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SpawnPlacements.isSpawnPositionOk(sle.type, worldServer, pos))
|
if (SpawnPlacements.isSpawnPositionOk(sle.type(), worldServer, pos))
|
||||||
{
|
{
|
||||||
el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F);
|
el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F);
|
||||||
return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) &&
|
return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, EntitySpawnReason.NATURAL) &&
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import net.minecraft.core.registries.Registries;
|
|||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.util.random.WeightedRandomList;
|
import net.minecraft.util.random.WeightedList;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.level.StructureManager;
|
import net.minecraft.world.level.StructureManager;
|
||||||
@@ -32,27 +32,27 @@ public class SpawnOverrides {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
addOverride(() -> CarpetSettings.huskSpawningInTemples, MobCategory.MONSTER, BuiltinStructures.DESERT_PYRAMID, StructureSpawnOverride.BoundingBoxType.STRUCTURE,
|
addOverride(() -> CarpetSettings.huskSpawningInTemples, MobCategory.MONSTER, BuiltinStructures.DESERT_PYRAMID, StructureSpawnOverride.BoundingBoxType.STRUCTURE,
|
||||||
WeightedRandomList.create(new MobSpawnSettings.SpawnerData(EntityType.HUSK, 1, 1, 1))
|
WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.HUSK, 1, 1))
|
||||||
);
|
);
|
||||||
addOverride(() -> CarpetSettings.shulkerSpawningInEndCities, MobCategory.MONSTER, BuiltinStructures.END_CITY, StructureSpawnOverride.BoundingBoxType.PIECE,
|
addOverride(() -> CarpetSettings.shulkerSpawningInEndCities, MobCategory.MONSTER, BuiltinStructures.END_CITY, StructureSpawnOverride.BoundingBoxType.PIECE,
|
||||||
WeightedRandomList.create(new MobSpawnSettings.SpawnerData(EntityType.SHULKER, 10, 4, 4))
|
WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.SHULKER, 4, 4))
|
||||||
);
|
);
|
||||||
addOverride(() -> CarpetSettings.piglinsSpawningInBastions, MobCategory.MONSTER, BuiltinStructures.BASTION_REMNANT, StructureSpawnOverride.BoundingBoxType.PIECE,
|
addOverride(() -> CarpetSettings.piglinsSpawningInBastions, MobCategory.MONSTER, BuiltinStructures.BASTION_REMNANT, StructureSpawnOverride.BoundingBoxType.PIECE,
|
||||||
WeightedRandomList.create(
|
WeightedList.<MobSpawnSettings.SpawnerData>builder()
|
||||||
new MobSpawnSettings.SpawnerData(EntityType.PIGLIN_BRUTE, 5, 1, 2),
|
.add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN_BRUTE,1, 2), 5)
|
||||||
new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 10, 2, 4),
|
.add(new MobSpawnSettings.SpawnerData(EntityType.PIGLIN, 2, 4), 10)
|
||||||
new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 2, 1, 2)
|
.add(new MobSpawnSettings.SpawnerData(EntityType.HOGLIN, 1, 2), 2)
|
||||||
)
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addOverride(BooleanSupplier when, MobCategory cat, ResourceKey<Structure> poo,
|
public static void addOverride(BooleanSupplier when, MobCategory cat, ResourceKey<Structure> poo,
|
||||||
StructureSpawnOverride.BoundingBoxType type, WeightedRandomList<MobSpawnSettings.SpawnerData> spawns) {
|
StructureSpawnOverride.BoundingBoxType type, WeightedList<MobSpawnSettings.SpawnerData> spawns) {
|
||||||
carpetOverrides.put(Pair.of(cat, poo), Pair.of(when, new StructureSpawnOverride(type, spawns)));
|
carpetOverrides.put(Pair.of(cat, poo), Pair.of(when, new StructureSpawnOverride(type, spawns)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WeightedRandomList<MobSpawnSettings.SpawnerData> test(StructureManager structureFeatureManager, LongSet foo,
|
public static WeightedList<MobSpawnSettings.SpawnerData> test(StructureManager structureFeatureManager, LongSet foo,
|
||||||
MobCategory cat, Structure confExisting, BlockPos where) {
|
MobCategory cat, Structure confExisting, BlockPos where) {
|
||||||
ResourceLocation resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting);
|
ResourceLocation resource = structureFeatureManager.registryAccess().lookupOrThrow(Registries.STRUCTURE).getKey(confExisting);
|
||||||
ResourceKey<Structure> key = ResourceKey.create(Registries.STRUCTURE, resource);
|
ResourceKey<Structure> key = ResourceKey.create(Registries.STRUCTURE, resource);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.util.random.Weighted;
|
||||||
|
import net.minecraft.util.random.WeightedList;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntitySpawnReason;
|
import net.minecraft.world.entity.EntitySpawnReason;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@@ -389,8 +391,8 @@ public class SpawnReporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// yeeted from NaturalSpawner - temporary access fix
|
// yeeted from NaturalSpawner - temporary access fix
|
||||||
private static List<MobSpawnSettings.SpawnerData> getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder<Biome> holder) {
|
private static WeightedList<MobSpawnSettings.SpawnerData> getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder<Biome> holder) {
|
||||||
return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES.unwrap() : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos).unwrap();
|
return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Component> report(BlockPos pos, ServerLevel worldIn)
|
public static List<Component> report(BlockPos pos, ServerLevel worldIn)
|
||||||
@@ -407,21 +409,22 @@ public class SpawnReporter
|
|||||||
for (MobCategory category : cachedMobCategories())
|
for (MobCategory category : cachedMobCategories())
|
||||||
{
|
{
|
||||||
String categoryCode = String.valueOf(category).substring(0, 3);
|
String categoryCode = String.valueOf(category).substring(0, 3);
|
||||||
List<MobSpawnSettings.SpawnerData> lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos));
|
WeightedList<MobSpawnSettings.SpawnerData> lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos));
|
||||||
if (lst != null && !lst.isEmpty())
|
if (lst != null && !lst.isEmpty())
|
||||||
{
|
{
|
||||||
for (MobSpawnSettings.SpawnerData spawnEntry : lst)
|
for (Weighted<MobSpawnSettings.SpawnerData> wspawnEntry : lst.unwrap())
|
||||||
{
|
{
|
||||||
if (SpawnPlacements.getPlacementType(spawnEntry.type) == null)
|
MobSpawnSettings.SpawnerData spawnEntry = wspawnEntry.value();
|
||||||
|
if (SpawnPlacements.getPlacementType(spawnEntry.type()) == null)
|
||||||
continue; // vanilla bug
|
continue; // vanilla bug
|
||||||
boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type, worldIn, pos);
|
boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type(), worldIn, pos);
|
||||||
int willSpawn = -1;
|
int willSpawn = -1;
|
||||||
boolean fits = false;
|
boolean fits = false;
|
||||||
|
|
||||||
Mob mob;
|
Mob mob;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL);
|
mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -467,7 +470,7 @@ public class SpawnReporter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL);
|
mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -479,12 +482,12 @@ public class SpawnReporter
|
|||||||
|
|
||||||
String mobTypeName = mob.getType().getDescription().getString();
|
String mobTypeName = mob.getType().getDescription().getString();
|
||||||
//String pack_size = Integer.toString(mob.getMaxSpawnClusterSize());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
|
//String pack_size = Integer.toString(mob.getMaxSpawnClusterSize());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
|
||||||
int weight = spawnEntry.getWeight().asInt();
|
int weight = wspawnEntry.weight();
|
||||||
if (canSpawn)
|
if (canSpawn)
|
||||||
{
|
{
|
||||||
String color = (fits && willSpawn > 0) ? "e" : "gi";
|
String color = (fits && willSpawn > 0) ? "e" : "gi";
|
||||||
rep.add(Messenger.c(
|
rep.add(Messenger.c(
|
||||||
String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()),
|
String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()),
|
||||||
"l YES",
|
"l YES",
|
||||||
color + " , fit: ",
|
color + " , fit: ",
|
||||||
(fits ? "l YES" : "r NO"),
|
(fits ? "l YES" : "r NO"),
|
||||||
@@ -494,7 +497,7 @@ public class SpawnReporter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()), "n NO"));
|
rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()), "n NO"));
|
||||||
}
|
}
|
||||||
killEntity(mob);
|
killEntity(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ accessible class net/minecraft/world/level/block/entity/SculkSensorBlockEntity$V
|
|||||||
accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
|
accessible method net/minecraft/world/level/border/WorldBorder getListeners ()Ljava/util/List;
|
||||||
accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
|
accessible method net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator calculateTargetStrength (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)I
|
||||||
|
|
||||||
accessible method net/minecraft/server/level/DistanceManager purgeStaleTickets ()V
|
|
||||||
#cause I don't want to deal with the interfaces until stuff is stable
|
#cause I don't want to deal with the interfaces until stuff is stable
|
||||||
accessible method net/minecraft/world/level/block/entity/SkullBlockEntity fetchGameProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture;
|
accessible method net/minecraft/world/level/block/entity/SkullBlockEntity fetchGameProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture;
|
||||||
|
|
||||||
|
|||||||
@@ -42,11 +42,9 @@
|
|||||||
"ChunkHolder_scarpetChunkCreationMixin",
|
"ChunkHolder_scarpetChunkCreationMixin",
|
||||||
"ThreadedLevelLightEngine_scarpetMixin",
|
"ThreadedLevelLightEngine_scarpetMixin",
|
||||||
"DynamicGraphMinFixedPoint_resetChunkInterface",
|
"DynamicGraphMinFixedPoint_resetChunkInterface",
|
||||||
"DistanceManager_scarpetChunkCreationMixin",
|
|
||||||
"LevelLightEngine_scarpetChunkCreationMixin",
|
"LevelLightEngine_scarpetChunkCreationMixin",
|
||||||
"LayerLightEngine_scarpetChunkCreationMixin",
|
"LayerLightEngine_scarpetChunkCreationMixin",
|
||||||
"LayerLightSectionStorage_scarpetChunkCreationMixin",
|
"LayerLightSectionStorage_scarpetChunkCreationMixin",
|
||||||
"DistanceManager_spawnChunksMixin",
|
|
||||||
"ThreadedLevelLightEngine_scarpetChunkCreationMixin",
|
"ThreadedLevelLightEngine_scarpetChunkCreationMixin",
|
||||||
"LivingEntity_cleanLogsMixin",
|
"LivingEntity_cleanLogsMixin",
|
||||||
"MobMixin",
|
"MobMixin",
|
||||||
@@ -117,8 +115,7 @@
|
|||||||
"InfestedBlock_gravelMixin",
|
"InfestedBlock_gravelMixin",
|
||||||
"PistonBaseBlock_qcMixin",
|
"PistonBaseBlock_qcMixin",
|
||||||
"DispenserBlock_qcMixin",
|
"DispenserBlock_qcMixin",
|
||||||
|
"Item_missingToolsMixin",
|
||||||
"PickaxeItem_missingToolsMixin",
|
|
||||||
"WitherBoss_moreBlueMixin",
|
"WitherBoss_moreBlueMixin",
|
||||||
"ArmorStand_scarpetMarkerMixin",
|
"ArmorStand_scarpetMarkerMixin",
|
||||||
"Entity_scarpetEventsMixin",
|
"Entity_scarpetEventsMixin",
|
||||||
@@ -142,6 +139,7 @@
|
|||||||
"AbstractCraftingMenu_scarpetMixin",
|
"AbstractCraftingMenu_scarpetMixin",
|
||||||
"AbstractFurnaceMenu_scarpetMixin",
|
"AbstractFurnaceMenu_scarpetMixin",
|
||||||
"DistanceManager_scarpetMixin",
|
"DistanceManager_scarpetMixin",
|
||||||
|
"TicketStorage_scarpetMixin",
|
||||||
"PoiRecord_scarpetMixin",
|
"PoiRecord_scarpetMixin",
|
||||||
"ServerLevel_scarpetMixin",
|
"ServerLevel_scarpetMixin",
|
||||||
"PersistentEntitySectionManager_scarpetMixin",
|
"PersistentEntitySectionManager_scarpetMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user