Continue migration
This commit is contained in:
parent
47ed597358
commit
33dbfbe633
263 changed files with 1450 additions and 1486 deletions
|
@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import net.minecraft.world.level.block.AnvilBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.player.PlayerInventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
|
@ -60,14 +60,14 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
public abstract void updateResult();
|
||||
|
||||
@Inject(method = "canTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_canTakeOutput(PlayerEntity player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
protected void be_canTakeOutput(Player player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.setReturnValue(be_currentRecipe.checkHammerDurability(input, player));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_onTakeOutput(PlayerEntity player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
protected void be_onTakeOutput(Player player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
this.input.getStack(0).decrement(be_currentRecipe.getInputCount());
|
||||
stack = be_currentRecipe.craft(input, player);
|
||||
|
@ -120,7 +120,7 @@ public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonClick(PlayerEntity player, int id) {
|
||||
public boolean onButtonClick(Player player, int id) {
|
||||
if (id == 0) {
|
||||
this.be_previousRecipe();
|
||||
return true;
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.world.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.world.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
|
||||
@Mixin(ArmorItem.class)
|
||||
|
@ -17,8 +17,8 @@ public interface ArmorItemAccessor {
|
|||
UUID[] be_getModifiers();
|
||||
|
||||
@Accessor("attributeModifiers")
|
||||
Multimap<EntityAttribute, EntityAttributeModifier> be_getAttributeModifiers();
|
||||
Multimap<Attribute, AttributeModifier> be_getAttributeModifiers();
|
||||
|
||||
@Accessor("attributeModifiers")
|
||||
void be_setAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers);
|
||||
void be_setAttributeModifiers(Multimap<Attribute, AttributeModifier> attributeModifiers);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeArray;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.biome.Biome.Category;
|
||||
import net.minecraft.world.level.biome.Biome.Category;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.crafting.BrewingRecipeRegistry;
|
||||
|
||||
@Mixin(BrewingRecipeRegistry.class)
|
||||
|
|
|
@ -12,10 +12,10 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.ChorusFlowerBlock;
|
||||
import net.minecraft.world.level.block.ConnectingBlock;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.ChorusPlantFeature;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.ChorusPlantFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -24,8 +24,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(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_onGenerate(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockPos blockPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (structureWorldAccess.isAir(blockPos)
|
||||
&& structureWorldAccess.getBlockState(blockPos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
|
||||
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
||||
|
|
|
@ -4,12 +4,12 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import net.minecraft.world.level.block.ComposterBlock;
|
||||
import net.minecraft.world.item.ItemConvertible;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
@Mixin(ComposterBlock.class)
|
||||
public interface ComposterBlockAccessor {
|
||||
@Invoker
|
||||
static void callRegisterCompostableItem(float levelIncreaseChance, ItemConvertible item) {
|
||||
static void callRegisterCompostableItem(float levelIncreaseChance, ItemLike item) {
|
||||
throw new AssertionError("@Invoker dummy body called");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.world.level.block.CraftingTableBlock;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.screen.CraftingScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerContext;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public abstract class CraftingScreenHandlerMixin {
|
|||
private ScreenHandlerContext context;
|
||||
|
||||
@Inject(method = "canUse", at = @At("HEAD"), cancellable = true)
|
||||
private void be_canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_canUse(Player player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (context.run((world, pos) -> {
|
||||
return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock;
|
||||
}, true)) {
|
||||
|
|
|
@ -6,9 +6,9 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
|
||||
import ru.betterend.world.generator.BetterEndBiomeSource;
|
||||
|
|
|
@ -7,35 +7,35 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.gen.ChunkRandom;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.EndCityFeature;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.EndCityFeature;
|
||||
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, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l,
|
||||
ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos,
|
||||
NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
int chance = GeneratorOptions.getEndCityFailChance();
|
||||
if (chance == 0) {
|
||||
info.setReturnValue(getGenerationHeight(i, j, chunkGenerator) >= 60);
|
||||
info.cancel();
|
||||
}
|
||||
else if (chunkRandom.nextInt(chance) == 0){
|
||||
} else if (chunkRandom.nextInt(chance) == 0) {
|
||||
info.setReturnValue(getGenerationHeight(i, j, chunkGenerator) >= 60);
|
||||
info.cancel();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private static int getGenerationHeight(int chunkX, int chunkZ, ChunkGenerator chunkGenerator) {
|
||||
return 0;
|
||||
|
|
|
@ -15,10 +15,10 @@ import net.minecraft.structure.Structure;
|
|||
import net.minecraft.structure.StructurePlacementData;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.EndPortalFeature;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.EndPortalFeature;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
import ru.betterend.util.WorldDataUtil;
|
||||
|
@ -31,8 +31,8 @@ public class EndPortalFeatureMixin {
|
|||
private boolean open;
|
||||
|
||||
@Inject(method = "generate", at = @At("HEAD"), cancellable = true)
|
||||
private void bePortalGenerate(StructureWorldAccess world, ChunkGenerator generator, Random random,
|
||||
BlockPos blockPos, DefaultFeatureConfig config, CallbackInfoReturnable<Boolean> info) {
|
||||
private void bePortalGenerate(WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration config, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPortal()) {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
|
@ -49,11 +49,11 @@ public class EndPortalFeatureMixin {
|
|||
}
|
||||
|
||||
@ModifyVariable(method = "generate", ordinal = 0, at = @At("HEAD"))
|
||||
private BlockPos be_setPosOnGround(BlockPos blockPos, StructureWorldAccess world) {
|
||||
private BlockPos be_setPosOnGround(BlockPos blockPos, WorldGenLevel world) {
|
||||
return be_updatePos(blockPos, world);
|
||||
}
|
||||
|
||||
private BlockPos be_updatePos(BlockPos blockPos, StructureWorldAccess world) {
|
||||
private BlockPos be_updatePos(BlockPos blockPos, WorldGenLevel world) {
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
BlockPos pos = GeneratorOptions.getPortalPos();
|
||||
if (pos.equals(BlockPos.ORIGIN)) {
|
||||
|
|
|
@ -20,11 +20,11 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.EndSpikeFeature;
|
||||
import net.minecraft.world.gen.feature.EndSpikeFeatureConfig;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.EndSpikeFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.EndSpikeFeatureConfig;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.StructureHelper;
|
||||
|
@ -34,16 +34,15 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
@Mixin(EndSpikeFeature.class)
|
||||
public class EndSpikeFeatureMixin {
|
||||
@Inject(method = "generate", at = @At("HEAD"), cancellable = true)
|
||||
private void beSpikeGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator,
|
||||
Random random, BlockPos blockPos, EndSpikeFeatureConfig endSpikeFeatureConfig,
|
||||
CallbackInfoReturnable<Boolean> info) {
|
||||
private void beSpikeGenerate(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random,
|
||||
BlockPos blockPos, EndSpikeFeatureConfig endSpikeFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPillars()) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "generateSpike", at = @At("HEAD"), cancellable = true)
|
||||
private void be_generateSpike(ServerWorldAccess world, Random random, EndSpikeFeatureConfig config,
|
||||
private void be_generateSpike(ServerLevelAccessor world, Random random, EndSpikeFeatureConfig config,
|
||||
EndSpikeFeature.Spike spike, CallbackInfo info) {
|
||||
int x = spike.getCenterX();
|
||||
int z = spike.getCenterZ();
|
||||
|
|
|
@ -8,16 +8,16 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.mob.EndermanEntity;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import ru.betterend.effects.EndEnchantments;
|
||||
import ru.betterend.effects.EndStatusEffects;
|
||||
import ru.betterend.effects.EndMobEffects;
|
||||
|
||||
@Mixin(EndermanEntity.class)
|
||||
public abstract class EndermanEntityMixin {
|
||||
|
||||
@Inject(method = "isPlayerStaring", at = @At("HEAD"), cancellable = true)
|
||||
private void be_isPlayerStaring(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (player.isCreative() || player.hasStatusEffect(EndStatusEffects.END_VEIL) || EnchantmentHelper
|
||||
private void be_isPlayerStaring(Player player, CallbackInfoReturnable<Boolean> info) {
|
||||
if (player.isCreative() || player.hasMobEffect(EndMobEffects.END_VEIL) || EnchantmentHelper
|
||||
.getLevel(EndEnchantments.END_VEIL, player.getEquippedStack(EquipmentSlot.HEAD)) > 0) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
|
||||
@Override
|
||||
public void beSetExitPos(BlockPos pos) {
|
||||
this.exitPos = pos.toImmutable();
|
||||
this.exitPos = pos.immutable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,20 +7,20 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.world.biome.GenerationSettings;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
|
||||
@Mixin(GenerationSettings.class)
|
||||
public interface GenerationSettingsAccessor {
|
||||
@Accessor("features")
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> beGetFeatures();
|
||||
|
||||
|
||||
@Accessor("features")
|
||||
void beSetFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> features);
|
||||
|
||||
|
||||
@Accessor("structureFeatures")
|
||||
List<Supplier<ConfiguredStructureFeature<?, ?>>> beGetStructures();
|
||||
|
||||
|
||||
@Accessor("structureFeatures")
|
||||
void beSetStructures(List<Supplier<ConfiguredStructureFeature<?, ?>>> structures);
|
||||
}
|
||||
|
|
|
@ -14,13 +14,14 @@ import net.minecraft.world.entity.mob.EndermanEntity;
|
|||
import net.minecraft.world.entity.mob.HostileEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
|
||||
@Mixin(HostileEntity.class)
|
||||
public class HostileEntityMixin {
|
||||
@Inject(method = "canSpawnInDark", at = @At(value = "RETURN"), cancellable = true)
|
||||
private static void be_endermenCheck(EntityType<? extends HostileEntity> type, ServerWorldAccess serverWorldAccess,
|
||||
SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> info) {
|
||||
private static void be_endermenCheck(EntityType<? extends HostileEntity> type,
|
||||
ServerLevelAccessor serverWorldAccess, SpawnReason spawnReason, BlockPos pos, Random random,
|
||||
CallbackInfoReturnable<Boolean> info) {
|
||||
boolean canSpawn = info.getReturnValue();
|
||||
if (canSpawn && spawnReason == SpawnReason.NATURAL && type == EntityType.ENDERMAN) {
|
||||
Box box = new Box(pos).expand(16);
|
||||
|
|
|
@ -2,6 +2,8 @@ package ru.betterend.mixin.common;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -11,9 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.world.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.world.entity.damage.DamageSource;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
|
@ -21,16 +21,16 @@ public abstract class LivingEntityMixin {
|
|||
|
||||
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) {
|
||||
this.lastAttacker = source.getAttacker();
|
||||
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/world/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;
|
||||
value += this.be_getKnockback(attacker.getMainHandStack().getItem());
|
||||
value += this.be_getKnockback(attacker.getMainHandItem().getItem());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ public abstract class LivingEntityMixin {
|
|||
private double be_getKnockback(Item tool) {
|
||||
if (tool == null)
|
||||
return 0.0D;
|
||||
Collection<EntityAttributeModifier> modifiers = tool.getAttributeModifiers(EquipmentSlot.MAINHAND)
|
||||
.get(EntityAttributes.GENERIC_ATTACK_KNOCKBACK);
|
||||
Collection<AttributeModifier> modifiers = tool.getDefaultAttributeModifiers(EquipmentSlot.MAINHAND)
|
||||
.get(Attributes.ATTACK_KNOCKBACK);
|
||||
if (modifiers.size() > 0) {
|
||||
return modifiers.iterator().next().getValue();
|
||||
return modifiers.iterator().next().getAmount();
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.WorldGenerationProgressListener;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.SaveProperties;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerWorldProperties;
|
||||
|
@ -33,7 +33,7 @@ public class MinecraftServerMixin {
|
|||
|
||||
@Final
|
||||
@Shadow
|
||||
private Map<RegistryKey<Level>, ServerLevel> worlds;
|
||||
private Map<ResourceKey<Level>, ServerLevel> worlds;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.world.biome.source.BiomeSource;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.StructuresConfig;
|
||||
|
@ -22,24 +22,26 @@ public abstract class NoiseChunkGeneratorMixin extends ChunkGenerator {
|
|||
@Final
|
||||
@Shadow
|
||||
protected Supplier<ChunkGeneratorSettings> settings;
|
||||
|
||||
public NoiseChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource, StructuresConfig structuresConfig, long worldSeed) {
|
||||
|
||||
public NoiseChunkGeneratorMixin(BiomeSource populationSource, BiomeSource biomeSource,
|
||||
StructuresConfig structuresConfig, long 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"))
|
||||
private void beOnInit(BiomeSource populationSource, BiomeSource biomeSource, long seed, Supplier<ChunkGeneratorSettings> settings, CallbackInfo info) {
|
||||
private void beOnInit(BiomeSource populationSource, BiomeSource biomeSource, long seed,
|
||||
Supplier<ChunkGeneratorSettings> 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) {
|
||||
if (GeneratorOptions.useNewGenerator() && settings.get().equals(ChunkGeneratorSettings.END)) {
|
||||
//System.out.println(TerrainGenerator.canGenerate(x, z));
|
||||
//if (TerrainGenerator.canGenerate(x, z)) {
|
||||
TerrainGenerator.fillTerrainDensity(buffer, x, z, getBiomeSource());
|
||||
info.cancel();
|
||||
//}
|
||||
// System.out.println(TerrainGenerator.canGenerate(x, z));
|
||||
// if (TerrainGenerator.canGenerate(x, z)) {
|
||||
TerrainGenerator.fillTerrainDensity(buffer, x, z, getBiomeSource());
|
||||
info.cancel();
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -19,7 +19,7 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
@Mixin(PlayerEntity.class)
|
||||
@Mixin(Player.class)
|
||||
public abstract class PlayerEntityMixin {
|
||||
private static Direction[] HORIZONTAL;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.mojang.serialization.Dynamic;
|
|||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
@ -31,7 +31,7 @@ import net.minecraft.network.Packet;
|
|||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.DifficultyS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityMobEffectS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.HeldItemChangeS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
|
||||
|
@ -50,7 +50,7 @@ import net.minecraft.util.Formatting;
|
|||
import net.minecraft.util.UserCache;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.WorldProperties;
|
||||
|
@ -92,18 +92,18 @@ public class PlayerManagerMixin {
|
|||
String string = gameProfile2 == null ? gameProfile.getName() : gameProfile2.getName();
|
||||
userCache.add(gameProfile);
|
||||
CompoundTag compoundTag = this.loadPlayerData(player);
|
||||
RegistryKey<Level> var23;
|
||||
ResourceKey<Level> var23;
|
||||
if (compoundTag != null) {
|
||||
DataResult<RegistryKey<Level>> var10000 = DimensionType
|
||||
DataResult<ResourceKey<Level>> var10000 = DimensionType
|
||||
.method_28521(new Dynamic<Tag>(NbtOps.INSTANCE, compoundTag.get("Dimension")));
|
||||
Logger var10001 = LOGGER;
|
||||
var10001.getClass();
|
||||
var23 = (RegistryKey<Level>) var10000.resultOrPartial(var10001::error).orElse(Level.END);
|
||||
var23 = (ResourceKey<Level>) var10000.resultOrPartial(var10001::error).orElse(Level.END);
|
||||
} else {
|
||||
var23 = Level.END;
|
||||
}
|
||||
|
||||
RegistryKey<Level> registryKey = var23;
|
||||
ResourceKey<Level> registryKey = var23;
|
||||
ServerLevel serverWorld = this.server.getLevel(registryKey);
|
||||
ServerLevel serverWorld3;
|
||||
if (serverWorld == null) {
|
||||
|
@ -178,12 +178,12 @@ public class PlayerManagerMixin {
|
|||
player.sendResourcePackUrl(this.server.getResourcePackUrl(), this.server.getResourcePackHash());
|
||||
}
|
||||
|
||||
Iterator<?> var24 = player.getStatusEffects().iterator();
|
||||
Iterator<?> var24 = player.getMobEffects().iterator();
|
||||
|
||||
while (var24.hasNext()) {
|
||||
StatusEffectInstance statusEffectInstance = (StatusEffectInstance) var24.next();
|
||||
MobEffectInstance statusEffectInstance = (MobEffectInstance) var24.next();
|
||||
serverPlayNetworkHandler
|
||||
.sendPacket(new EntityStatusEffectS2CPacket(player.getEntityId(), statusEffectInstance));
|
||||
.sendPacket(new EntityMobEffectS2CPacket(player.getEntityId(), statusEffectInstance));
|
||||
}
|
||||
|
||||
if (compoundTag != null && compoundTag.contains("RootVehicle", 10)) {
|
||||
|
|
|
@ -11,10 +11,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.world.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.network.packet.s2c.play.DifficultyS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityMobEffectS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.WorldEventS2CPacket;
|
||||
|
@ -34,7 +34,7 @@ import ru.betterend.interfaces.TeleportingEntity;
|
|||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
@Mixin(ServerPlayer.class)
|
||||
public abstract class ServerPlayerEntityMixin extends PlayerEntity implements TeleportingEntity {
|
||||
public abstract class ServerPlayerEntityMixin extends Player implements TeleportingEntity {
|
||||
|
||||
@Shadow
|
||||
public ServerPlayNetworkHandler networkHandler;
|
||||
|
@ -108,9 +108,8 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Te
|
|||
playerManager.sendWorldInfo(player, destination);
|
||||
playerManager.sendPlayerStatus(player);
|
||||
|
||||
for (StatusEffectInstance statusEffectInstance : this.getStatusEffects()) {
|
||||
this.networkHandler
|
||||
.sendPacket(new EntityStatusEffectS2CPacket(getEntityId(), statusEffectInstance));
|
||||
for (MobEffectInstance statusEffectInstance : this.getMobEffects()) {
|
||||
this.networkHandler.sendPacket(new EntityMobEffectS2CPacket(getEntityId(), statusEffectInstance));
|
||||
}
|
||||
|
||||
this.networkHandler.sendPacket(new WorldEventS2CPacket(1032, BlockPos.ORIGIN, 0, false));
|
||||
|
@ -135,7 +134,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements Te
|
|||
|
||||
@Override
|
||||
public void beSetExitPos(BlockPos pos) {
|
||||
this.exitPos = pos.toImmutable();
|
||||
this.exitPos = pos.immutable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,11 +19,11 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.server.WorldGenerationProgressListener;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.Spawner;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.ServerWorldProperties;
|
||||
import net.minecraft.world.level.storage.LevelStorage;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
@ -39,7 +39,7 @@ public class ServerWorldMixin {
|
|||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void be_onServerWorldInit(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session,
|
||||
ServerWorldProperties properties, RegistryKey<Level> registryKey, DimensionType dimensionType,
|
||||
ServerWorldProperties properties, ResourceKey<Level> registryKey, DimensionType dimensionType,
|
||||
WorldGenerationProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator,
|
||||
boolean debugWorld, long l, List<Spawner> list, boolean bl, CallbackInfo info) {
|
||||
if (lastWorld != null && lastWorld.equals(session.getDirectoryName())) {
|
||||
|
|
|
@ -11,28 +11,29 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
|
||||
import net.fabricmc.fabric.impl.biome.WeightedBiomePicker;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeKeys;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import ru.betterend.interfaces.IBiomeList;
|
||||
|
||||
@Mixin(value = WeightedBiomePicker.class, remap = false)
|
||||
public class WeightedBiomePickerMixin implements IBiomeList {
|
||||
private List<RegistryKey<Biome>> biomes = Lists.newArrayList();
|
||||
|
||||
private List<ResourceKey<Biome>> biomes = Lists.newArrayList();
|
||||
|
||||
@Inject(method = "addBiome", at = @At("TAIL"))
|
||||
private void be_addBiome(final RegistryKey<Biome> biome, final double weight, CallbackInfo info) {
|
||||
private void be_addBiome(final ResourceKey<Biome> biome, final double weight, CallbackInfo info) {
|
||||
if (be_isCorrectPicker((WeightedBiomePicker) (Object) this)) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<RegistryKey<Biome>> getBiomes() {
|
||||
public List<ResourceKey<Biome>> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
|
||||
private boolean be_isCorrectPicker(WeightedBiomePicker picker) {
|
||||
return picker == InternalBiomeData.getEndBiomesMap().get(BiomeKeys.SMALL_END_ISLANDS) || picker == InternalBiomeData.getEndBarrensMap().get(BiomeKeys.END_BARRENS);
|
||||
return picker == InternalBiomeData.getEndBiomesMap().get(Biomes.SMALL_END_ISLANDS)
|
||||
|| picker == InternalBiomeData.getEndBarrensMap().get(Biomes.END_BARRENS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue