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