Continue migration
This commit is contained in:
parent
f03fd03bd0
commit
de3bc706bd
11 changed files with 56 additions and 56 deletions
|
@ -24,8 +24,8 @@ public class EndPotions {
|
|||
}
|
||||
|
||||
public static void register() {
|
||||
BrewingAccessor.callRegisterPotionRecipe(Potions.AWKWARD, EndItems.ENDER_DUST, END_VEIL);
|
||||
BrewingAccessor.callRegisterPotionRecipe(END_VEIL, Items.REDSTONE, LONG_END_VEIL);
|
||||
BrewingAccessor.callRegisterPotionRecipe(Potions.AWKWARD, EndBlocks.MURKWEED.asItem(), Potions.NIGHT_VISION);
|
||||
BrewingAccessor.callAddMix(Potions.AWKWARD, EndItems.ENDER_DUST, END_VEIL);
|
||||
BrewingAccessor.callAddMix(END_VEIL, Items.REDSTONE, LONG_END_VEIL);
|
||||
BrewingAccessor.callAddMix(Potions.AWKWARD, EndBlocks.MURKWEED.asItem(), Potions.NIGHT_VISION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,20 +27,20 @@ public class EndArmorItem extends ArmorItem implements Patterned {
|
|||
return;
|
||||
}
|
||||
|
||||
Multimap<Attribute, AttributeModifier> attributeModifiers = accessor.be_getAttributeModifiers();
|
||||
Multimap<Attribute, AttributeModifier> attributeModifiers = accessor.getDefaultModifiers();
|
||||
|
||||
// In case Mojang or anyone else decided to fix this
|
||||
if (attributeModifiers.keys().contains(Attributes.KNOCKBACK_RESISTANCE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = accessor.be_getModifiers()[slot.getIndex()];
|
||||
UUID uuid = accessor.getModifiers()[slot.getIndex()];
|
||||
|
||||
// Rebuild attributeModifiers to include knockback resistance
|
||||
ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder();
|
||||
builder.putAll(attributeModifiers);
|
||||
builder.put(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(uuid, "Armor knockback resistance", knockbackResistance, AttributeModifier.Operation.ADDITION));
|
||||
accessor.be_setAttributeModifiers(builder.build());
|
||||
accessor.setDefaultModifiers(builder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,7 @@ import ru.betterend.util.MHelper;
|
|||
@Mixin(BlockBehaviour.class)
|
||||
public abstract class AbstractBlockMixin {
|
||||
|
||||
@Inject(method = "getDroppedStacks", 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) {
|
||||
if (state.is(Blocks.GLOWSTONE)) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
|
|
|
@ -11,8 +11,8 @@ import ru.betterend.blocks.basis.EndAnvilBlock;
|
|||
|
||||
@Mixin(AnvilBlock.class)
|
||||
public class AnvilBlockMixin {
|
||||
@Inject(method = "getLandingState", at = @At("HEAD"), cancellable = true)
|
||||
private static void be_getLandingState(BlockState fallingState, CallbackInfoReturnable<BlockState> info) {
|
||||
@Inject(method = "damage", at = @At("HEAD"), cancellable = true)
|
||||
private static void be_damage(BlockState fallingState, CallbackInfoReturnable<BlockState> info) {
|
||||
if (fallingState.getBlock() instanceof EndAnvilBlock) {
|
||||
IntegerProperty destructionProperty = ((EndAnvilBlock) fallingState.getBlock()).getDestructionProperty();
|
||||
int destruction = fallingState.getValue(destructionProperty);
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu implement
|
|||
super(MenuType.ANVIL, syncId, playerInventory, ContainerLevelAccess.NULL);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>(ILnet/minecraft/entity/player/PlayerInventory;Lnet/minecraft/screen/ScreenHandlerContext;)V",
|
||||
@Inject(method = "<init>(ILnet/minecraft/world/entity/player/Inventory;Lnet/minecraft/world/inventory/ContainerLevelAccess;)V",
|
||||
at = @At("TAIL"))
|
||||
public void be_initAnvilLevel(int syncId, Inventory inventory, ContainerLevelAccess context, CallbackInfo info) {
|
||||
if (context != ContainerLevelAccess.NULL) {
|
||||
|
@ -57,14 +57,14 @@ public abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu implement
|
|||
@Shadow
|
||||
public abstract void createResult();
|
||||
|
||||
@Inject(method = "canTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "mayPickup", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_canTakeOutput(Player player, boolean present, CallbackInfoReturnable<Boolean> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.setReturnValue(be_currentRecipe.checkHammerDurability(inputSlots, player));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onTakeOutput", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "onTake", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_onTakeOutput(Player player, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
|
||||
if (be_currentRecipe != null) {
|
||||
this.inputSlots.getItem(0).shrink(be_currentRecipe.getInputCount());
|
||||
|
@ -89,7 +89,7 @@ public abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu implement
|
|||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updateResult", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "createResult", at = @At("HEAD"), cancellable = true)
|
||||
public void be_updateOutput(CallbackInfo info) {
|
||||
RecipeManager recipeManager = this.player.level.getRecipeManager();
|
||||
be_recipes = recipeManager.getRecipesFor(AnvilRecipe.TYPE, inputSlots, player.level);
|
||||
|
@ -109,7 +109,7 @@ public abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu implement
|
|||
}
|
||||
}
|
||||
|
||||
@Inject(method = "setNewItemName", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "setItemName", at = @At("HEAD"), cancellable = true)
|
||||
public void be_setNewItemName(String string, CallbackInfo info) {
|
||||
if (be_currentRecipe != null) {
|
||||
info.cancel();
|
||||
|
|
|
@ -11,12 +11,12 @@ import com.google.common.collect.Multimap;
|
|||
|
||||
@Mixin(ArmorItem.class)
|
||||
public interface ArmorItemAccessor {
|
||||
@Accessor("MODIFIERS")
|
||||
UUID[] be_getModifiers();
|
||||
@Accessor("ARMOR_MODIFIER_UUID_PER_SLOT")
|
||||
UUID[] getModifiers();
|
||||
|
||||
@Accessor("attributeModifiers")
|
||||
Multimap<Attribute, AttributeModifier> be_getAttributeModifiers();
|
||||
@Accessor("defaultModifiers")
|
||||
Multimap<Attribute, AttributeModifier> getDefaultModifiers();
|
||||
|
||||
@Accessor("attributeModifiers")
|
||||
void be_setAttributeModifiers(Multimap<Attribute, AttributeModifier> attributeModifiers);
|
||||
@Accessor("defaultModifiers")
|
||||
void setDefaultModifiers(Multimap<Attribute, AttributeModifier> attributeModifiers);
|
||||
}
|
||||
|
|
|
@ -13,19 +13,19 @@ import ru.betterend.interfaces.IBiomeArray;
|
|||
public class BiomeArrayMixin implements IBiomeArray {
|
||||
@Final
|
||||
@Shadow
|
||||
private Biome[] data;
|
||||
private Biome[] biomes;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private static int HORIZONTAL_SECTION_COUNT;
|
||||
private static int WIDTH_BITS;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public static int HORIZONTAL_BIT_MASK;
|
||||
public static int HORIZONTAL_MASK;
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
public static int VERTICAL_BIT_MASK;
|
||||
public static int VERTICAL_MASK;
|
||||
|
||||
@Override
|
||||
public void setBiome(Biome biome, BlockPos pos) {
|
||||
|
@ -33,13 +33,13 @@ public class BiomeArrayMixin implements IBiomeArray {
|
|||
int biomeY = pos.getY() >> 2;
|
||||
int biomeZ = pos.getZ() >> 2;
|
||||
int index = be_getArrayIndex(biomeX, biomeY, biomeZ);
|
||||
data[index] = biome;
|
||||
biomes[index] = biome;
|
||||
}
|
||||
|
||||
private int be_getArrayIndex(int biomeX, int biomeY, int biomeZ) {
|
||||
int i = biomeX & HORIZONTAL_BIT_MASK;
|
||||
int j = Mth.clamp(biomeY, 0, VERTICAL_BIT_MASK);
|
||||
int k = biomeZ & HORIZONTAL_BIT_MASK;
|
||||
return j << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT | k << HORIZONTAL_SECTION_COUNT | i;
|
||||
int i = biomeX & HORIZONTAL_MASK;
|
||||
int j = Mth.clamp(biomeY, 0, VERTICAL_MASK);
|
||||
int k = biomeZ & HORIZONTAL_MASK;
|
||||
return j << WIDTH_BITS + WIDTH_BITS | k << WIDTH_BITS | i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BoneMealItemMixin {
|
|||
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "useOn", at = @At("HEAD"), cancellable = true)
|
||||
private void be_onUse(UseOnContext context, CallbackInfoReturnable<InteractionResult> info) {
|
||||
Level world = context.getLevel();
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
|
@ -39,7 +39,7 @@ public class BoneMealItemMixin {
|
|||
if (world.getBlockState(blockPos).is(EndTags.END_GROUND)) {
|
||||
boolean consume = false;
|
||||
if (world.getBlockState(blockPos).is(Blocks.END_STONE)) {
|
||||
BlockState nylium = beGetNylium(world, blockPos);
|
||||
BlockState nylium = be_getNylium(world, blockPos);
|
||||
if (nylium != null) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, nylium);
|
||||
consume = true;
|
||||
|
@ -48,11 +48,11 @@ public class BoneMealItemMixin {
|
|||
else {
|
||||
if (!world.getFluidState(offseted).isEmpty() && endBiome) {
|
||||
if (world.getBlockState(offseted).getBlock().equals(Blocks.WATER)) {
|
||||
consume = beGrowWaterGrass(world, blockPos);
|
||||
consume = be_growWaterGrass(world, blockPos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
consume = beGrowGrass(world, blockPos);
|
||||
consume = be_growGrass(world, blockPos);
|
||||
}
|
||||
}
|
||||
if (consume) {
|
||||
|
@ -73,7 +73,7 @@ public class BoneMealItemMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean beGrowGrass(Level world, BlockPos pos) {
|
||||
private boolean be_growGrass(Level world, BlockPos pos) {
|
||||
int y1 = pos.getY() + 3;
|
||||
int y2 = pos.getY() - 3;
|
||||
boolean result = false;
|
||||
|
@ -86,7 +86,7 @@ public class BoneMealItemMixin {
|
|||
POS.setY(y);
|
||||
BlockPos down = POS.below();
|
||||
if (world.isEmptyBlock(POS) && !world.isEmptyBlock(down)) {
|
||||
BlockState grass = beGetGrassState(world, down);
|
||||
BlockState grass = be_getGrassState(world, down);
|
||||
if (grass != null) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, grass);
|
||||
result = true;
|
||||
|
@ -98,7 +98,7 @@ public class BoneMealItemMixin {
|
|||
return result;
|
||||
}
|
||||
|
||||
private boolean beGrowWaterGrass(Level world, BlockPos pos) {
|
||||
private boolean be_growWaterGrass(Level world, BlockPos pos) {
|
||||
int y1 = pos.getY() + 3;
|
||||
int y2 = pos.getY() - 3;
|
||||
boolean result = false;
|
||||
|
@ -111,7 +111,7 @@ public class BoneMealItemMixin {
|
|||
POS.setY(y);
|
||||
BlockPos down = POS.below();
|
||||
if (world.getBlockState(POS).is(Blocks.WATER) && world.getBlockState(down).is(EndTags.END_GROUND)) {
|
||||
BlockState grass = beGetWaterGrassState(world, down);
|
||||
BlockState grass = be_getWaterGrassState(world, down);
|
||||
if (grass != null) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, grass);
|
||||
result = true;
|
||||
|
@ -123,14 +123,14 @@ public class BoneMealItemMixin {
|
|||
return result;
|
||||
}
|
||||
|
||||
private BlockState beGetGrassState(Level world, BlockPos pos) {
|
||||
private BlockState be_getGrassState(Level world, BlockPos pos) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
block = BonemealUtil.getGrass(EndBiomes.getBiomeID(world.getBiome(pos)), block, world.getRandom());
|
||||
return block == null ? null : block.defaultBlockState();
|
||||
}
|
||||
|
||||
private BlockState beGetWaterGrassState(Level world, BlockPos pos) {
|
||||
private BlockState be_getWaterGrassState(Level world, BlockPos pos) {
|
||||
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(pos));
|
||||
if (world.random.nextInt(16) == 0) {
|
||||
return EndBlocks.CHARNIA_RED.defaultBlockState();
|
||||
|
@ -147,7 +147,7 @@ public class BoneMealItemMixin {
|
|||
return null;
|
||||
}
|
||||
|
||||
private void beShuffle(Random random) {
|
||||
private void be_shuffle(Random random) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int j = random.nextInt(4);
|
||||
Direction d = DIR[i];
|
||||
|
@ -156,8 +156,8 @@ public class BoneMealItemMixin {
|
|||
}
|
||||
}
|
||||
|
||||
private BlockState beGetNylium(Level world, BlockPos pos) {
|
||||
beShuffle(world.random);
|
||||
private BlockState be_getNylium(Level world, BlockPos pos) {
|
||||
be_shuffle(world.random);
|
||||
for (Direction dir : DIR) {
|
||||
BlockState state = world.getBlockState(pos.relative(dir));
|
||||
if (BlocksHelper.isEndNylium(state))
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.gen.Invoker;
|
|||
@Mixin(PotionBrewing.class)
|
||||
public interface BrewingAccessor {
|
||||
@Invoker
|
||||
static void callRegisterPotionRecipe(Potion input, Item item, Potion output) {
|
||||
static void callAddMix(Potion input, Item item, Potion output) {
|
||||
throw new AssertionError("@Invoker dummy body called");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
@Final
|
||||
private ChorusPlantBlock plantBlock;
|
||||
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void beCanPlace(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true)
|
||||
private void be_canPlace(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
|
@ -51,13 +51,13 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
|
||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
||||
private void beOnTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
private void be_onTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
if (world.getBlockState(pos.below()).is(EndTags.END_GROUND)) {
|
||||
BlockPos up = pos.above();
|
||||
if (world.isEmptyBlock(up) && up.getY() < 256) {
|
||||
int i = state.getValue(ChorusFlowerBlock.AGE);
|
||||
if (i < 5) {
|
||||
this.grow(world, up, i + 1);
|
||||
this.placeGrownFlower(world, up, i + 1);
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, plantBlock.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true).setValue(BlocksHelper.ROOTS, true));
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
}
|
||||
|
||||
@Inject(method = "generate", at = @At("RETURN"), cancellable = true)
|
||||
private static void beOnGenerate(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
|
||||
@Inject(method = "generatePlant", at = @At("RETURN"), cancellable = true)
|
||||
private static void be_onGeneratePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (GeneratorOptions.changeChorusPlant() && state.is(Blocks.CHORUS_PLANT)) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(BlocksHelper.ROOTS, true));
|
||||
|
@ -79,13 +79,13 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
|
||||
@Shadow
|
||||
private static boolean isSurroundedByAir(LevelReader world, BlockPos pos, @Nullable Direction exceptDirection) { return false; }
|
||||
private static boolean allNeighborsEmpty(LevelReader world, BlockPos pos, @Nullable Direction exceptDirection) { return false; }
|
||||
|
||||
@Shadow
|
||||
private void grow(Level world, BlockPos pos, int age) {}
|
||||
private void placeGrownFlower(Level world, BlockPos pos, int age) {}
|
||||
|
||||
@Shadow
|
||||
private void die(Level world, BlockPos pos) {}
|
||||
private void placeDeadFlower(Level world, BlockPos pos) {}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
|
@ -98,7 +98,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
|
||||
@Inject(method = "die", at = @At("HEAD"), cancellable = true)
|
||||
private void beOnDie(Level world, BlockPos pos, CallbackInfo info) {
|
||||
private void be_onDie(Level world, BlockPos pos, CallbackInfo info) {
|
||||
BlockState down = world.getBlockState(pos.below());
|
||||
if (down.is(Blocks.CHORUS_PLANT) || down.is(EndTags.GEN_TERRAIN)) {
|
||||
world.setBlock(pos, this.defaultBlockState().setValue(BlockStateProperties.AGE_5, 5), 2);
|
||||
|
|
|
@ -20,13 +20,13 @@ public class TagGroupLoaderMixin {
|
|||
@Shadow
|
||||
private String entryType;
|
||||
|
||||
@Inject(method = "prepareReload", at = @At("RETURN"), cancellable = true)
|
||||
public void be_prepareReload(ResourceManager manager, Executor prepareExecutor, CallbackInfoReturnable<CompletableFuture<Map<ResourceLocation, Tag.Builder>>> info) {
|
||||
@Inject(method = "prepare", at = @At("RETURN"), cancellable = true)
|
||||
public void be_prepareReload(ResourceManager manager, Executor executor, CallbackInfoReturnable<CompletableFuture<Map<ResourceLocation, Tag.Builder>>> info) {
|
||||
CompletableFuture<Map<ResourceLocation, Tag.Builder>> future = info.getReturnValue();
|
||||
info.setReturnValue(CompletableFuture.supplyAsync(() -> {
|
||||
Map<ResourceLocation, Tag.Builder> map = future.join();
|
||||
TagHelper.apply(entryType, map);
|
||||
return map;
|
||||
}));
|
||||
}, executor));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue