This commit is contained in:
gnembon committed 2021-09-22 21:12:11 -03:00
1 parent 54ec1f223c
commit 7b9e5e6feb
12 files changed
+33 -33

No files matched your search

+2 -2
View File
@@ -5,9 +5,9 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=21w37a minecraft_version=21w37a
yarn_mappings=21w37a+build.5 yarn_mappings=21w37a+build.13
loader_version=0.11.7 loader_version=0.11.7
fabric_version=0.40.1+1.17 fabric_version=0.40.3+1.18
# Mod Properties # Mod Properties
mod_version = 1.4.46 mod_version = 1.4.46
@@ -6,7 +6,7 @@ import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.HeightLimitView; import net.minecraft.world.HeightLimitView;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.random.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.FeatureConfig; import net.minecraft.world.gen.feature.FeatureConfig;
@@ -308,11 +308,11 @@ public class EntityPlayerActionPack
case BLOCK: case BLOCK:
{ {
player.updateLastActionTime(); player.updateLastActionTime();
ServerWorld world = player.method_37908(); ServerWorld world = player.getWorld();
BlockHitResult blockHit = (BlockHitResult) hit; BlockHitResult blockHit = (BlockHitResult) hit;
BlockPos pos = blockHit.getBlockPos(); BlockPos pos = blockHit.getBlockPos();
Direction side = blockHit.getSide(); Direction side = blockHit.getSide();
if (pos.getY() < player.method_37908().getTopY() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos)) if (pos.getY() < player.getWorld().getTopY() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos))
{ {
ActionResult result = player.interactionManager.interactBlock(player, world, player.getStackInHand(hand), hand, blockHit); ActionResult result = player.interactionManager.interactBlock(player, world, player.getStackInHand(hand), hand, blockHit);
if (result.isAccepted()) if (result.isAccepted())
@@ -347,7 +347,7 @@ public class EntityPlayerActionPack
} }
} }
ItemStack handItem = player.getStackInHand(hand); ItemStack handItem = player.getStackInHand(hand);
if (player.interactionManager.interactItem(player, player.method_37908(), handItem, hand).isAccepted()) if (player.interactionManager.interactItem(player, player.getWorld(), handItem, hand).isAccepted())
{ {
ap.itemUseCooldown = 3; ap.itemUseCooldown = 3;
return true; return true;
@@ -400,7 +400,7 @@ public class EntityPlayerActionPack
boolean blockBroken = false; boolean blockBroken = false;
if (player.interactionManager.getGameMode().isCreative()) if (player.interactionManager.getGameMode().isCreative())
{ {
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.method_37908().getTopY()); player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY());
ap.blockHitDelay = 5; ap.blockHitDelay = 5;
blockBroken = true; blockBroken = true;
} }
@@ -408,9 +408,9 @@ public class EntityPlayerActionPack
{ {
if (ap.currentBlock != null) if (ap.currentBlock != null)
{ {
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.method_37908().getTopY()); player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.getWorld().getTopY());
} }
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.method_37908().getTopY()); player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY());
boolean notAir = !state.isAir(); boolean notAir = !state.isAir();
if (notAir && ap.curBlockDamageMP == 0) if (notAir && ap.curBlockDamageMP == 0)
{ {
@@ -433,7 +433,7 @@ public class EntityPlayerActionPack
ap.curBlockDamageMP += state.calcBlockBreakingDelta(player, player.world, pos); ap.curBlockDamageMP += state.calcBlockBreakingDelta(player, player.world, pos);
if (ap.curBlockDamageMP >= 1) if (ap.curBlockDamageMP >= 1)
{ {
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.method_37908().getTopY()); player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.getWorld().getTopY());
ap.currentBlock = null; ap.currentBlock = null;
ap.blockHitDelay = 5; ap.blockHitDelay = 5;
blockBroken = true; blockBroken = true;
@@ -455,7 +455,7 @@ public class EntityPlayerActionPack
EntityPlayerActionPack ap = ((ServerPlayerEntityInterface) player).getActionPack(); EntityPlayerActionPack ap = ((ServerPlayerEntityInterface) player).getActionPack();
if (ap.currentBlock == null) return; if (ap.currentBlock == null) return;
player.world.setBlockBreakingInfo(-1, ap.currentBlock, -1); player.world.setBlockBreakingInfo(-1, ap.currentBlock, -1);
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.method_37908().getTopY()); player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.getWorld().getTopY());
ap.currentBlock = null; ap.currentBlock = null;
} }
}, },
@@ -18,7 +18,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys; import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.BuiltinBiomes; import net.minecraft.world.biome.BuiltinBiomes;
import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.random.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.StructureConfig; import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.treedecorator.BeehiveTreeDecorator; import net.minecraft.world.gen.treedecorator.BeehiveTreeDecorator;
@@ -161,7 +161,7 @@ public class FeatureGenerator
private static ConfiguredStructureFeature<?, ?> getDefaultFeature(StructureFeature<?> structure, ServerWorld world, BlockPos pos, boolean tryHard) private static ConfiguredStructureFeature<?, ?> getDefaultFeature(StructureFeature<?> structure, ServerWorld world, BlockPos pos, boolean tryHard)
{ {
var definedStructures = world.getServer().getSaveProperties().getGeneratorOptions().getChunkGenerator().getStructuresConfig().method_38424(structure); var definedStructures = world.getServer().getSaveProperties().getGeneratorOptions().getChunkGenerator().getStructuresConfig().getConfiguredStructureFeature(structure);
var optinalBiome = world.getRegistryManager().get(Registry.BIOME_KEY).getKey(world.getBiome(pos)); var optinalBiome = world.getRegistryManager().get(Registry.BIOME_KEY).getKey(world.getBiome(pos));
if (optinalBiome.isPresent()) if (optinalBiome.isPresent())
for (var configureStructure: definedStructures.inverse().get(optinalBiome.get())) for (var configureStructure: definedStructures.inverse().get(optinalBiome.get()))
@@ -147,7 +147,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null) if (CarpetSettings.movableBlockEntities && this.carriedBlockEntity != null)
{ {
//Leave name "carriedTileEntityCM" instead of "carriedBlockEntityCM" for upgrade compatibility with 1.13.2 movable TE //Leave name "carriedTileEntityCM" instead of "carriedBlockEntityCM" for upgrade compatibility with 1.13.2 movable TE
NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.method_38244()); // toNBT NbtCompound_1.put("carriedTileEntityCM", this.carriedBlockEntity.createNbt());
} }
} }
} }
@@ -231,7 +231,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
)) ))
private void onEntityInteract(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci) private void onEntityInteract(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci)
{ {
PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.method_37908()), playerInteractEntityC2SPacket_1.getHand()); PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), playerInteractEntityC2SPacket_1.getHand());
}*/ }*/
/*@Inject(method = "onPlayerInteractEntity", at = @At( /*@Inject(method = "onPlayerInteractEntity", at = @At(
@@ -241,7 +241,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
private void onEntityAttack(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci) private void onEntityAttack(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci)
{ {
//todo add hit and hand in the future //todo add hit and hand in the future
PLAYER_ATTACKS_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.method_37908()), null); PLAYER_ATTACKS_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), null);
}*/ }*/
@Inject(method = "onButtonClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V")) @Inject(method = "onButtonClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V"))
@@ -16,7 +16,7 @@ import net.minecraft.world.biome.source.BiomeCoords;
import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.random.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature; import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -70,7 +70,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
Objects.requireNonNull(thiss); Objects.requireNonNull(thiss);
return registry3.getKey(thiss).map(Object::toString).orElseGet(thiss::toString); return registry3.getKey(thiss).map(Object::toString).orElseGet(thiss::toString);
}); });
ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> immutableMultimap = generator.getStructuresConfig().method_38424((StructureFeature) (Object)this); ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> immutableMultimap = generator.getStructuresConfig().getConfiguredStructureFeature((StructureFeature) (Object)this);
Predicate<Biome> predicate = (b) -> { Predicate<Biome> predicate = (b) -> {
Objects.requireNonNull(immutableMultimap); Objects.requireNonNull(immutableMultimap);
@@ -80,7 +80,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
{ {
player.getServer().getPlayerManager().remove(player); player.getServer().getPlayerManager().remove(player);
player.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login")); player.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login"));
ServerWorld worldIn = player.method_37908();//.getWorld(player.dimension); ServerWorld worldIn = player.getWorld();//.getWorld(player.dimension);
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true); EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true);
server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), playerShadow); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), playerShadow);
@@ -494,7 +494,7 @@ public class CarpetEventServer
{ {
return Arrays.asList( return Arrays.asList(
new EntityValue(player), new EntityValue(player),
new BlockValue(null, player.method_37908(), blockpos), new BlockValue(null, player.getWorld(), blockpos),
StringValue.of(facing.getName()) StringValue.of(facing.getName())
); );
}, player::getCommandSource); }, player::getCommandSource);
@@ -515,7 +515,7 @@ public class CarpetEventServer
new EntityValue(player), new EntityValue(player),
ValueConversions.of(itemstack), ValueConversions.of(itemstack),
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
new BlockValue(null, player.method_37908(), blockpos), new BlockValue(null, player.getWorld(), blockpos),
StringValue.of(enumfacing.getName()), StringValue.of(enumfacing.getName()),
ListValue.of( ListValue.of(
new NumericValue(vec3d.x), new NumericValue(vec3d.x),
@@ -539,7 +539,7 @@ public class CarpetEventServer
return Arrays.asList( return Arrays.asList(
new EntityValue(player), new EntityValue(player),
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
new BlockValue(null, player.method_37908(), blockpos), new BlockValue(null, player.getWorld(), blockpos),
StringValue.of(enumfacing.getName()), StringValue.of(enumfacing.getName()),
ListValue.of( ListValue.of(
new NumericValue(vec3d.x), new NumericValue(vec3d.x),
@@ -559,7 +559,7 @@ public class CarpetEventServer
new EntityValue(player), new EntityValue(player),
ValueConversions.of(itemstack), ValueConversions.of(itemstack),
StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"), StringValue.of(enumhand == Hand.MAIN_HAND ? "mainhand" : "offhand"),
new BlockValue(null, player.method_37908(), pos) new BlockValue(null, player.getWorld(), pos)
), player::getCommandSource); ), player::getCommandSource);
} }
}; };
@@ -569,7 +569,7 @@ public class CarpetEventServer
public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS) public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS)
{ {
handler.call( handler.call(
() -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.method_37908(), pos)), () -> Arrays.asList(new EntityValue(player), new BlockValue(previousBS, player.getWorld(), pos)),
player::getCommandSource player::getCommandSource
); );
} }
@@ -1083,7 +1083,7 @@ public class CarpetEventServer
valArgs.add(EntityValue.of(player)); valArgs.add(EntityValue.of(player));
for (Object o: args) for (Object o: args)
{ {
valArgs.add(ValueConversions.guess(player.method_37908(), o)); valArgs.add(ValueConversions.guess(player.getWorld(), o));
} }
return valArgs; return valArgs;
}, player::getCommandSource }, player::getCommandSource
@@ -97,7 +97,7 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.explosion.Explosion; import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.random.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature; import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.StructureFeature; import net.minecraft.world.gen.feature.StructureFeature;
@@ -718,7 +718,7 @@ public class ShapeDispatcher
ParticleEffect particle = replacementParticle(); ParticleEffect particle = replacementParticle();
int partno = Math.min(1000,20*subdivisions); int partno = Math.min(1000,20*subdivisions);
Random rand = p.world.getRandom(); Random rand = p.world.getRandom();
ServerWorld world = p.method_37908(); ServerWorld world = p.getWorld();
Vec3d ccenter = relativiseRender(world, center, 0 ); Vec3d ccenter = relativiseRender(world, center, 0 );
@@ -796,7 +796,7 @@ public class ShapeDispatcher
ParticleEffect particle = replacementParticle(); ParticleEffect particle = replacementParticle();
int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height))); int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height)));
Random rand = p.world.getRandom(); Random rand = p.world.getRandom();
ServerWorld world = p.method_37908(); ServerWorld world = p.getWorld();
Vec3d ccenter = relativiseRender(world, center, 0 ); Vec3d ccenter = relativiseRender(world, center, 0 );
@@ -1275,7 +1275,7 @@ public class ShapeDispatcher
int parts = 0; int parts = 0;
for (ServerPlayerEntity player : playerList) for (ServerPlayerEntity player : playerList)
{ {
ServerWorld world = player.method_37908(); ServerWorld world = player.getWorld();
world.spawnParticles(player, particle, true, world.spawnParticles(player, particle, true,
(towards.x)/2+from.x, (towards.y)/2+from.y, (towards.z)/2+from.z, particles/3, (towards.x)/2+from.x, (towards.y)/2+from.y, (towards.z)/2+from.z, particles/3,
towards.x/6, towards.y/6, towards.z/6, 0.0); towards.x/6, towards.y/6, towards.z/6, 0.0);
@@ -1292,7 +1292,7 @@ public class ShapeDispatcher
int dev = 2*divider; int dev = 2*divider;
for (ServerPlayerEntity player : playerList) for (ServerPlayerEntity player : playerList)
{ {
ServerWorld world = player.method_37908(); ServerWorld world = player.getWorld();
world.spawnParticles(player, particle, true, world.spawnParticles(player, particle, true,
(towards.x)/center+from.x, (towards.y)/center+from.y, (towards.z)/center+from.z, particles/divider, (towards.x)/center+from.x, (towards.y)/center+from.y, (towards.z)/center+from.z, particles/divider,
towards.x/dev, towards.y/dev, towards.z/dev, 0.0); towards.x/dev, towards.y/dev, towards.z/dev, 0.0);
@@ -1321,7 +1321,7 @@ public class ShapeDispatcher
Vec3d at = from.add(towards.multiply( rand.nextDouble())); Vec3d at = from.add(towards.multiply( rand.nextDouble()));
for (ServerPlayerEntity player : players) for (ServerPlayerEntity player : players)
{ {
player.method_37908().spawnParticles(player, particle, true, player.getWorld().spawnParticles(player, particle, true,
at.x, at.y, at.z, 1, at.x, at.y, at.z, 1,
0.0, 0.0, 0.0, 0.0); 0.0, 0.0, 0.0, 0.0);
pcount ++; pcount ++;
@@ -1339,7 +1339,7 @@ public class ShapeDispatcher
{ {
for (ServerPlayerEntity player : players) for (ServerPlayerEntity player : players)
{ {
player.method_37908().spawnParticles(player, particle, true, player.getWorld().spawnParticles(player, particle, true,
delta.x+from.x, delta.y+from.y, delta.z+from.z, 1, delta.x+from.x, delta.y+from.y, delta.z+from.z, 1,
0.0, 0.0, 0.0, 0.0); 0.0, 0.0, 0.0, 0.0);
pcount ++; pcount ++;
@@ -123,7 +123,7 @@ public class BlockValue extends Value
data = new NbtCompound(); data = new NbtCompound();
return null; return null;
} }
data = be.method_38244(); // toNBT data = be.createNbt();
return data; return data;
} }
return null; return null;