mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 05:08:34 +01:00
big cleanup
This commit is contained in:
parent
570379fd36
commit
a88458d6d0
52 changed files with 120 additions and 57 deletions
|
@ -46,6 +46,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
import org.apache.commons.lang3.tuple.ImmutableTriple;
|
import org.apache.commons.lang3.tuple.ImmutableTriple;
|
||||||
import top.theillusivec4.curios.api.CuriosApi;
|
import top.theillusivec4.curios.api.CuriosApi;
|
||||||
|
import top.theillusivec4.curios.api.SlotResult;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -310,7 +311,7 @@ public final class Helper {
|
||||||
|
|
||||||
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
|
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
|
||||||
if (Compat.hasCompat("curios")) {
|
if (Compat.hasCompat("curios")) {
|
||||||
var stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight);
|
var stack = CuriosApi.getCuriosHelper().findFirstCurio(player, predicate).map(SlotResult::stack);
|
||||||
if (stack.isPresent())
|
if (stack.isPresent())
|
||||||
return stack.get();
|
return stack.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
|
|
||||||
public class BlockAncientSapling extends BushBlock implements BonemealableBlock, IModItem, ICustomBlockState, ICustomItemModel {
|
public class BlockAncientSapling extends BushBlock implements BonemealableBlock, IModItem, ICustomBlockState, ICustomItemModel {
|
||||||
|
|
||||||
|
@ -30,11 +31,13 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockAncientSapling.SHAPE;
|
return BlockAncientSapling.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
||||||
if (!level.isClientSide) {
|
if (!level.isClientSide) {
|
||||||
super.randomTick(state, level, pos, random);
|
super.randomTick(state, level, pos, random);
|
||||||
|
@ -55,7 +58,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidBonemealTarget(BlockGetter p_50897_, BlockPos p_50898_, BlockState p_50899_, boolean p_50900_) {
|
public boolean isValidBonemealTarget(BlockGetter level, BlockPos pos, BlockState state, boolean b) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +71,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
||||||
public void performBonemeal(ServerLevel level, RandomSource rand, BlockPos pos, BlockState state) {
|
public void performBonemeal(ServerLevel level, RandomSource rand, BlockPos pos, BlockState state) {
|
||||||
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
||||||
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
|
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
|
||||||
} else if (ForgeEventFactory.saplingGrowTree(level, rand, pos)) {
|
} else if (!ForgeEventFactory.blockGrowFeature(level, rand, pos, null).getResult().equals(Event.Result.DENY)) {
|
||||||
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
|
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockAnimalContainer.SHAPE;
|
return BlockAnimalContainer.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,14 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void entityInside(BlockState state, Level levelIn, BlockPos pos, Entity entityIn) {
|
public void entityInside(BlockState state, Level levelIn, BlockPos pos, Entity entityIn) {
|
||||||
if (this == ModBlocks.AURA_CACTUS)
|
if (this == ModBlocks.AURA_CACTUS)
|
||||||
entityIn.hurt(DamageSource.CACTUS, 1);
|
entityIn.hurt(DamageSource.CACTUS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
var vec3d = state.getOffset(levelIn, pos);
|
var vec3d = state.getOffset(levelIn, pos);
|
||||||
return BlockAuraBloom.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);
|
return BlockAuraBloom.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);
|
||||||
|
|
|
@ -14,11 +14,13 @@ public class BlockAuraDetector extends BlockContainerImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean hasAnalogOutputSignal(BlockState state) {
|
public boolean hasAnalogOutputSignal(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
|
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
|
||||||
var tile = levelIn.getBlockEntity(pos);
|
var tile = levelIn.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityAuraDetector detector)
|
if (tile instanceof BlockEntityAuraDetector detector)
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockAuraTimer.SHAPE;
|
return BlockAuraTimer.SHAPE;
|
||||||
}
|
}
|
||||||
|
@ -51,16 +52,19 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) {
|
||||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean isSignalSource(BlockState state) {
|
public boolean isSignalSource(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) {
|
public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) {
|
||||||
return state.getValue(BlockStateProperties.POWERED) ? 15 : 0;
|
return state.getValue(BlockStateProperties.POWERED) ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICus
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockBlastFurnaceBooster.SHAPE;
|
return BlockBlastFurnaceBooster.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockChunkLoader.SHAPE;
|
return BlockChunkLoader.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,11 +65,13 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public FluidState getFluidState(BlockState state) {
|
public FluidState getFluidState(BlockState state) {
|
||||||
return this.hasWaterlogging() && state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
|
return this.hasWaterlogging() && state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
|
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
|
||||||
if (this.hasWaterlogging() && stateIn.getValue(BlockStateProperties.WATERLOGGED))
|
if (this.hasWaterlogging() && stateIn.getValue(BlockStateProperties.WATERLOGGED))
|
||||||
levelIn.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelIn));
|
levelIn.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelIn));
|
||||||
|
@ -110,6 +112,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
var drops = super.getDrops(state, builder);
|
var drops = super.getDrops(state, builder);
|
||||||
|
|
||||||
|
@ -126,11 +129,11 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWillDestroy(Level p_49852_, BlockPos p_49853_, BlockState p_49854_, Player p_49855_) {
|
public void playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) {
|
||||||
var tile = p_49852_.getBlockEntity(p_49853_);
|
var tile = level.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityImpl impl)
|
if (tile instanceof BlockEntityImpl impl)
|
||||||
impl.dropInventory();
|
impl.dropInventory();
|
||||||
super.playerWillDestroy(p_49852_, p_49853_, p_49854_, p_49855_);
|
super.playerWillDestroy(level, pos, state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,6 +144,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
||||||
this.updateRedstoneState(levelIn, pos);
|
this.updateRedstoneState(levelIn, pos);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +161,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void tick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
|
public void tick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
|
||||||
if (!levelIn.isClientSide) {
|
if (!levelIn.isClientSide) {
|
||||||
var tile = levelIn.getBlockEntity(pos);
|
var tile = levelIn.getBlockEntity(pos);
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
||||||
if (!level.isClientSide) {
|
if (!level.isClientSide) {
|
||||||
level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
||||||
|
|
|
@ -7,7 +7,10 @@ import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.packet.PacketClient;
|
import de.ellpeck.naturesaura.packet.PacketClient;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import de.ellpeck.naturesaura.reg.*;
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||||
|
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
||||||
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
@ -62,6 +65,7 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||||
var stack = player.getItemInHand(hand);
|
var stack = player.getItemInHand(hand);
|
||||||
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
||||||
|
@ -133,6 +137,7 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"deprecation", "RedundantSuppression"})
|
||||||
public Property<RailShape> getShapeProperty() {
|
public Property<RailShape> getShapeProperty() {
|
||||||
return BlockDimensionRail.SHAPE;
|
return BlockDimensionRail.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,11 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
||||||
super(Properties.of(Material.GRASS).noCollission().strength(0.5F).sound(SoundType.GRASS));
|
super(Properties.of(Material.GRASS).noCollission().strength(0.5F).sound(SoundType.GRASS));
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
ModRegistry.ALL_ITEMS.add(this);
|
ModRegistry.ALL_ITEMS.add(this);
|
||||||
ModRegistry.ALL_ITEMS.add(new ModTileType<BlockEntityEndFlower>(BlockEntityEndFlower::new, this));
|
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityEndFlower::new, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
var vec3d = state.getOffset(levelIn, pos);
|
var vec3d = state.getOffset(levelIn, pos);
|
||||||
return BlockEndFlower.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);
|
return BlockEndFlower.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);
|
||||||
|
@ -104,6 +105,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||||
if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)
|
if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
if (!levelIn.isClientSide) {
|
if (!levelIn.isClientSide) {
|
||||||
var tile = levelIn.getBlockEntity(pos);
|
var tile = levelIn.getBlockEntity(pos);
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) {
|
@SuppressWarnings("deprecation")
|
||||||
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult result) {
|
||||||
var tile = levelIn.getBlockEntity(pos);
|
var tile = levelIn.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityFieldCreator) {
|
if (tile instanceof BlockEntityFieldCreator) {
|
||||||
if (!levelIn.isClientSide) {
|
if (!levelIn.isClientSide) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
|
||||||
|
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||||
|
|
||||||
private static final VoxelShape[] SHAPES = new VoxelShape[]{
|
private static final VoxelShape[] SHAPES = {
|
||||||
Block.box(2, 12, 2, 14, 16, 14), // Down
|
Block.box(2, 12, 2, 14, 16, 14), // Down
|
||||||
Block.box(2, 0, 2, 14, 4, 14), // Up
|
Block.box(2, 0, 2, 14, 4, 14), // Up
|
||||||
Block.box(2, 2, 12, 14, 14, 16), // North
|
Block.box(2, 2, 12, 14, 14, 16), // North
|
||||||
|
@ -79,6 +79,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockFurnaceHeater.SHAPES[state.getValue(BlockFurnaceHeater.FACING).get3DDataValue()];
|
return BlockFurnaceHeater.SHAPES[state.getValue(BlockFurnaceHeater.FACING).get3DDataValue()];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.EAST_REDSTONE;
|
public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.EAST_REDSTONE;
|
||||||
public static final EnumProperty<RedstoneSide> SOUTH = BlockStateProperties.SOUTH_REDSTONE;
|
public static final EnumProperty<RedstoneSide> SOUTH = BlockStateProperties.SOUTH_REDSTONE;
|
||||||
public static final EnumProperty<RedstoneSide> WEST = BlockStateProperties.WEST_REDSTONE;
|
public static final EnumProperty<RedstoneSide> WEST = BlockStateProperties.WEST_REDSTONE;
|
||||||
protected static final VoxelShape[] SHAPES = new VoxelShape[]{Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D)};
|
protected static final VoxelShape[] SHAPES = {Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D)};
|
||||||
|
|
||||||
public BlockGoldPowder() {
|
public BlockGoldPowder() {
|
||||||
super("gold_powder", Properties.copy(Blocks.REDSTONE_WIRE));
|
super("gold_powder", Properties.copy(Blocks.REDSTONE_WIRE));
|
||||||
|
@ -71,6 +71,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockGoldPowder.SHAPES[BlockGoldPowder.getShapeIndex(state)];
|
return BlockGoldPowder.SHAPES[BlockGoldPowder.getShapeIndex(state)];
|
||||||
}
|
}
|
||||||
|
@ -83,6 +84,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
|
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
|
||||||
if (facing == Direction.DOWN) {
|
if (facing == Direction.DOWN) {
|
||||||
return stateIn;
|
return stateIn;
|
||||||
|
@ -116,6 +118,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean canSurvive(BlockState state, LevelReader levelIn, BlockPos pos) {
|
public boolean canSurvive(BlockState state, LevelReader levelIn, BlockPos pos) {
|
||||||
var blockpos = pos.below();
|
var blockpos = pos.below();
|
||||||
var blockstate = levelIn.getBlockState(blockpos);
|
var blockstate = levelIn.getBlockState(blockpos);
|
||||||
|
@ -123,11 +126,13 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return Shapes.empty();
|
return Shapes.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onPlace(BlockState state, Level levelIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
public void onPlace(BlockState state, Level levelIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||||
if (oldState.getBlock() != state.getBlock() && !levelIn.isClientSide) {
|
if (oldState.getBlock() != state.getBlock() && !levelIn.isClientSide) {
|
||||||
for (var direction : Direction.Plane.VERTICAL) {
|
for (var direction : Direction.Plane.VERTICAL) {
|
||||||
|
@ -149,6 +154,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onRemove(BlockState state, Level levelIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
public void onRemove(BlockState state, Level levelIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
if (!isMoving && state.getBlock() != newState.getBlock()) {
|
if (!isMoving && state.getBlock() != newState.getBlock()) {
|
||||||
super.onRemove(state, levelIn, pos, newState, isMoving);
|
super.onRemove(state, levelIn, pos, newState, isMoving);
|
||||||
|
@ -173,6 +179,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
||||||
if (!levelIn.isClientSide) {
|
if (!levelIn.isClientSide) {
|
||||||
if (!state.canSurvive(levelIn, pos)) {
|
if (!state.canSurvive(levelIn, pos)) {
|
||||||
|
@ -183,6 +190,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor levelIn, BlockPos pos, int flags, int recursionLeft) {
|
public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor levelIn, BlockPos pos, int flags, int recursionLeft) {
|
||||||
var pool = new BlockPos.MutableBlockPos();
|
var pool = new BlockPos.MutableBlockPos();
|
||||||
for (var direction : Direction.Plane.HORIZONTAL) {
|
for (var direction : Direction.Plane.HORIZONTAL) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return switch (state.getValue(BlockGratedChute.FACING)) {
|
return switch (state.getValue(BlockGratedChute.FACING)) {
|
||||||
case DOWN -> BlockGratedChute.DOWN_SHAPE;
|
case DOWN -> BlockGratedChute.DOWN_SHAPE;
|
||||||
|
@ -72,6 +73,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getInteractionShape(BlockState state, BlockGetter levelIn, BlockPos pos) {
|
public VoxelShape getInteractionShape(BlockState state, BlockGetter levelIn, BlockPos pos) {
|
||||||
return switch (state.getValue(BlockGratedChute.FACING)) {
|
return switch (state.getValue(BlockGratedChute.FACING)) {
|
||||||
case DOWN -> BlockGratedChute.DOWN_RAYTRACE_SHAPE;
|
case DOWN -> BlockGratedChute.DOWN_RAYTRACE_SHAPE;
|
||||||
|
@ -84,6 +86,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
if (!player.isCrouching())
|
if (!player.isCrouching())
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
|
@ -112,11 +115,13 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasAnalogOutputSignal(BlockState p_60457_) {
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean hasAnalogOutputSignal(BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
|
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
|
||||||
var tile = levelIn.getBlockEntity(pos);
|
var tile = levelIn.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityGratedChute) {
|
if (tile instanceof BlockEntityGratedChute) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class BlockItemDistributor extends BlockContainerImpl implements ICustomB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
if (!player.isCrouching())
|
if (!player.isCrouching())
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
|
|
|
@ -36,11 +36,13 @@ public class BlockLight extends BlockImpl implements ICustomBlockState, INoItemB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockLight.SHAPE;
|
return BlockLight.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
|
public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,13 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockNatureAltar.SHAPE;
|
return BlockNatureAltar.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class BlockNetherGrass extends BlockImpl implements ICustomBlockState, Bo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void randomTick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
|
public void randomTick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
|
||||||
var up = pos.above();
|
var up = pos.above();
|
||||||
var upState = levelIn.getBlockState(up);
|
var upState = levelIn.getBlockState(up);
|
||||||
|
|
|
@ -36,11 +36,13 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockOfferingTable.SHAPE;
|
return BlockOfferingTable.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class BlockPowderPlacer extends BlockContainerImpl implements ICustomBloc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockPowderPlacer.SHAPE;
|
return BlockPowderPlacer.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockSpawnLamp.SHAPE;
|
return BlockSpawnLamp.SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"deprecation", "RedundantSuppression"})
|
||||||
public Optional<SoundEvent> getPickupSound() {
|
public Optional<SoundEvent> getPickupSound() {
|
||||||
return Fluids.WATER.getPickupSound();
|
return Fluids.WATER.getPickupSound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -48,6 +49,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
|
||||||
return BlockWoodStand.SHAPE;
|
return BlockWoodStand.SHAPE;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
var pos = event.getPos();
|
var pos = event.getPos();
|
||||||
if (!level.isClientSide() && level instanceof Level) {
|
if (!level.isClientSide() && level instanceof Level) {
|
||||||
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
|
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
|
||||||
var sapling = level.getBlockState(pos);
|
var saplingStack = new ItemStack(level.getBlockState(pos).getBlock());
|
||||||
var saplingStack = sapling.getBlock().getCloneItemStack(level, pos, sapling);
|
|
||||||
if (!saplingStack.isEmpty()) {
|
if (!saplingStack.isEmpty()) {
|
||||||
for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) {
|
for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) {
|
||||||
if (recipe.saplingType.test(saplingStack)) {
|
if (recipe.saplingType.test(saplingStack)) {
|
||||||
|
@ -100,6 +101,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModBlocks {
|
public final class ModBlocks {
|
||||||
|
|
||||||
public static Block ANCIENT_LOG;
|
public static Block ANCIENT_LOG;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import de.ellpeck.naturesaura.data.BlockTagProvider;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.SaplingBlock;
|
import net.minecraft.world.level.block.SaplingBlock;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
|
@ -41,7 +42,7 @@ public final class Multiblocks {
|
||||||
return true;
|
return true;
|
||||||
// try-catch to prevent blocks that need to have been placed crashing here
|
// try-catch to prevent blocks that need to have been placed crashing here
|
||||||
try {
|
try {
|
||||||
var stack = state.getBlock().getCloneItemStack(level, pos, state);
|
var stack = new ItemStack(state.getBlock());
|
||||||
return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack));
|
return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
|
||||||
for (var z = -2; z <= 2; z += 4) {
|
for (var z = -2; z <= 2; z += 4) {
|
||||||
var offset = this.worldPosition.offset(x, 1, z);
|
var offset = this.worldPosition.offset(x, 1, z);
|
||||||
var state = this.level.getBlockState(offset);
|
var state = this.level.getBlockState(offset);
|
||||||
this.catalysts[index] = state.getBlock().getCloneItemStack(this.level, offset, state);
|
this.catalysts[index] = new ItemStack(state.getBlock());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
|
||||||
for (var y = -range; y <= range; y++)
|
for (var y = -range; y <= range; y++)
|
||||||
for (var z = -range; z <= range; z++) {
|
for (var z = -range; z <= range; z++) {
|
||||||
var pos = this.worldPosition.offset(x, y, z);
|
var pos = this.worldPosition.offset(x, y, z);
|
||||||
if (!this.framesContain(frames, pos, this.level.getBlockState(pos)))
|
if (!this.framesContain(frames, this.level.getBlockState(pos)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var up = pos.above();
|
var up = pos.above();
|
||||||
|
@ -82,8 +82,8 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean framesContain(List<ItemFrame> frames, BlockPos pos, BlockState state) {
|
private boolean framesContain(List<ItemFrame> frames, BlockState state) {
|
||||||
var stack = state.getBlock().getCloneItemStack(this.level, pos, state);
|
var stack = new ItemStack(state.getBlock());
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
|
||||||
import net.minecraftforge.energy.EnergyStorage;
|
import net.minecraftforge.energy.EnergyStorage;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
|
||||||
var tile = this.level.getBlockEntity(this.worldPosition.relative(facing));
|
var tile = this.level.getBlockEntity(this.worldPosition.relative(facing));
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
continue;
|
continue;
|
||||||
var storage = tile.getCapability(CapabilityEnergy.ENERGY, facing.getOpposite()).orElse(null);
|
var storage = tile.getCapability(ForgeCapabilities.ENERGY, facing.getOpposite()).orElse(null);
|
||||||
if (storage == null)
|
if (storage == null)
|
||||||
continue;
|
continue;
|
||||||
var canStore = storage.receiveEnergy(Integer.MAX_VALUE, true);
|
var canStore = storage.receiveEnergy(Integer.MAX_VALUE, true);
|
||||||
|
@ -91,7 +91,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
|
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
|
||||||
if (capability == CapabilityEnergy.ENERGY)
|
if (capability == ForgeCapabilities.ENERGY)
|
||||||
return this.storageOptional.cast();
|
return this.storageOptional.cast();
|
||||||
else
|
else
|
||||||
return super.getCapability(capability, facing);
|
return super.getCapability(capability, facing);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
|
||||||
|
|
||||||
private boolean isLava(BlockPos offset, boolean source) {
|
private boolean isLava(BlockPos offset, boolean source) {
|
||||||
var state = this.level.getFluidState(offset);
|
var state = this.level.getFluidState(offset);
|
||||||
return (!source || state.isSource()) && state.getType().is(FluidTags.LAVA);
|
return (!source || state.isSource()) && state.is(FluidTags.LAVA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InfiniteTank implements IFluidTank, IFluidHandler {
|
private class InfiniteTank implements IFluidTank, IFluidHandler {
|
||||||
|
@ -158,7 +158,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFluidValid(FluidStack stack) {
|
public boolean isFluidValid(FluidStack stack) {
|
||||||
return stack.getFluid().is(FluidTags.WATER);
|
return stack.getFluid().defaultFluidState().is(FluidTags.WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModBlockEntities {
|
public final class ModBlockEntities {
|
||||||
|
|
||||||
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
|
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;
|
||||||
|
|
|
@ -197,6 +197,7 @@ public class AuraChunk implements IAuraChunk {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Pair<BlockPos, Integer>[] getLowestAndHighestSpots(BlockPos pos, int radius) {
|
public Pair<BlockPos, Integer>[] getLowestAndHighestSpots(BlockPos pos, int radius) {
|
||||||
var ret = this.limitSpotCache.get(pos, radius);
|
var ret = this.limitSpotCache.get(pos, radius);
|
||||||
if (ret == null) {
|
if (ret == null) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -113,11 +114,10 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
||||||
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
|
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
|
||||||
if (ore == null)
|
if (ore == null)
|
||||||
continue;
|
continue;
|
||||||
var tag = TagKey.create(Registry.BLOCK_REGISTRY, ore.tag);
|
var tag = TagKey.create(ForgeRegistries.Keys.BLOCKS, ore.tag);
|
||||||
if (tag == null)
|
if (tag == null)
|
||||||
continue;
|
continue;
|
||||||
for (var holder : Registry.BLOCK.getTagOrEmpty(tag)) {
|
for (var toPlace : ForgeRegistries.BLOCKS.tags().getTag(tag)) {
|
||||||
var toPlace = holder.value();
|
|
||||||
if (toPlace == null || toPlace == Blocks.AIR)
|
if (toPlace == null || toPlace == Blocks.AIR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.enchant;
|
||||||
|
|
||||||
import net.minecraft.world.item.enchantment.Enchantment;
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModEnchantments {
|
public final class ModEnchantments {
|
||||||
|
|
||||||
public static Enchantment AURA_MENDING;
|
public static Enchantment AURA_MENDING;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.entities;
|
||||||
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModEntities {
|
public final class ModEntities {
|
||||||
|
|
||||||
public static EntityType<EntityMoverMinecart> MOVER_CART;
|
public static EntityType<EntityMoverMinecart> MOVER_CART;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.inventory.InventoryMenu;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
@ -25,13 +26,13 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
|
||||||
|
|
||||||
private final Map<ResourceLocation, ItemStack> items = new HashMap<>();
|
private final Map<ResourceLocation, ItemStack> items = new HashMap<>();
|
||||||
|
|
||||||
public RenderEffectInhibitor(EntityRendererProvider.Context p_174008_) {
|
public RenderEffectInhibitor(EntityRendererProvider.Context ctx) {
|
||||||
super(p_174008_);
|
super(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureLocation(EntityEffectInhibitor entity) {
|
public ResourceLocation getTextureLocation(EntityEffectInhibitor entity) {
|
||||||
return TextureAtlas.LOCATION_BLOCKS;
|
return InventoryMenu.BLOCK_ATLAS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,11 +6,12 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.inventory.InventoryMenu;
|
||||||
|
|
||||||
public class RenderStub<T extends Entity> extends EntityRenderer<T> {
|
public class RenderStub<T extends Entity> extends EntityRenderer<T> {
|
||||||
|
|
||||||
public RenderStub(EntityRendererProvider.Context p_174008_) {
|
public RenderStub(EntityRendererProvider.Context ctx) {
|
||||||
super(p_174008_);
|
super(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +20,7 @@ public class RenderStub<T extends Entity> extends EntityRenderer<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureLocation(T p_114482_) {
|
public ResourceLocation getTextureLocation(T t) {
|
||||||
return TextureAtlas.LOCATION_BLOCKS;
|
return InventoryMenu.BLOCK_ATLAS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class LevelGenAuraBloom extends Feature<NoneFeatureConfiguration> {
|
||||||
|
|
||||||
private boolean tryPlace(WorldGenLevel level, BlockPos pos) {
|
private boolean tryPlace(WorldGenLevel level, BlockPos pos) {
|
||||||
var state = this.block.defaultBlockState();
|
var state = this.block.defaultBlockState();
|
||||||
if (this.block.canSurvive(state, level, pos)) {
|
if (state.canSurvive(level, pos)) {
|
||||||
level.setBlock(pos, state, 3);
|
level.setBlock(pos, state, 3);
|
||||||
var tile = level.getBlockEntity(pos);
|
var tile = level.getBlockEntity(pos);
|
||||||
if (tile instanceof BlockEntityAuraBloom bloom)
|
if (tile instanceof BlockEntityAuraBloom bloom)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModFeatures {
|
public final class ModFeatures {
|
||||||
|
|
||||||
public static Feature<TreeConfiguration> ANCIENT_TREE;
|
public static Feature<TreeConfiguration> ANCIENT_TREE;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.gui;
|
||||||
|
|
||||||
import net.minecraft.world.inventory.MenuType;
|
import net.minecraft.world.inventory.MenuType;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModContainers {
|
public final class ModContainers {
|
||||||
|
|
||||||
public static MenuType<ContainerEnderCrate> ENDER_CRATE;
|
public static MenuType<ContainerEnderCrate> ENDER_CRATE;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
||||||
if (recharge != null) {
|
if (recharge != null) {
|
||||||
if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i))
|
if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i))
|
||||||
break;
|
break;
|
||||||
} else if (EnchantmentHelper.getItemEnchantmentLevel(ModEnchantments.AURA_MENDING, stack) > 0) {
|
} else if (stack.getEnchantmentLevel(ModEnchantments.AURA_MENDING) > 0) {
|
||||||
var mainSize = player.getInventory().items.size();
|
var mainSize = player.getInventory().items.size();
|
||||||
var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size();
|
var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size();
|
||||||
if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000))
|
if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000))
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.items;
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModItems {
|
public final class ModItems {
|
||||||
|
|
||||||
public static Item INFUSED_IRON_PICKAXE;
|
public static Item INFUSED_IRON_PICKAXE;
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class ItemArmor extends ArmorItem implements IModItem {
|
||||||
if (equipped && !nbt.getBoolean(key)) {
|
if (equipped && !nbt.getBoolean(key)) {
|
||||||
// we just equipped it
|
// we just equipped it
|
||||||
nbt.putBoolean(key, true);
|
nbt.putBoolean(key, true);
|
||||||
|
// TODO use new forge attribute for step height
|
||||||
player.maxUpStep = 1.1F;
|
player.maxUpStep = 1.1F;
|
||||||
if (!speed.hasModifier(ItemArmor.SKY_MOVEMENT_MODIFIER))
|
if (!speed.hasModifier(ItemArmor.SKY_MOVEMENT_MODIFIER))
|
||||||
speed.addPermanentModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);
|
speed.addPermanentModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);
|
||||||
|
|
|
@ -264,14 +264,12 @@ public class PacketParticles {
|
||||||
level.random.nextGaussian() * 0.01F,
|
level.random.nextGaussian() * 0.01F,
|
||||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||||
}),
|
}),
|
||||||
PICKUP_STOPPER((message, level) -> {
|
PICKUP_STOPPER((message, level) -> NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
message.posX, message.posY + 0.4F, message.posZ,
|
||||||
message.posX, message.posY + 0.4F, message.posZ,
|
level.random.nextGaussian() * 0.005F,
|
||||||
level.random.nextGaussian() * 0.005F,
|
level.random.nextFloat() * 0.005F,
|
||||||
level.random.nextFloat() * 0.005F,
|
level.random.nextGaussian() * 0.005F,
|
||||||
level.random.nextGaussian() * 0.005F,
|
0xcc3116, 1.5F, 40, 0F, false, true)),
|
||||||
0xcc3116, 1.5F, 40, 0F, false, true);
|
|
||||||
}),
|
|
||||||
SPAWN_LAMP((message, level) -> {
|
SPAWN_LAMP((message, level) -> {
|
||||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
||||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.potion;
|
||||||
|
|
||||||
import net.minecraft.world.effect.MobEffect;
|
import net.minecraft.world.effect.MobEffect;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("NonConstantFieldWithUpperCaseName")
|
||||||
public final class ModPotions {
|
public final class ModPotions {
|
||||||
|
|
||||||
public static MobEffect BREATHLESS;
|
public static MobEffect BREATHLESS;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ClientProxy implements IProxy {
|
||||||
this.addColorProvidingBlock(color);
|
this.addColorProvidingBlock(color);
|
||||||
if (item instanceof IColorProvidingItem color)
|
if (item instanceof IColorProvidingItem color)
|
||||||
this.addColorProvidingItem(color);
|
this.addColorProvidingItem(color);
|
||||||
if (item instanceof ITESRProvider provider)
|
if (item instanceof ITESRProvider<?> provider)
|
||||||
provider.registerTESR();
|
provider.registerTESR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ public class ClientProxy implements IProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public void postInit(FMLCommonSetupEvent event) {
|
public void postInit(FMLCommonSetupEvent event) {
|
||||||
// TODO this uses a vanilla model so we can't just add the json entry to it
|
// TODO this uses a vanilla model so we can't just add the json entry to it
|
||||||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped());
|
ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped());
|
||||||
|
@ -107,6 +108,7 @@ public class ClientProxy implements IProxy {
|
||||||
var colors = Minecraft.getInstance().getItemColors();
|
var colors = Minecraft.getInstance().getItemColors();
|
||||||
var color = item.getItemColor();
|
var color = item.getItemColor();
|
||||||
|
|
||||||
|
// TODO use event
|
||||||
if (item instanceof Item) {
|
if (item instanceof Item) {
|
||||||
colors.register(color, (Item) item);
|
colors.register(color, (Item) item);
|
||||||
} else if (item instanceof Block) {
|
} else if (item instanceof Block) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ public final class ModRecipes {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Registry.RECIPE_TYPE.getKey(this).toString();
|
return ForgeRegistries.RECIPE_TYPES.getKey(this).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public enum ModArmorMaterial implements ArmorMaterial {
|
||||||
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
|
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
|
||||||
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.of(ModItems.SKY_INGOT));
|
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.of(ModItems.SKY_INGOT));
|
||||||
|
|
||||||
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11};
|
private static final int[] MAX_DAMAGE_ARRAY = {13, 15, 16, 11};
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int maxDamageFactor;
|
private final int maxDamageFactor;
|
||||||
private final int[] damageReductionAmountArray;
|
private final int[] damageReductionAmountArray;
|
||||||
|
|
|
@ -43,6 +43,7 @@ public enum ModItemTier implements Tier {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"deprecation", "RedundantSuppression"})
|
||||||
public int getLevel() {
|
public int getLevel() {
|
||||||
return this.harvestLevel;
|
return this.harvestLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import de.ellpeck.naturesaura.potion.ModPotions;
|
||||||
import de.ellpeck.naturesaura.potion.PotionBreathless;
|
import de.ellpeck.naturesaura.potion.PotionBreathless;
|
||||||
import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||||
import net.minecraft.data.worldgen.Structures;
|
|
||||||
import net.minecraft.data.worldgen.features.FeatureUtils;
|
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
@ -217,7 +216,7 @@ public final class ModRegistry {
|
||||||
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ModRegistry.ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
|
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ModRegistry.ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
|
||||||
|
|
||||||
for (var item : ModRegistry.ALL_ITEMS) {
|
for (var item : ModRegistry.ALL_ITEMS) {
|
||||||
if (item instanceof ModTileType type)
|
if (item instanceof ModTileType<?> type)
|
||||||
h.register(new ResourceLocation(NaturesAura.MOD_ID, type.getBaseName()), type.type);
|
h.register(new ResourceLocation(NaturesAura.MOD_ID, type.getBaseName()), type.type);
|
||||||
}
|
}
|
||||||
Helper.populateObjectHolders(ModBlockEntities.class, event.getForgeRegistry());
|
Helper.populateObjectHolders(ModBlockEntities.class, event.getForgeRegistry());
|
||||||
|
|
Loading…
Reference in a new issue