Migrating to BCLib (WIP)
This commit is contained in:
parent
61d4a33cf6
commit
3668a4694a
184 changed files with 802 additions and 4348 deletions
|
@ -1,28 +0,0 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.world.level.block.AnvilBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
|
||||
@Mixin(AnvilBlock.class)
|
||||
public class AnvilBlockMixin {
|
||||
@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);
|
||||
try {
|
||||
BlockState state = fallingState.setValue(destructionProperty, destruction + 1);
|
||||
info.setReturnValue(state);
|
||||
} catch (Exception ex) {
|
||||
info.setReturnValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -74,7 +74,7 @@ public abstract class AnvilMenuMixin extends ItemCombinerMenu implements AnvilSc
|
|||
access.execute((world, blockPos) -> {
|
||||
BlockState anvilState = world.getBlockState(blockPos);
|
||||
if (!player.abilities.instabuild && anvilState.is(BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) {
|
||||
BlockState landingState = AnvilBlock.damage(anvilState);
|
||||
BlockState landingState = EndAnvilBlock.applyDamage(anvilState);
|
||||
if (landingState == null) {
|
||||
world.removeBlock(blockPos, false);
|
||||
world.levelEvent(1029, blockPos, 0);
|
||||
|
|
|
@ -20,12 +20,11 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.interfaces.FallFlyingItem;
|
||||
import ru.betterend.item.ArmoredElytra;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
@Mixin(Player.class)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue