diff --git a/src/main/java/ru/betterend/blocks/EndPortalBlock.java b/src/main/java/ru/betterend/blocks/EndPortalBlock.java index 3fc80413..5ae29c24 100644 --- a/src/main/java/ru/betterend/blocks/EndPortalBlock.java +++ b/src/main/java/ru/betterend/blocks/EndPortalBlock.java @@ -95,7 +95,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable teleportPlayer(player, destination, exitPos); } else { TeleportingEntity teleEntity = (TeleportingEntity) entity; - teleEntity.beSetExitPos(exitPos); + teleEntity.be_setExitPos(exitPos); Entity teleported = entity.changeDimension(destination); if (teleported != null) { teleported.setPortalCooldown(); @@ -113,7 +113,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable player.teleportTo(destination, exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5, player.yRot, player.xRot); } else { TeleportingEntity teleEntity = (TeleportingEntity) player; - teleEntity.beSetExitPos(exitPos); + teleEntity.be_setExitPos(exitPos); player.changeDimension(destination); } } diff --git a/src/main/java/ru/betterend/effects/EndPotions.java b/src/main/java/ru/betterend/effects/EndPotions.java index 86ab156b..64608d37 100644 --- a/src/main/java/ru/betterend/effects/EndPotions.java +++ b/src/main/java/ru/betterend/effects/EndPotions.java @@ -7,7 +7,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.Potions; import ru.betterend.BetterEnd; -import ru.betterend.mixin.common.BrewingAccessor; +import ru.betterend.mixin.common.PotionBrewingAccessor; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndItems; @@ -24,8 +24,8 @@ public class EndPotions { } public static void register() { - BrewingAccessor.callAddMix(Potions.AWKWARD, EndItems.ENDER_DUST, END_VEIL); - BrewingAccessor.callAddMix(END_VEIL, Items.REDSTONE, LONG_END_VEIL); - BrewingAccessor.callAddMix(Potions.AWKWARD, EndBlocks.MURKWEED.asItem(), Potions.NIGHT_VISION); + PotionBrewingAccessor.callAddMix(Potions.AWKWARD, EndItems.ENDER_DUST, END_VEIL); + PotionBrewingAccessor.callAddMix(END_VEIL, Items.REDSTONE, LONG_END_VEIL); + PotionBrewingAccessor.callAddMix(Potions.AWKWARD, EndBlocks.MURKWEED.asItem(), Potions.NIGHT_VISION); } } diff --git a/src/main/java/ru/betterend/entity/EndSlimeEntity.java b/src/main/java/ru/betterend/entity/EndSlimeEntity.java index f23f8c99..bf1a8227 100644 --- a/src/main/java/ru/betterend/entity/EndSlimeEntity.java +++ b/src/main/java/ru/betterend/entity/EndSlimeEntity.java @@ -141,7 +141,7 @@ public class EndSlimeEntity extends Slime { slimeEntity.setCustomName(text); slimeEntity.setNoAi(bl); slimeEntity.setInvulnerable(this.isInvulnerable()); - ((ISlime) slimeEntity).beSetSlimeSize(j, true); + ((ISlime) slimeEntity).be_setSlimeSize(j, true); slimeEntity.refreshDimensions(); slimeEntity.moveTo(this.getX() + (double) g, this.getY() + 0.5D, this.getZ() + (double) h, this.random.nextFloat() * 360.0F, 0.0F); this.level.addFreshEntity(slimeEntity); diff --git a/src/main/java/ru/betterend/interfaces/IBiomeArray.java b/src/main/java/ru/betterend/interfaces/IBiomeArray.java index a4fce686..9c632b6d 100644 --- a/src/main/java/ru/betterend/interfaces/IBiomeArray.java +++ b/src/main/java/ru/betterend/interfaces/IBiomeArray.java @@ -4,5 +4,5 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.biome.Biome; public interface IBiomeArray { - public void setBiome(Biome biome, BlockPos pos); + public void be_setBiome(Biome biome, BlockPos pos); } diff --git a/src/main/java/ru/betterend/interfaces/ISlime.java b/src/main/java/ru/betterend/interfaces/ISlime.java index 6d7abb63..7df19bc6 100644 --- a/src/main/java/ru/betterend/interfaces/ISlime.java +++ b/src/main/java/ru/betterend/interfaces/ISlime.java @@ -1,5 +1,5 @@ package ru.betterend.interfaces; public interface ISlime { - public void beSetSlimeSize(int size, boolean heal); + public void be_setSlimeSize(int size, boolean heal); } diff --git a/src/main/java/ru/betterend/interfaces/TeleportingEntity.java b/src/main/java/ru/betterend/interfaces/TeleportingEntity.java index 29a6c466..cfd23f30 100644 --- a/src/main/java/ru/betterend/interfaces/TeleportingEntity.java +++ b/src/main/java/ru/betterend/interfaces/TeleportingEntity.java @@ -3,7 +3,7 @@ package ru.betterend.interfaces; import net.minecraft.core.BlockPos; public interface TeleportingEntity { - void beSetExitPos(BlockPos pos); - void beResetExitPos(); - boolean beCanTeleport(); + void be_setExitPos(BlockPos pos); + void be_resetExitPos(); + boolean be_canTeleport(); } diff --git a/src/main/java/ru/betterend/item/EndArmorItem.java b/src/main/java/ru/betterend/item/EndArmorItem.java index 0f04de3e..cc4faf42 100644 --- a/src/main/java/ru/betterend/item/EndArmorItem.java +++ b/src/main/java/ru/betterend/item/EndArmorItem.java @@ -27,20 +27,20 @@ public class EndArmorItem extends ArmorItem implements Patterned { return; } - Multimap attributeModifiers = accessor.getDefaultModifiers(); + Multimap attributeModifiers = accessor.be_getDefaultModifiers(); // In case Mojang or anyone else decided to fix this if (attributeModifiers.keys().contains(Attributes.KNOCKBACK_RESISTANCE)) { return; } - UUID uuid = accessor.getModifiers()[slot.getIndex()]; + UUID uuid = accessor.be_getModifiers()[slot.getIndex()]; // Rebuild attributeModifiers to include knockback resistance ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); builder.putAll(attributeModifiers); builder.put(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(uuid, "Armor knockback resistance", knockbackResistance, AttributeModifier.Operation.ADDITION)); - accessor.setDefaultModifiers(builder.build()); + accessor.be_setDefaultModifiers(builder.build()); } @Override diff --git a/src/main/java/ru/betterend/mixin/common/AnvilScreenHandlerMixin.java b/src/main/java/ru/betterend/mixin/common/AnvilMenuMixin.java similarity index 93% rename from src/main/java/ru/betterend/mixin/common/AnvilScreenHandlerMixin.java rename to src/main/java/ru/betterend/mixin/common/AnvilMenuMixin.java index 5df5f766..48cf2e5b 100644 --- a/src/main/java/ru/betterend/mixin/common/AnvilScreenHandlerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/AnvilMenuMixin.java @@ -27,18 +27,16 @@ import ru.betterend.interfaces.AnvilScreenHandlerExtended; import ru.betterend.recipe.builders.AnvilRecipe; @Mixin(AnvilMenu.class) -public abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu implements AnvilScreenHandlerExtended { - +public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilScreenHandlerExtended { private List be_recipes = Collections.emptyList(); private AnvilRecipe be_currentRecipe; private DataSlot anvilLevel; - public AnvilScreenHandlerMixin(int syncId, Inventory playerInventory) { + public AnvilMenuMixin(int syncId, Inventory playerInventory) { super(MenuType.ANVIL, syncId, playerInventory, ContainerLevelAccess.NULL); } - @Inject(method = "(ILnet/minecraft/world/entity/player/Inventory;Lnet/minecraft/world/inventory/ContainerLevelAccess;)V", - at = @At("TAIL")) + @Inject(method = "(ILnet/minecraft/world/entity/player/Inventory;Lnet/minecraft/world/inventory/ContainerLevelAccess;)V", at = @At("TAIL")) public void be_initAnvilLevel(int syncId, Inventory inventory, ContainerLevelAccess context, CallbackInfo info) { if (context != ContainerLevelAccess.NULL) { int anvLevel = context.evaluate((world, blockPos) -> { diff --git a/src/main/java/ru/betterend/mixin/common/ArmorItemAccessor.java b/src/main/java/ru/betterend/mixin/common/ArmorItemAccessor.java index f91eed33..33f8224a 100644 --- a/src/main/java/ru/betterend/mixin/common/ArmorItemAccessor.java +++ b/src/main/java/ru/betterend/mixin/common/ArmorItemAccessor.java @@ -1,22 +1,22 @@ -package ru.betterend.mixin.common; - -import java.util.UUID; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; -import net.minecraft.world.item.ArmorItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import com.google.common.collect.Multimap; - -@Mixin(ArmorItem.class) -public interface ArmorItemAccessor { - @Accessor("ARMOR_MODIFIER_UUID_PER_SLOT") - UUID[] getModifiers(); - - @Accessor("defaultModifiers") - Multimap getDefaultModifiers(); - - @Accessor("defaultModifiers") - void setDefaultModifiers(Multimap attributeModifiers); -} +package ru.betterend.mixin.common; + +import java.util.UUID; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.item.ArmorItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import com.google.common.collect.Multimap; + +@Mixin(ArmorItem.class) +public interface ArmorItemAccessor { + @Accessor("ARMOR_MODIFIER_UUID_PER_SLOT") + UUID[] be_getModifiers(); + + @Accessor("defaultModifiers") + Multimap be_getDefaultModifiers(); + + @Accessor("defaultModifiers") + void be_setDefaultModifiers(Multimap attributeModifiers); +} diff --git a/src/main/java/ru/betterend/mixin/common/GenerationSettingsAccessor.java b/src/main/java/ru/betterend/mixin/common/BiomeGenerationSettingsAccessor.java similarity index 53% rename from src/main/java/ru/betterend/mixin/common/GenerationSettingsAccessor.java rename to src/main/java/ru/betterend/mixin/common/BiomeGenerationSettingsAccessor.java index f368415e..47bc7b98 100644 --- a/src/main/java/ru/betterend/mixin/common/GenerationSettingsAccessor.java +++ b/src/main/java/ru/betterend/mixin/common/BiomeGenerationSettingsAccessor.java @@ -9,16 +9,16 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(BiomeGenerationSettings.class) -public interface GenerationSettingsAccessor { +public interface BiomeGenerationSettingsAccessor { @Accessor("features") - List>>> beGetFeatures(); + List>>> be_getFeatures(); @Accessor("features") - void beSetFeatures(List>>> features); + void be_setFeatures(List>>> features); - @Accessor("structureFeatures") - List>> beGetStructures(); + @Accessor("structureStarts") + List>> be_getStructures(); - @Accessor("structureFeatures") - void beSetStructures(List>> structures); + @Accessor("structureStarts") + void be_setStructures(List>> structures); } diff --git a/src/main/java/ru/betterend/mixin/common/AbstractBlockMixin.java b/src/main/java/ru/betterend/mixin/common/BlockBehaviourMixin.java similarity index 95% rename from src/main/java/ru/betterend/mixin/common/AbstractBlockMixin.java rename to src/main/java/ru/betterend/mixin/common/BlockBehaviourMixin.java index 369f0a72..a0953f41 100644 --- a/src/main/java/ru/betterend/mixin/common/AbstractBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/BlockBehaviourMixin.java @@ -21,8 +21,7 @@ import ru.betterend.item.tool.EndHammerItem; import ru.betterend.util.MHelper; @Mixin(BlockBehaviour.class) -public abstract class AbstractBlockMixin { - +public abstract class BlockBehaviourMixin { @Inject(method = "getDrops", at = @At("HEAD"), cancellable = true) public void be_getDroppedStacks(BlockState state, LootContext.Builder builder, CallbackInfoReturnable> info) { if (state.is(Blocks.GLOWSTONE)) { diff --git a/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java index 87a40f52..2e364740 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusFlowerBlockMixin.java @@ -43,7 +43,7 @@ public abstract class ChorusFlowerBlockMixin extends Block { private ChorusPlantBlock plantBlock; @Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true) - private void be_canPlace(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable info) { + private void be_canSurvive(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable info) { if (world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM)) { info.setReturnValue(true); info.cancel(); @@ -51,7 +51,7 @@ public abstract class ChorusFlowerBlockMixin extends Block { } @Inject(method = "randomTick", at = @At("HEAD"), cancellable = true) - private void be_onTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) { + private void be_randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) { if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { BlockPos up = pos.above(); if (world.isEmptyBlock(up) && up.getY() < 256) { @@ -71,7 +71,7 @@ public abstract class ChorusFlowerBlockMixin extends Block { } @Inject(method = "generatePlant", at = @At("RETURN"), cancellable = true) - private static void be_onGeneratePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) { + private static void be_generatePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) { BlockState state = world.getBlockState(pos); if (GeneratorOptions.changeChorusPlant() && state.is(Blocks.CHORUS_PLANT)) { BlocksHelper.setWithoutUpdate(world, pos, state.setValue(BlocksHelper.ROOTS, true)); @@ -97,8 +97,8 @@ public abstract class ChorusFlowerBlockMixin extends Block { } } - @Inject(method = "die", at = @At("HEAD"), cancellable = true) - private void be_onDie(Level world, BlockPos pos, CallbackInfo info) { + @Inject(method = "placeDeadFlower", at = @At("HEAD"), cancellable = true) + private void be_placeDeadFlower(Level world, BlockPos pos, CallbackInfo info) { BlockState down = world.getBlockState(pos.below()); if (down.is(Blocks.CHORUS_PLANT) || down.is(EndTags.GEN_TERRAIN)) { world.setBlock(pos, this.defaultBlockState().setValue(BlockStateProperties.AGE_5, 5), 2); diff --git a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java index 8b5e0fd7..dbc265cd 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusPlantBlockMixin.java @@ -37,16 +37,16 @@ public abstract class ChorusPlantBlockMixin extends Block { } } - @Inject(method = "appendProperties", at = @At("TAIL")) - private void beAddProperties(StateDefinition.Builder builder, CallbackInfo info) { + @Inject(method = "createBlockStateDefinition", at = @At("TAIL")) + private void be_createBlockStateDefinition(StateDefinition.Builder builder, CallbackInfo info) { GeneratorOptions.init(); if (GeneratorOptions.changeChorusPlant()) { builder.add(BlocksHelper.ROOTS); } } - @Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true) - private void beConnectionProperties(BlockGetter world, BlockPos pos, CallbackInfoReturnable info) { + @Inject(method = "getStateForPlacement", at = @At("RETURN"), cancellable = true) + private void be_getStateForPlacement(BlockGetter world, BlockPos pos, CallbackInfoReturnable info) { BlockState plant = info.getReturnValue(); if (plant.is(Blocks.CHORUS_PLANT)) { if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { @@ -67,8 +67,8 @@ public abstract class ChorusPlantBlockMixin extends Block { } } - @Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true) - private void beCanPlace(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable info) { + @Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true) + private void be_canSurvive(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable info) { BlockState down = world.getBlockState(pos.below()); if (down.is(EndBlocks.CHORUS_NYLIUM) || down.is(Blocks.END_STONE)) { info.setReturnValue(true); @@ -76,8 +76,8 @@ public abstract class ChorusPlantBlockMixin extends Block { } } - @Inject(method = "getStateForNeighborUpdate", at = @At("RETURN"), cancellable = true) - private void beStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable info) { + @Inject(method = "updateShape", at = @At("RETURN"), cancellable = true) + private void be_updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable info) { BlockState plant = info.getReturnValue(); if (plant.is(Blocks.CHORUS_PLANT)) { if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) { @@ -100,8 +100,8 @@ public abstract class ChorusPlantBlockMixin extends Block { } } - @Inject(method = "getPlacementState", at = @At("RETURN"), cancellable = true) - private void beGetPlacementState(BlockPlaceContext ctx, CallbackInfoReturnable info) { + @Inject(method = "getStateForPlacement", at = @At("RETURN"), cancellable = true) + private void be_getStateForPlacement(BlockPlaceContext ctx, CallbackInfoReturnable info) { BlockPos pos = ctx.getClickedPos(); Level world = ctx.getLevel(); BlockState plant = info.getReturnValue(); diff --git a/src/main/java/ru/betterend/mixin/common/ChorusPlantFeatureMixin.java b/src/main/java/ru/betterend/mixin/common/ChorusPlantFeatureMixin.java index fee8e1f9..de29482a 100644 --- a/src/main/java/ru/betterend/mixin/common/ChorusPlantFeatureMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChorusPlantFeatureMixin.java @@ -21,8 +21,8 @@ import ru.betterend.world.generator.GeneratorOptions; @Mixin(ChorusPlantFeature.class) public class ChorusPlantFeatureMixin { - @Inject(method = "generate", at = @At("HEAD"), cancellable = true) - private void be_onGenerate(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable info) { + @Inject(method = "place", at = @At("HEAD"), cancellable = true) + private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable info) { if (structureWorldAccess.isEmptyBlock(blockPos) && structureWorldAccess.getBlockState(blockPos.below()).is(EndBlocks.CHORUS_NYLIUM)) { ChorusFlowerBlock.generatePlant(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random)); BlockState bottom = structureWorldAccess.getBlockState(blockPos); diff --git a/src/main/java/ru/betterend/mixin/common/BiomeArrayMixin.java b/src/main/java/ru/betterend/mixin/common/ChunkBiomeContainerMixin.java similarity index 86% rename from src/main/java/ru/betterend/mixin/common/BiomeArrayMixin.java rename to src/main/java/ru/betterend/mixin/common/ChunkBiomeContainerMixin.java index 7ee5b484..5f559269 100644 --- a/src/main/java/ru/betterend/mixin/common/BiomeArrayMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ChunkBiomeContainerMixin.java @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.Shadow; import ru.betterend.interfaces.IBiomeArray; @Mixin(ChunkBiomeContainer.class) -public class BiomeArrayMixin implements IBiomeArray { +public class ChunkBiomeContainerMixin implements IBiomeArray { @Final @Shadow private Biome[] biomes; @@ -28,7 +28,7 @@ public class BiomeArrayMixin implements IBiomeArray { public static int VERTICAL_MASK; @Override - public void setBiome(Biome biome, BlockPos pos) { + public void be_setBiome(Biome biome, BlockPos pos) { int biomeX = pos.getX() >> 2; int biomeY = pos.getY() >> 2; int biomeZ = pos.getZ() >> 2; diff --git a/src/main/java/ru/betterend/mixin/common/ComposterBlockAccessor.java b/src/main/java/ru/betterend/mixin/common/ComposterBlockAccessor.java index 9152b3fd..c0bc899e 100644 --- a/src/main/java/ru/betterend/mixin/common/ComposterBlockAccessor.java +++ b/src/main/java/ru/betterend/mixin/common/ComposterBlockAccessor.java @@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(ComposterBlock.class) public interface ComposterBlockAccessor { @Invoker - static void callRegisterCompostableItem(float levelIncreaseChance, ItemLike item) { + static void callAdd(float levelIncreaseChance, ItemLike item) { throw new AssertionError("@Invoker dummy body called"); } } diff --git a/src/main/java/ru/betterend/mixin/common/CraftingScreenHandlerMixin.java b/src/main/java/ru/betterend/mixin/common/CraftingMenuMixin.java similarity index 78% rename from src/main/java/ru/betterend/mixin/common/CraftingScreenHandlerMixin.java rename to src/main/java/ru/betterend/mixin/common/CraftingMenuMixin.java index 6b4f898a..b1a40263 100644 --- a/src/main/java/ru/betterend/mixin/common/CraftingScreenHandlerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/CraftingMenuMixin.java @@ -12,14 +12,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(CraftingMenu.class) -public abstract class CraftingScreenHandlerMixin -{ +public abstract class CraftingMenuMixin { @Shadow @Final private ContainerLevelAccess context; - @Inject(method = "canUse", at = @At("HEAD"), cancellable = true) - private void be_canUse(Player player, CallbackInfoReturnable info) { + @Inject(method = "stillValid", at = @At("HEAD"), cancellable = true) + private void be_stillValid(Player player, CallbackInfoReturnable info) { if (context.evaluate((world, pos) -> { return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock; }, true)) { diff --git a/src/main/java/ru/betterend/mixin/common/DimensionTypeMixin.java b/src/main/java/ru/betterend/mixin/common/DimensionTypeMixin.java index b25e55cc..b238b0db 100644 --- a/src/main/java/ru/betterend/mixin/common/DimensionTypeMixin.java +++ b/src/main/java/ru/betterend/mixin/common/DimensionTypeMixin.java @@ -15,7 +15,7 @@ import ru.betterend.world.generator.GeneratorOptions; @Mixin(value = DimensionType.class, priority = 100) public class DimensionTypeMixin { - @Inject(method = "createEndGenerator", at = @At("HEAD"), cancellable = true) + @Inject(method = "defaultEndGenerator", at = @At("HEAD"), cancellable = true) private static void be_replaceGenerator(Registry biomeRegistry, Registry chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable info) { info.setReturnValue(new NoiseBasedChunkGenerator(new BetterEndBiomeSource(biomeRegistry, seed), seed, () -> { return (NoiseGeneratorSettings) chunkGeneratorSettingsRegistry.getOrThrow(NoiseGeneratorSettings.END); @@ -23,7 +23,7 @@ public class DimensionTypeMixin { info.cancel(); } - @Inject(method = "hasEnderDragonFight", at = @At("HEAD"), cancellable = true) + @Inject(method = "createDragonFight", at = @At("HEAD"), cancellable = true) private void be_hasEnderDragonFight(CallbackInfoReturnable info) { if (!GeneratorOptions.hasDragonFights()) { info.setReturnValue(false); diff --git a/src/main/java/ru/betterend/mixin/common/EnchantmentScreenHandlerMixin.java b/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java similarity index 67% rename from src/main/java/ru/betterend/mixin/common/EnchantmentScreenHandlerMixin.java rename to src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java index 2b0e27e3..8695a9ed 100644 --- a/src/main/java/ru/betterend/mixin/common/EnchantmentScreenHandlerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EnchantmentMenuMixin.java @@ -21,14 +21,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import ru.betterend.registry.EndTags; @Mixin(EnchantmentMenu.class) -public abstract class EnchantmentScreenHandlerMixin extends AbstractContainerMenu { +public abstract class EnchantmentMenuMixin extends AbstractContainerMenu { @Shadow @Final - private Container inventory; + private Container enchantSlots; @Shadow @Final - private ContainerLevelAccess context; + private ContainerLevelAccess access; @Shadow @Final @@ -36,30 +36,30 @@ public abstract class EnchantmentScreenHandlerMixin extends AbstractContainerMen @Shadow @Final - private DataSlot seed; + private DataSlot enchantmentSeed; @Shadow @Final - public int[] enchantmentPower; + public int[] costs; @Shadow @Final - public int[] enchantmentId; + public int[] enchantClue; @Shadow @Final - public int[] enchantmentLevel; + public int[] levelClue; - protected EnchantmentScreenHandlerMixin(MenuType type, int syncId) { + protected EnchantmentMenuMixin(MenuType type, int syncId) { super(type, syncId); } - @Inject(method = "onContentChanged", at = @At("HEAD"), cancellable = true) - private void beOnContentChanged(Container inventory, CallbackInfo info) { - if (inventory == this.inventory) { + @Inject(method = "slotsChanged", at = @At("HEAD"), cancellable = true) + private void be_slotsChanged(Container inventory, CallbackInfo info) { + if (inventory == this.enchantSlots) { ItemStack itemStack = inventory.getItem(0); if (!itemStack.isEmpty() && itemStack.isEnchantable()) { - this.context.execute((world, blockPos) -> { + this.access.execute((world, blockPos) -> { int i = 0; int j; @@ -95,24 +95,24 @@ public abstract class EnchantmentScreenHandlerMixin extends AbstractContainerMen } } - this.random.setSeed((long) this.seed.get()); + this.random.setSeed((long) this.enchantmentSeed.get()); for (j = 0; j < 3; ++j) { - this.enchantmentPower[j] = EnchantmentHelper.getEnchantmentCost(this.random, j, i, itemStack); - this.enchantmentId[j] = -1; - this.enchantmentLevel[j] = -1; - if (this.enchantmentPower[j] < j + 1) { - this.enchantmentPower[j] = 0; + this.costs[j] = EnchantmentHelper.getEnchantmentCost(this.random, j, i, itemStack); + this.enchantClue[j] = -1; + this.levelClue[j] = -1; + if (this.costs[j] < j + 1) { + this.costs[j] = 0; } } for (j = 0; j < 3; ++j) { - if (this.enchantmentPower[j] > 0) { - List list = this.generateEnchantments(itemStack, j, this.enchantmentPower[j]); + if (this.costs[j] > 0) { + List list = this.generateEnchantments(itemStack, j, this.costs[j]); if (list != null && !list.isEmpty()) { EnchantmentInstance enchantmentLevelEntry = (EnchantmentInstance) list.get(this.random.nextInt(list.size())); - this.enchantmentId[j] = Registry.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment); - this.enchantmentLevel[j] = enchantmentLevelEntry.level; + this.enchantClue[j] = Registry.ENCHANTMENT.getId(enchantmentLevelEntry.enchantment); + this.levelClue[j] = enchantmentLevelEntry.level; } } } @@ -122,9 +122,9 @@ public abstract class EnchantmentScreenHandlerMixin extends AbstractContainerMen } else { for (int i = 0; i < 3; ++i) { - this.enchantmentPower[i] = 0; - this.enchantmentId[i] = -1; - this.enchantmentLevel[i] = -1; + this.costs[i] = 0; + this.enchantClue[i] = -1; + this.levelClue[i] = -1; } } info.cancel(); diff --git a/src/main/java/ru/betterend/mixin/common/EndCityFeatureMixin.java b/src/main/java/ru/betterend/mixin/common/EndCityFeatureMixin.java index 55d6b7c5..d4b691f1 100644 --- a/src/main/java/ru/betterend/mixin/common/EndCityFeatureMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EndCityFeatureMixin.java @@ -16,16 +16,16 @@ import ru.betterend.world.generator.GeneratorOptions; @Mixin(EndCityFeature.class) public class EndCityFeatureMixin { - @Inject(method = "shouldStartAt", at = @At("HEAD"), cancellable = true) - private void be_shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, WorldgenRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable info) { + @Inject(method = "isFeatureChunk", at = @At("HEAD"), cancellable = true) + private void be_isFeatureChunk(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, WorldgenRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable info) { if (GeneratorOptions.useNewGenerator()) { int chance = GeneratorOptions.getEndCityFailChance(); if (chance == 0) { - info.setReturnValue(getGenerationHeight(i, j, chunkGenerator) >= 60); + info.setReturnValue(getYPositionForFeature(i, j, chunkGenerator) >= 60); info.cancel(); } else if (chunkRandom.nextInt(chance) == 0){ - info.setReturnValue(getGenerationHeight(i, j, chunkGenerator) >= 60); + info.setReturnValue(getYPositionForFeature(i, j, chunkGenerator) >= 60); info.cancel(); } else { @@ -36,7 +36,7 @@ public class EndCityFeatureMixin { } @Shadow - private static int getGenerationHeight(int chunkX, int chunkZ, ChunkGenerator chunkGenerator) { + private static int getYPositionForFeature(int chunkX, int chunkZ, ChunkGenerator chunkGenerator) { return 0; } } diff --git a/src/main/java/ru/betterend/mixin/common/EndPortalFeatureMixin.java b/src/main/java/ru/betterend/mixin/common/EndPodiumFeatureMixin.java similarity index 81% rename from src/main/java/ru/betterend/mixin/common/EndPortalFeatureMixin.java rename to src/main/java/ru/betterend/mixin/common/EndPodiumFeatureMixin.java index 6f544079..a9c095b2 100644 --- a/src/main/java/ru/betterend/mixin/common/EndPortalFeatureMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EndPodiumFeatureMixin.java @@ -23,20 +23,20 @@ import ru.betterend.util.WorldDataUtil; import ru.betterend.world.generator.GeneratorOptions; @Mixin(EndPodiumFeature.class) -public class EndPortalFeatureMixin { +public class EndPodiumFeatureMixin { @Final @Shadow - private boolean open; + private boolean active; - @Inject(method = "generate", at = @At("HEAD"), cancellable = true) - private void bePortalGenerate(WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos blockPos, NoneFeatureConfiguration config, CallbackInfoReturnable info) { + @Inject(method = "place", at = @At("HEAD"), cancellable = true) + private void be_place(WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos blockPos, NoneFeatureConfiguration config, CallbackInfoReturnable info) { if (!GeneratorOptions.hasPortal()) { info.setReturnValue(false); info.cancel(); } else if (GeneratorOptions.replacePortal()) { blockPos = be_updatePos(blockPos, world); - StructureTemplate structure = StructureHelper.readStructure(BetterEnd.makeID(open ? "portal/end_portal_active" : "portal/end_portal_inactive")); + StructureTemplate structure = StructureHelper.readStructure(BetterEnd.makeID(active ? "portal/end_portal_active" : "portal/end_portal_inactive")); BlockPos size = structure.getSize(); blockPos = blockPos.offset(-(size.getX() >> 1), -3, -(size.getZ() >> 1)); structure.placeInWorldChunk(world, blockPos, new StructurePlaceSettings(), random); @@ -45,7 +45,7 @@ public class EndPortalFeatureMixin { } } - @ModifyVariable(method = "generate", ordinal = 0, at = @At("HEAD")) + @ModifyVariable(method = "place", ordinal = 0, at = @At("HEAD")) private BlockPos be_setPosOnGround(BlockPos blockPos, WorldGenLevel world) { return be_updatePos(blockPos, world); } diff --git a/src/main/java/ru/betterend/mixin/common/EndermanEntityMixin.java b/src/main/java/ru/betterend/mixin/common/EnderManMixin.java similarity index 77% rename from src/main/java/ru/betterend/mixin/common/EndermanEntityMixin.java rename to src/main/java/ru/betterend/mixin/common/EnderManMixin.java index d962b716..dc5f1424 100644 --- a/src/main/java/ru/betterend/mixin/common/EndermanEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EnderManMixin.java @@ -12,10 +12,9 @@ import ru.betterend.effects.EndEnchantments; import ru.betterend.effects.EndStatusEffects; @Mixin(EnderMan.class) -public abstract class EndermanEntityMixin { - - @Inject(method = "isPlayerStaring", at = @At("HEAD"), cancellable = true) - private void be_isPlayerStaring(Player player, CallbackInfoReturnable info) { +public abstract class EnderManMixin { + @Inject(method = "isLookingAtMe", at = @At("HEAD"), cancellable = true) + private void be_isLookingAtMe(Player player, CallbackInfoReturnable info) { if (player.isCreative() || player.hasEffect(EndStatusEffects.END_VEIL) || EnchantmentHelper.getItemEnchantmentLevel(EndEnchantments.END_VEIL, player.getItemBySlot(EquipmentSlot.HEAD)) > 0) { info.setReturnValue(false); diff --git a/src/main/java/ru/betterend/mixin/common/EntityMixin.java b/src/main/java/ru/betterend/mixin/common/EntityMixin.java index c48e323a..21a3c5dd 100644 --- a/src/main/java/ru/betterend/mixin/common/EntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/EntityMixin.java @@ -17,11 +17,10 @@ import ru.betterend.interfaces.TeleportingEntity; @Mixin(Entity.class) public abstract class EntityMixin implements TeleportingEntity { - @Shadow - public float yaw; + public float yRot; @Shadow - public float pitch; + public float xRot; @Shadow public boolean removed; @Shadow @@ -42,9 +41,9 @@ public abstract class EntityMixin implements TeleportingEntity { private BlockPos exitPos; - @Inject(method = "moveToWorld", at = @At("HEAD"), cancellable = true) - public void be_moveToWorld(ServerLevel destination, CallbackInfoReturnable info) { - if (!removed && beCanTeleport() && world instanceof ServerLevel) { + @Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true) + public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable info) { + if (!removed && be_canTeleport() && world instanceof ServerLevel) { this.detach(); this.world.getProfiler().push("changeDimension"); this.world.getProfiler().push("reposition"); @@ -63,31 +62,31 @@ public abstract class EntityMixin implements TeleportingEntity { ((ServerLevel) world).resetEmptyTime(); destination.resetEmptyTime(); this.world.getProfiler().pop(); - this.beResetExitPos(); + this.be_resetExitPos(); info.setReturnValue(entity); } } } - @Inject(method = "getTeleportTarget", at = @At("HEAD"), cancellable = true) - protected void be_getTeleportTarget(ServerLevel destination, CallbackInfoReturnable info) { - if (beCanTeleport()) { - info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getVelocity(), yaw, pitch)); + @Inject(method = "findDimensionEntryPoint", at = @At("HEAD"), cancellable = true) + protected void be_findDimensionEntryPoint(ServerLevel destination, CallbackInfoReturnable info) { + if (be_canTeleport()) { + info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getVelocity(), yRot, xRot)); } } @Override - public void beSetExitPos(BlockPos pos) { + public void be_setExitPos(BlockPos pos) { this.exitPos = pos.immutable(); } @Override - public void beResetExitPos() { + public void be_resetExitPos() { this.exitPos = null; } @Override - public boolean beCanTeleport() { + public boolean be_canTeleport() { return this.exitPos != null; } } diff --git a/src/main/java/ru/betterend/mixin/common/LivingEntityMixin.java b/src/main/java/ru/betterend/mixin/common/LivingEntityMixin.java index 8b9cb630..d2d4950d 100644 --- a/src/main/java/ru/betterend/mixin/common/LivingEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/LivingEntityMixin.java @@ -16,15 +16,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LivingEntity.class) public abstract class LivingEntityMixin { - private Entity lastAttacker; - @Inject(method = "damage", at = @At("HEAD")) - public void be_damage(DamageSource source, float amount, CallbackInfoReturnable info) { + @Inject(method = "hurt", at = @At("HEAD")) + public void be_hurt(DamageSource source, float amount, CallbackInfoReturnable info) { this.lastAttacker = source.getEntity(); } - @ModifyArg(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;takeKnockback(FDD)V")) + @ModifyArg(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;knockback(FDD)V")) private float be_increaseKnockback(float value, double x, double z) { if (lastAttacker != null && lastAttacker instanceof LivingEntity) { LivingEntity attacker = (LivingEntity) lastAttacker; @@ -35,8 +34,7 @@ public abstract class LivingEntityMixin { private double be_getKnockback(Item tool) { if (tool == null) return 0.0D; - Collection modifiers = tool.getDefaultAttributeModifiers(EquipmentSlot.MAINHAND) - .get(Attributes.ATTACK_KNOCKBACK); + Collection modifiers = tool.getDefaultAttributeModifiers(EquipmentSlot.MAINHAND).get(Attributes.ATTACK_KNOCKBACK); if (modifiers.size() > 0) { return modifiers.iterator().next().getAmount(); } diff --git a/src/main/java/ru/betterend/mixin/common/MinecraftServerMixin.java b/src/main/java/ru/betterend/mixin/common/MinecraftServerMixin.java index 99d7e49c..14d5fa1d 100644 --- a/src/main/java/ru/betterend/mixin/common/MinecraftServerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/MinecraftServerMixin.java @@ -29,73 +29,73 @@ import ru.betterend.world.generator.GeneratorOptions; @Mixin(MinecraftServer.class) public class MinecraftServerMixin { @Shadow - private ServerResources serverResourceManager; + private ServerResources resources; @Final @Shadow - private Map, ServerLevel> worlds; + private Map, ServerLevel> levels; @Final @Shadow - protected WorldData saveProperties; + protected WorldData worldData; @Inject(method = "reloadResources", at = @At(value = "RETURN"), cancellable = true) - private void beOnReload(Collection collection, CallbackInfoReturnable> info) { - beInjectRecipes(); + private void be_reloadResources(Collection collection, CallbackInfoReturnable> info) { + be_injectRecipes(); } - @Inject(method = "loadWorld", at = @At(value = "RETURN"), cancellable = true) - private void beOnLoadWorld(CallbackInfo info) { - beInjectRecipes(); + @Inject(method = "loadLevel", at = @At(value = "RETURN"), cancellable = true) + private void be_loadLevel(CallbackInfo info) { + be_injectRecipes(); EndBiomes.initRegistry((MinecraftServer) (Object) this); } - @Inject(method = "getOverworld", at = @At(value = "HEAD"), cancellable = true) - private final void beGetOverworld(CallbackInfoReturnable info) { + @Inject(method = "overworld", at = @At(value = "HEAD"), cancellable = true) + private final void be_overworld(CallbackInfoReturnable info) { if (GeneratorOptions.swapOverworldToEnd()) { - ServerLevel world = worlds.get(Level.END); + ServerLevel world = levels.get(Level.END); if (world == null) { - world = worlds.get(Level.OVERWORLD); + world = levels.get(Level.OVERWORLD); } info.setReturnValue(world); info.cancel(); } } - @Inject(method = "createWorlds", at = @At(value = "TAIL")) - private final void be_CreateWorlds(ChunkProgressListener worldGenerationProgressListener, CallbackInfo info) { + @Inject(method = "createLevels", at = @At(value = "TAIL")) + private final void be_createLevels(ChunkProgressListener worldGenerationProgressListener, CallbackInfo info) { if (GeneratorOptions.swapOverworldToEnd()) { - ServerLevel world = worlds.get(Level.END); + ServerLevel world = levels.get(Level.END); if (world == null) { - world = worlds.get(Level.OVERWORLD); + world = levels.get(Level.OVERWORLD); } - this.getPlayerManager().setLevel(world); - ServerLevelData serverWorldProperties = saveProperties.overworldData(); - net.minecraft.world.level.levelgen.WorldGenSettings generatorOptions = saveProperties.worldGenSettings(); + this.getPlayerList().setLevel(world); + ServerLevelData serverWorldProperties = worldData.overworldData(); + net.minecraft.world.level.levelgen.WorldGenSettings generatorOptions = worldData.worldGenSettings(); boolean bl = generatorOptions.isDebug(); - setupSpawn(world, serverWorldProperties, generatorOptions.generateBonusChest(), bl, true); + setInitialSpawn(world, serverWorldProperties, generatorOptions.generateBonusChest(), bl, true); } } - @Inject(method = "setupSpawn", at = @At(value = "HEAD"), cancellable = true) - private static void be_SetupSpawn(ServerLevel world, ServerLevelData serverWorldProperties, boolean bonusChest, boolean debugWorld, boolean bl, CallbackInfo info) { + @Inject(method = "setInitialSpawn", at = @At(value = "HEAD"), cancellable = true) + private static void be_setInitialSpawn(ServerLevel world, ServerLevelData serverWorldProperties, boolean bonusChest, boolean debugWorld, boolean bl, CallbackInfo info) { if (GeneratorOptions.swapOverworldToEnd() && world.dimension() == Level.OVERWORLD) { info.cancel(); } } @Shadow - private static void setupSpawn(ServerLevel world, ServerLevelData serverWorldProperties, boolean bonusChest, boolean debugWorld, boolean bl) {} + private static void setInitialSpawn(ServerLevel world, ServerLevelData serverWorldProperties, boolean bonusChest, boolean debugWorld, boolean bl) {} @Shadow - public PlayerList getPlayerManager() { + public PlayerList getPlayerList() { return null; } - private void beInjectRecipes() { + private void be_injectRecipes() { if (FabricLoader.getInstance().isModLoaded("kubejs")) { - RecipeManagerAccessor accessor = (RecipeManagerAccessor) serverResourceManager.getRecipeManager(); - accessor.setRecipes(EndRecipeManager.getMap(accessor.getRecipes())); + RecipeManagerAccessor accessor = (RecipeManagerAccessor) resources.getRecipeManager(); + accessor.be_setRecipes(EndRecipeManager.getMap(accessor.be_getRecipes())); } } } diff --git a/src/main/java/ru/betterend/mixin/common/HostileEntityMixin.java b/src/main/java/ru/betterend/mixin/common/MonsterMixin.java similarity index 73% rename from src/main/java/ru/betterend/mixin/common/HostileEntityMixin.java rename to src/main/java/ru/betterend/mixin/common/MonsterMixin.java index 9186f9f1..d3f85e17 100644 --- a/src/main/java/ru/betterend/mixin/common/HostileEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/MonsterMixin.java @@ -15,9 +15,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Monster.class) -public class HostileEntityMixin { - @Inject(method = "canSpawnInDark", at = @At(value = "RETURN"), cancellable = true) - private static void be_endermenCheck(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos pos, Random random, CallbackInfoReturnable info) { +public class MonsterMixin { + @Inject(method = "checkMonsterSpawnRules", at = @At(value = "RETURN"), cancellable = true) + private static void be_checkMonsterSpawnRules(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos pos, Random random, CallbackInfoReturnable info) { boolean canSpawn = info.getReturnValue(); if (canSpawn && spawnReason == MobSpawnType.NATURAL && type == EntityType.ENDERMAN) { AABB box = new AABB(pos).inflate(16); diff --git a/src/main/java/ru/betterend/mixin/common/NoiseChunkGeneratorMixin.java b/src/main/java/ru/betterend/mixin/common/NoiseBasedChunkGeneratorMixin.java similarity index 60% rename from src/main/java/ru/betterend/mixin/common/NoiseChunkGeneratorMixin.java rename to src/main/java/ru/betterend/mixin/common/NoiseBasedChunkGeneratorMixin.java index 95c4ccf4..7fcd2978 100644 --- a/src/main/java/ru/betterend/mixin/common/NoiseChunkGeneratorMixin.java +++ b/src/main/java/ru/betterend/mixin/common/NoiseBasedChunkGeneratorMixin.java @@ -16,28 +16,25 @@ import ru.betterend.world.generator.GeneratorOptions; import ru.betterend.world.generator.TerrainGenerator; @Mixin(NoiseBasedChunkGenerator.class) -public abstract class NoiseChunkGeneratorMixin extends ChunkGenerator { +public abstract class NoiseBasedChunkGeneratorMixin extends ChunkGenerator { @Final @Shadow protected Supplier settings; - public NoiseChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource, StructureSettings structuresConfig, long worldSeed) { + public NoiseBasedChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource, StructureSettings structuresConfig, long worldSeed) { super(populationSource, biomeSource, structuresConfig, worldSeed); } - @Inject(method = "(Lnet/minecraft/world/biome/source/BiomeSource;Lnet/minecraft/world/biome/source/BiomeSource;JLjava/util/function/Supplier;)V", at = @At("TAIL")) + @Inject(method = "(Lnet/minecraft/world/level/biome/BiomeSource;Lnet/minecraft/world/level/biome/BiomeSource;JLjava/util/function/Supplier;)V", at = @At("TAIL")) private void beOnInit(BiomeSource populationSource, BiomeSource biomeSource, long seed, Supplier settings, CallbackInfo info) { TerrainGenerator.initNoise(seed); } - @Inject(method = "sampleNoiseColumn([DII)V", at = @At("HEAD"), cancellable = true, allow = 2) - private void beSampleNoiseColumn(double[] buffer, int x, int z, CallbackInfo info) { + @Inject(method = "fillNoiseColumn([DII)V", at = @At("HEAD"), cancellable = true, allow = 2) + private void be_fillNoiseColumn(double[] buffer, int x, int z, CallbackInfo info) { if (GeneratorOptions.useNewGenerator() && settings.get().stable(NoiseGeneratorSettings.END)) { - //System.out.println(TerrainGenerator.canGenerate(x, z)); - //if (TerrainGenerator.canGenerate(x, z)) { - TerrainGenerator.fillTerrainDensity(buffer, x, z, getBiomeSource()); - info.cancel(); - //} + TerrainGenerator.fillTerrainDensity(buffer, x, z, getBiomeSource()); + info.cancel(); } } } diff --git a/src/main/java/ru/betterend/mixin/common/PlayerAdvancementTrackerMixin.java b/src/main/java/ru/betterend/mixin/common/PlayerAdvancementsMixin.java similarity index 62% rename from src/main/java/ru/betterend/mixin/common/PlayerAdvancementTrackerMixin.java rename to src/main/java/ru/betterend/mixin/common/PlayerAdvancementsMixin.java index 2900fa3a..e3bfcc97 100644 --- a/src/main/java/ru/betterend/mixin/common/PlayerAdvancementTrackerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/PlayerAdvancementsMixin.java @@ -1,27 +1,26 @@ -package ru.betterend.mixin.common; - -import net.minecraft.advancements.Advancement; -import net.minecraft.server.PlayerAdvancements; -import net.minecraft.server.level.ServerPlayer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import ru.betterend.events.PlayerAdvancementsEvents; - -@Mixin(PlayerAdvancements.class) -public abstract class PlayerAdvancementTrackerMixin { - - @Shadow - private ServerPlayer owner; - - @Inject(method = "grantCriterion", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/advancement/AdvancementRewards;apply(Lnet/minecraft/server/network/ServerPlayerEntity;)V", - shift = Shift.AFTER)) - public void be_onAdvancementComplete(Advancement advancement, String criterionName, CallbackInfoReturnable info) { - PlayerAdvancementsEvents.PLAYER_ADVENCEMENT_COMPLETE.invoker().onAdvancementComplete(owner, advancement, criterionName); - } -} +package ru.betterend.mixin.common; + +import net.minecraft.advancements.Advancement; +import net.minecraft.server.PlayerAdvancements; +import net.minecraft.server.level.ServerPlayer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import ru.betterend.events.PlayerAdvancementsEvents; + +@Mixin(PlayerAdvancements.class) +public abstract class PlayerAdvancementsMixin { + @Shadow + private ServerPlayer player; + + @Inject(method = "award", at = @At( + value = "INVOKE", + target = "Lnet/minecraft/server/PlayerAdvancements;grant(Lnet/minecraft/server/level/ServerPlayer;)V", + shift = Shift.AFTER)) + public void be_award(Advancement advancement, String criterionName, CallbackInfoReturnable info) { + PlayerAdvancementsEvents.PLAYER_ADVENCEMENT_COMPLETE.invoker().onAdvancementComplete(player, advancement, criterionName); + } +} diff --git a/src/main/java/ru/betterend/mixin/common/PlayerManagerMixin.java b/src/main/java/ru/betterend/mixin/common/PlayerListMixin.java similarity index 82% rename from src/main/java/ru/betterend/mixin/common/PlayerManagerMixin.java rename to src/main/java/ru/betterend/mixin/common/PlayerListMixin.java index 32b06ec6..408fb3fa 100644 --- a/src/main/java/ru/betterend/mixin/common/PlayerManagerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/PlayerListMixin.java @@ -59,7 +59,7 @@ import net.minecraft.world.level.storage.LevelData; import ru.betterend.world.generator.GeneratorOptions; @Mixin(PlayerList.class) -public class PlayerManagerMixin { +public class PlayerListMixin { @Final @Shadow private static Logger LOGGER; @@ -70,7 +70,7 @@ public class PlayerManagerMixin { @Final @Shadow - private RegistryAccess.RegistryHolder registryManager; + private RegistryAccess.RegistryHolder registryHolder; @Shadow private int viewDistance; @@ -81,17 +81,17 @@ public class PlayerManagerMixin { @Final @Shadow - private Map playerMap; + private Map playersByUUID; - @Inject(method = "onPlayerConnect", at = @At(value = "HEAD"), cancellable = true) - public void be_onPlayerConnect(Connection connection, ServerPlayer player, CallbackInfo info) { + @Inject(method = "placeNewPlayer", at = @At(value = "HEAD"), cancellable = true) + public void be_placeNewPlayer(Connection connection, ServerPlayer player, CallbackInfo info) { if (GeneratorOptions.swapOverworldToEnd()) { GameProfile gameProfile = player.getGameProfile(); GameProfileCache userCache = this.server.getProfileCache(); GameProfile gameProfile2 = userCache.get(gameProfile.getId()); String string = gameProfile2 == null ? gameProfile.getName() : gameProfile2.getName(); userCache.add(gameProfile); - CompoundTag compoundTag = this.loadPlayerData(player); + CompoundTag compoundTag = this.load(player); ResourceKey var23; if (compoundTag != null) { DataResult> var10000 = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, compoundTag.get("Dimension"))); @@ -123,13 +123,13 @@ public class PlayerManagerMixin { LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", player.getName().getString(), string2, player.getId(), player.getX(), player.getY(), player.getZ()); LevelData worldProperties = serverWorld3.getLevelData(); - this.setGameMode(player, (ServerPlayer) null, serverWorld3); + this.updatePlayerGameMode(player, (ServerPlayer) null, serverWorld3); ServerGamePacketListenerImpl serverPlayNetworkHandler = new ServerGamePacketListenerImpl(this.server, connection, player); GameRules gameRules = serverWorld3.getGameRules(); boolean bl = gameRules.getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN); boolean bl2 = gameRules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); serverPlayNetworkHandler.send(new ClientboundLoginPacket(player.getId(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), BiomeManager.obfuscateSeed(serverWorld3.getSeed()), - worldProperties.isHardcore(), this.server.levelKeys(), this.registryManager, serverWorld3.dimensionType(), serverWorld3.dimension(), this.getMaxPlayerCount(), this.viewDistance, bl2, !bl, + worldProperties.isHardcore(), this.server.levelKeys(), this.registryHolder, serverWorld3.dimensionType(), serverWorld3.dimension(), this.getPlayerCount(), this.viewDistance, bl2, !bl, serverWorld3.isDebug(), serverWorld3.isFlat())); serverPlayNetworkHandler.send(new ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.BRAND, (new FriendlyByteBuf(Unpooled.buffer())).writeUtf(this.getServer().getServerModName()))); serverPlayNetworkHandler.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked())); @@ -137,10 +137,10 @@ public class PlayerManagerMixin { serverPlayNetworkHandler.send(new ClientboundSetCarriedItemPacket(player.inventory.selected)); serverPlayNetworkHandler.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes())); serverPlayNetworkHandler.send(new ClientboundUpdateTagsPacket(this.server.getTags())); - this.sendCommandTree(player); + this.sendPlayerPermissionLevel(player); player.getStats().markAllDirty(); player.getRecipeBook().sendInitialRecipeBook(player); - this.sendScoreboard(serverWorld3.getScoreboard(), player); + this.updateEntireScoreboard(serverWorld3.getScoreboard(), player); this.server.invalidateStatus(); TranslatableComponent mutableText2; if (player.getGameProfile().getName().equalsIgnoreCase(string)) { @@ -150,11 +150,11 @@ public class PlayerManagerMixin { mutableText2 = new TranslatableComponent("multiplayer.player.joined.renamed", new Object[] { player.getDisplayName(), string }); } - this.broadcastChatMessage(mutableText2.withStyle(ChatFormatting.YELLOW), ChatType.SYSTEM, Util.NIL_UUID); + this.broadcastMessage(mutableText2.withStyle(ChatFormatting.YELLOW), ChatType.SYSTEM, Util.NIL_UUID); serverPlayNetworkHandler.teleport(player.getX(), player.getY(), player.getZ(), player.yRot, player.xRot); this.players.add(player); - this.playerMap.put(player.getUUID(), player); - this.sendToAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[] { player })); + this.playersByUUID.put(player.getUUID(), player); + this.broadcastAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[] { player })); for (int i = 0; i < this.players.size(); ++i) { player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[] { (ServerPlayer) this.players.get(i) })); @@ -162,7 +162,7 @@ public class PlayerManagerMixin { serverWorld3.addNewPlayer(player); this.server.getCustomBossEvents().onPlayerConnect(player); - this.sendWorldInfo(player, serverWorld3); + this.sendLevelInfo(player, serverWorld3); if (!this.server.getResourcePack().isEmpty()) { player.sendTexturePack(this.server.getResourcePack(), this.server.getResourcePackHash()); } @@ -224,18 +224,18 @@ public class PlayerManagerMixin { } @Shadow - public CompoundTag loadPlayerData(ServerPlayer player) { + public CompoundTag load(ServerPlayer player) { return null; } @Shadow - private void setGameMode(ServerPlayer player, @Nullable ServerPlayer oldPlayer, ServerLevel world) {} + private void updatePlayerGameMode(ServerPlayer player, @Nullable ServerPlayer oldPlayer, ServerLevel world) {} @Shadow - public void sendCommandTree(ServerPlayer player) {} + public void sendPlayerPermissionLevel(ServerPlayer player) {} @Shadow - public int getMaxPlayerCount() { + public int getPlayerCount() { return 0; } @@ -245,14 +245,14 @@ public class PlayerManagerMixin { } @Shadow - protected void sendScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {} + protected void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {} @Shadow - public void broadcastChatMessage(Component message, ChatType type, UUID senderUuid) {} + public void broadcastMessage(Component message, ChatType type, UUID senderUuid) {} @Shadow - public void sendToAll(Packet packet) {} + public void broadcastAll(Packet packet) {} @Shadow - public void sendWorldInfo(ServerPlayer player, ServerLevel world) {} + public void sendLevelInfo(ServerPlayer player, ServerLevel world) {} } diff --git a/src/main/java/ru/betterend/mixin/common/PlayerEntityMixin.java b/src/main/java/ru/betterend/mixin/common/PlayerMixin.java similarity index 65% rename from src/main/java/ru/betterend/mixin/common/PlayerEntityMixin.java rename to src/main/java/ru/betterend/mixin/common/PlayerMixin.java index 9ffc8d67..46a1c6dc 100644 --- a/src/main/java/ru/betterend/mixin/common/PlayerEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/PlayerMixin.java @@ -18,30 +18,30 @@ import ru.betterend.util.BlocksHelper; import ru.betterend.util.MHelper; @Mixin(Player.class) -public abstract class PlayerEntityMixin { - private static Direction[] HORIZONTAL; +public abstract class PlayerMixin { + private static Direction[] horizontal; - @Inject(method = "findRespawnPosition", at = @At(value = "HEAD"), cancellable = true) - private static void be_statueRespawn(ServerLevel world, BlockPos pos, float f, boolean bl, boolean bl2, CallbackInfoReturnable> info) { + @Inject(method = "findRespawnPositionAndUseSpawnBlock", at = @At(value = "HEAD"), cancellable = true) + private static void be_findRespawnPositionAndUseSpawnBlock(ServerLevel world, BlockPos pos, float f, boolean bl, boolean bl2, CallbackInfoReturnable> info) { BlockState blockState = world.getBlockState(pos); if (blockState.is(EndBlocks.RESPAWN_OBELISK)) { - info.setReturnValue(beObeliskRespawnPosition(world, pos, blockState)); + info.setReturnValue(be_obeliskRespawnPosition(world, pos, blockState)); info.cancel(); } } - private static Optional beObeliskRespawnPosition(ServerLevel world, BlockPos pos, BlockState state) { + private static Optional be_obeliskRespawnPosition(ServerLevel world, BlockPos pos, BlockState state) { if (state.getValue(BlockProperties.TRIPLE_SHAPE) == TripleShape.TOP) { pos = pos.below(2); } else if (state.getValue(BlockProperties.TRIPLE_SHAPE) == TripleShape.MIDDLE) { pos = pos.below(); } - if (HORIZONTAL == null) { - HORIZONTAL = BlocksHelper.makeHorizontal(); + if (horizontal == null) { + horizontal = BlocksHelper.makeHorizontal(); } - MHelper.shuffle(HORIZONTAL, world.getRandom()); - for (Direction dir: HORIZONTAL) { + MHelper.shuffle(horizontal, world.getRandom()); + for (Direction dir: horizontal) { BlockPos p = pos.relative(dir); BlockState state2 = world.getBlockState(p); if (!state2.getMaterial().blocksMotion() && state2.getCollisionShape(world, pos).isEmpty()) { diff --git a/src/main/java/ru/betterend/mixin/common/BrewingAccessor.java b/src/main/java/ru/betterend/mixin/common/PotionBrewingAccessor.java similarity index 88% rename from src/main/java/ru/betterend/mixin/common/BrewingAccessor.java rename to src/main/java/ru/betterend/mixin/common/PotionBrewingAccessor.java index f1987282..d863d6cb 100644 --- a/src/main/java/ru/betterend/mixin/common/BrewingAccessor.java +++ b/src/main/java/ru/betterend/mixin/common/PotionBrewingAccessor.java @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(PotionBrewing.class) -public interface BrewingAccessor { +public interface PotionBrewingAccessor { @Invoker static void callAddMix(Potion input, Item item, Potion output) { throw new AssertionError("@Invoker dummy body called"); diff --git a/src/main/java/ru/betterend/mixin/common/RecipeManagerAccessor.java b/src/main/java/ru/betterend/mixin/common/RecipeManagerAccessor.java index 5f680919..1f3e2fb8 100644 --- a/src/main/java/ru/betterend/mixin/common/RecipeManagerAccessor.java +++ b/src/main/java/ru/betterend/mixin/common/RecipeManagerAccessor.java @@ -11,8 +11,8 @@ import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(RecipeManager.class) public interface RecipeManagerAccessor { @Accessor("recipes") - Map, Map>> getRecipes(); + Map, Map>> be_getRecipes(); @Accessor("recipes") - void setRecipes(Map, Map>> recipes); + void be_setRecipes(Map, Map>> recipes); } \ No newline at end of file diff --git a/src/main/java/ru/betterend/mixin/common/RecipeManagerMixin.java b/src/main/java/ru/betterend/mixin/common/RecipeManagerMixin.java index 5baffe2a..cd21aa6c 100644 --- a/src/main/java/ru/betterend/mixin/common/RecipeManagerMixin.java +++ b/src/main/java/ru/betterend/mixin/common/RecipeManagerMixin.java @@ -30,7 +30,7 @@ public class RecipeManagerMixin { private Map, Map>> recipes; @Inject(method = "apply", at = @At(value = "RETURN")) - private void beSetRecipes(Map map, ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfo info) { + private void be_apply(Map map, ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfo info) { recipes = EndRecipeManager.getMap(recipes); } @@ -46,7 +46,7 @@ public class RecipeManagerMixin { * (example - mod stone with vanilla tags and furnace from that stone) */ @Overwrite - public > Optional getFirstMatch(RecipeType type, C inventory, Level world) { + public > Optional getRecipeFor(RecipeType type, C inventory, Level world) { Collection> values = getAllOfType(type).values(); List> list = new ArrayList>(values); list.sort((v1, v2) -> { diff --git a/src/main/java/ru/betterend/mixin/common/ServerWorldMixin.java b/src/main/java/ru/betterend/mixin/common/ServerLevelMixin.java similarity index 92% rename from src/main/java/ru/betterend/mixin/common/ServerWorldMixin.java rename to src/main/java/ru/betterend/mixin/common/ServerLevelMixin.java index 39e90b32..0656ed29 100644 --- a/src/main/java/ru/betterend/mixin/common/ServerWorldMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ServerLevelMixin.java @@ -32,7 +32,7 @@ import ru.betterend.util.WorldDataUtil; import ru.betterend.world.generator.GeneratorOptions; @Mixin(ServerLevel.class) -public class ServerWorldMixin { +public class ServerLevelMixin { private static final int DEV_VERSION = be_getVersionInt("63.63.63"); private static final int FIX_VERSION = DEV_VERSION; private static String lastWorld = null; @@ -70,8 +70,8 @@ public class ServerWorldMixin { } } - @Inject(method = "getSpawnPos", at = @At("HEAD"), cancellable = true) - private void be_getSpawnPos(CallbackInfoReturnable info) { + @Inject(method = "getSharedSpawnPos", at = @At("HEAD"), cancellable = true) + private void be_getSharedSpawnPos(CallbackInfoReturnable info) { if (GeneratorOptions.changeSpawn()) { if (((ServerLevel) (Object) this).dimension() == Level.END) { info.setReturnValue(GeneratorOptions.getSpawn()); diff --git a/src/main/java/ru/betterend/mixin/common/ServerPlayerEntityMixin.java b/src/main/java/ru/betterend/mixin/common/ServerPlayerMixin.java similarity index 64% rename from src/main/java/ru/betterend/mixin/common/ServerPlayerEntityMixin.java rename to src/main/java/ru/betterend/mixin/common/ServerPlayerMixin.java index bda5a594..fd9bbb68 100644 --- a/src/main/java/ru/betterend/mixin/common/ServerPlayerEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/ServerPlayerMixin.java @@ -33,28 +33,27 @@ import ru.betterend.interfaces.TeleportingEntity; import ru.betterend.world.generator.GeneratorOptions; @Mixin(ServerPlayer.class) -public abstract class ServerPlayerEntityMixin extends Player implements TeleportingEntity { - +public abstract class ServerPlayerMixin extends Player implements TeleportingEntity { @Shadow - public ServerGamePacketListenerImpl networkHandler; + public ServerGamePacketListenerImpl connection; @Final @Shadow - public ServerPlayerGameMode interactionManager; + public ServerPlayerGameMode gameMode; @Final @Shadow public MinecraftServer server; @Shadow - private boolean inTeleportationState; + private boolean isChangingDimension; @Shadow - private float syncedHealth; + private float lastSentHealth; @Shadow - private int syncedFoodLevel; + private int lastSentFood; @Shadow - private int syncedExperience; + private int lastSentExp; private BlockPos exitPos; - public ServerPlayerEntityMixin(Level world, BlockPos pos, float yaw, GameProfile profile) { + public ServerPlayerMixin(Level world, BlockPos pos, float yaw, GameProfile profile) { super(world, pos, yaw, profile); } @@ -67,21 +66,21 @@ public abstract class ServerPlayerEntityMixin extends Player implements Teleport @Inject(method = "getTeleportTarget", at = @At("HEAD"), cancellable = true) protected void be_getTeleportTarget(ServerLevel destination, CallbackInfoReturnable info) { - if (beCanTeleport()) { + if (be_canTeleport()) { info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getDeltaMovement(), yRot, xRot)); } } - @Inject(method = "moveToWorld", at = @At("HEAD"), cancellable = true) - public void be_moveToWorld(ServerLevel destination, CallbackInfoReturnable info) { - if (beCanTeleport() && level instanceof ServerLevel) { - this.inTeleportationState = true; - ServerLevel serverWorld = this.getServerWorld(); + @Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true) + public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable info) { + if (be_canTeleport() && level instanceof ServerLevel) { + this.isChangingDimension = true; + ServerLevel serverWorld = this.getLevel(); LevelData worldProperties = destination.getLevelData(); ServerPlayer player = ServerPlayer.class.cast(this); - this.networkHandler.send(new ClientboundRespawnPacket(destination.dimensionType(), destination.dimension(), BiomeManager.obfuscateSeed(destination.getSeed()), - interactionManager.getGameModeForPlayer(),interactionManager.getPreviousGameModeForPlayer(), destination.isDebug(), destination.isFlat(), true)); - this.networkHandler.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked())); + this.connection.send(new ClientboundRespawnPacket(destination.dimensionType(), destination.dimension(), BiomeManager.obfuscateSeed(destination.getSeed()), + gameMode.getGameModeForPlayer(),gameMode.getPreviousGameModeForPlayer(), destination.isDebug(), destination.isFlat(), true)); + this.connection.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked())); PlayerList playerManager = this.server.getPlayerList(); playerManager.sendPlayerPermissionLevel(player); serverWorld.removePlayerImmediately(player); @@ -96,48 +95,48 @@ public abstract class ServerPlayerEntityMixin extends Player implements Teleport this.setRot(teleportTarget.yRot, teleportTarget.xRot); this.moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z); serverWorld.getProfiler().pop(); - this.worldChanged(serverWorld); - this.interactionManager.setLevel(destination); - this.networkHandler.send(new ClientboundPlayerAbilitiesPacket(this.abilities)); + this.triggerDimensionChangeTriggers(serverWorld); + this.gameMode.setLevel(destination); + this.connection.send(new ClientboundPlayerAbilitiesPacket(this.abilities)); playerManager.sendLevelInfo(player, destination); playerManager.sendAllPlayerInfo(player); for (MobEffectInstance statusEffectInstance : this.getActiveEffects()) { - this.networkHandler.send(new ClientboundUpdateMobEffectPacket(getId(), statusEffectInstance)); + this.connection.send(new ClientboundUpdateMobEffectPacket(getId(), statusEffectInstance)); } - this.networkHandler.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false)); - this.syncedExperience = -1; - this.syncedHealth = -1.0F; - this.syncedFoodLevel = -1; + this.connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false)); + this.lastSentExp = -1; + this.lastSentHealth = -1.0F; + this.lastSentFood = -1; } - this.beResetExitPos(); + this.be_resetExitPos(); info.setReturnValue(player); } } @Shadow - abstract ServerLevel getServerWorld(); + abstract ServerLevel getLevel(); @Shadow - abstract void worldChanged(ServerLevel origin); + abstract void triggerDimensionChangeTriggers(ServerLevel origin); @Shadow @Override protected abstract PortalInfo findDimensionEntryPoint(ServerLevel destination); @Override - public void beSetExitPos(BlockPos pos) { + public void be_setExitPos(BlockPos pos) { this.exitPos = pos.immutable(); } @Override - public void beResetExitPos() { + public void be_resetExitPos() { this.exitPos = null; } @Override - public boolean beCanTeleport() { + public boolean be_canTeleport() { return this.exitPos != null; } } diff --git a/src/main/java/ru/betterend/mixin/common/SlimeEntityMixin.java b/src/main/java/ru/betterend/mixin/common/SlimeMixin.java similarity index 73% rename from src/main/java/ru/betterend/mixin/common/SlimeEntityMixin.java rename to src/main/java/ru/betterend/mixin/common/SlimeMixin.java index 151180d7..8dec140b 100644 --- a/src/main/java/ru/betterend/mixin/common/SlimeEntityMixin.java +++ b/src/main/java/ru/betterend/mixin/common/SlimeMixin.java @@ -6,12 +6,12 @@ import org.spongepowered.asm.mixin.Shadow; import ru.betterend.interfaces.ISlime; @Mixin(Slime.class) -public class SlimeEntityMixin implements ISlime { +public class SlimeMixin implements ISlime { @Shadow protected void setSize(int size, boolean heal) {} @Override - public void beSetSlimeSize(int size, boolean heal) { + public void be_setSlimeSize(int size, boolean heal) { setSize(size, heal); } } diff --git a/src/main/java/ru/betterend/mixin/common/EndSpikeFeatureMixin.java b/src/main/java/ru/betterend/mixin/common/SpikeFeatureMixin.java similarity index 89% rename from src/main/java/ru/betterend/mixin/common/EndSpikeFeatureMixin.java rename to src/main/java/ru/betterend/mixin/common/SpikeFeatureMixin.java index 10489789..4968ed91 100644 --- a/src/main/java/ru/betterend/mixin/common/EndSpikeFeatureMixin.java +++ b/src/main/java/ru/betterend/mixin/common/SpikeFeatureMixin.java @@ -31,16 +31,16 @@ import ru.betterend.util.WorldDataUtil; import ru.betterend.world.generator.GeneratorOptions; @Mixin(SpikeFeature.class) -public class EndSpikeFeatureMixin { - @Inject(method = "generate", at = @At("HEAD"), cancellable = true) - private void beSpikeGenerate(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SpikeConfiguration endSpikeFeatureConfig, CallbackInfoReturnable info) { +public class SpikeFeatureMixin { + @Inject(method = "place", at = @At("HEAD"), cancellable = true) + private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SpikeConfiguration endSpikeFeatureConfig, CallbackInfoReturnable info) { if (!GeneratorOptions.hasPillars()) { info.setReturnValue(false); } } - @Inject(method = "generateSpike", at = @At("HEAD"), cancellable = true) - private void be_generateSpike(ServerLevelAccessor world, Random random, SpikeConfiguration config, SpikeFeature.EndSpike spike, CallbackInfo info) { + @Inject(method = "placeSpike", at = @At("HEAD"), cancellable = true) + private void be_placeSpike(ServerLevelAccessor world, Random random, SpikeConfiguration config, SpikeFeature.EndSpike spike, CallbackInfo info) { int x = spike.getCenterX(); int z = spike.getCenterZ(); int radius = spike.getRadius(); diff --git a/src/main/java/ru/betterend/mixin/common/TagGroupLoaderMixin.java b/src/main/java/ru/betterend/mixin/common/TagLoaderMixin.java similarity index 94% rename from src/main/java/ru/betterend/mixin/common/TagGroupLoaderMixin.java rename to src/main/java/ru/betterend/mixin/common/TagLoaderMixin.java index bb201c67..42c555e6 100644 --- a/src/main/java/ru/betterend/mixin/common/TagGroupLoaderMixin.java +++ b/src/main/java/ru/betterend/mixin/common/TagLoaderMixin.java @@ -15,8 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import ru.betterend.util.TagHelper; @Mixin(TagLoader.class) -public class TagGroupLoaderMixin { - +public class TagLoaderMixin { @Shadow private String entryType; diff --git a/src/main/java/ru/betterend/registry/EndTags.java b/src/main/java/ru/betterend/registry/EndTags.java index e5238040..c6ec7ef3 100644 --- a/src/main/java/ru/betterend/registry/EndTags.java +++ b/src/main/java/ru/betterend/registry/EndTags.java @@ -92,7 +92,7 @@ public class EndTags { } else if (block instanceof LeavesBlock || block instanceof SimpleLeavesBlock) { TagHelper.addTag(BlockTags.LEAVES, block); - ComposterBlockAccessor.callRegisterCompostableItem(0.3F, block); + ComposterBlockAccessor.callAdd(0.3F, block); } else if (block instanceof VineBlock) { TagHelper.addTag(BlockTags.CLIMBABLE, block); @@ -103,7 +103,7 @@ public class EndTags { Material mat = block.defaultBlockState().getMaterial(); if (mat.equals(Material.PLANT) || mat.equals(Material.REPLACEABLE_PLANT)) { - ComposterBlockAccessor.callRegisterCompostableItem(0.1F, block); + ComposterBlockAccessor.callAdd(0.1F, block); } }); @@ -111,7 +111,7 @@ public class EndTags { if (item.isEdible()) { FoodProperties food = item.getFoodProperties(); float compost = food.getNutrition() * food.getSaturationModifier() * 0.18F; - ComposterBlockAccessor.callRegisterCompostableItem(compost, item); + ComposterBlockAccessor.callAdd(compost, item); } }); diff --git a/src/main/java/ru/betterend/util/FeaturesHelper.java b/src/main/java/ru/betterend/util/FeaturesHelper.java index e7dcf4e1..476f5071 100644 --- a/src/main/java/ru/betterend/util/FeaturesHelper.java +++ b/src/main/java/ru/betterend/util/FeaturesHelper.java @@ -10,7 +10,7 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import ru.betterend.mixin.common.GenerationSettingsAccessor; +import ru.betterend.mixin.common.BiomeGenerationSettingsAccessor; import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndStructures; @@ -20,9 +20,9 @@ public class FeaturesHelper { public static void addFeatures(Registry biomeRegistry) { biomeRegistry.forEach((biome) -> { if (biome.getBiomeCategory() == Biome.BiomeCategory.THEEND && !INJECTED.contains(biome)) { - GenerationSettingsAccessor accessor = (GenerationSettingsAccessor) biome.getGenerationSettings(); - List>> structures = Lists.newArrayList(accessor.beGetStructures()); - List>>> preFeatures = accessor.beGetFeatures(); + BiomeGenerationSettingsAccessor accessor = (BiomeGenerationSettingsAccessor) biome.getGenerationSettings(); + List>> structures = Lists.newArrayList(accessor.be_getStructures()); + List>>> preFeatures = accessor.be_getFeatures(); List>>> features = new ArrayList>>>(preFeatures.size()); preFeatures.forEach((list) -> { features.add(Lists.newArrayList(list)); @@ -31,8 +31,8 @@ public class FeaturesHelper { EndFeatures.registerBiomeFeatures(biomeRegistry.getKey(biome), biome, features); EndStructures.registerBiomeStructures(biomeRegistry.getKey(biome), biome, structures); - accessor.beSetFeatures(features); - accessor.beSetStructures(structures); + accessor.be_setFeatures(features); + accessor.be_setStructures(structures); INJECTED.add(biome); } }); diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java index f7f0f99d..ae049d10 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/EndCaveFeature.java @@ -119,7 +119,7 @@ public abstract class EndCaveFeature extends DefaultFeature { private void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) { IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomes(); if (array != null) { - array.setBiome(biome.getActualBiome(), pos); + array.be_setBiome(biome.getActualBiome(), pos); } } diff --git a/src/main/resources/betterend.mixins.common.json b/src/main/resources/betterend.mixins.common.json index 5ce208b8..88651502 100644 --- a/src/main/resources/betterend.mixins.common.json +++ b/src/main/resources/betterend.mixins.common.json @@ -4,39 +4,39 @@ "package": "ru.betterend.mixin.common", "compatibilityLevel": "JAVA_8", "mixins": [ - "EnchantmentScreenHandlerMixin", - "PlayerAdvancementTrackerMixin", - "CraftingScreenHandlerMixin", - "GenerationSettingsAccessor", - "NoiseChunkGeneratorMixin", + "BiomeGenerationSettingsAccessor", + "NoiseBasedChunkGeneratorMixin", + "ChunkBiomeContainerMixin", "WeightedBiomePickerMixin", - "AnvilScreenHandlerMixin", "ChorusPlantFeatureMixin", - "ServerPlayerEntityMixin", - "ComposterBlockAccessor", + "PlayerAdvancementsMixin", "ChorusFlowerBlockMixin", - "EndPortalFeatureMixin", + "ComposterBlockAccessor", "ChorusPlantBlockMixin", + "EndPodiumFeatureMixin", + "PotionBrewingAccessor", "RecipeManagerAccessor", - "EndSpikeFeatureMixin", + "EnchantmentMenuMixin", "MinecraftServerMixin", - "EndermanEntityMixin", - "TagGroupLoaderMixin", - "AbstractBlockMixin", + "BlockBehaviourMixin", "DimensionTypeMixin", - "PlayerManagerMixin", "RecipeManagerMixin", - "HostileEntityMixin", "ArmorItemAccessor", "BoneMealItemMixin", + "CraftingMenuMixin", "LivingEntityMixin", - "PlayerEntityMixin", - "ServerWorldMixin", - "SlimeEntityMixin", + "ServerPlayerMixin", + "SpikeFeatureMixin", "AnvilBlockMixin", - "BrewingAccessor", - "BiomeArrayMixin", - "EntityMixin" + "PlayerListMixin", + "ServerLevelMixin", + "AnvilMenuMixin", + "TagLoaderMixin", + "EnderManMixin", + "MonsterMixin", + "EntityMixin", + "PlayerMixin", + "SlimeMixin" ], "injectors": { "defaultRequire": 1