Continue migration

This commit is contained in:
Aleksey 2021-04-12 16:34:13 +03:00
parent 47ed597358
commit 33dbfbe633
263 changed files with 1450 additions and 1486 deletions

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.AbstractBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.blocks.basis.FurBlock; import ru.betterend.blocks.basis.FurBlock;
@ -16,7 +16,7 @@ import ru.betterend.util.MHelper;
public class BlueVineSeedBlock extends EndPlantWithAgeBlock { public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int height = MHelper.randRange(2, 5, random); int height = MHelper.randRange(2, 5, random);
int h = BlocksHelper.upRay(world, pos, height + 2); int h = BlocksHelper.upRay(world, pos, height + 2);
if (h < height + 1) { if (h < height + 1) {
@ -33,7 +33,7 @@ public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
placeLantern(world, pos.up(height + 1)); placeLantern(world, pos.up(height + 1));
} }
private void placeLantern(StructureWorldAccess world, BlockPos pos) { private void placeLantern(WorldGenLevel world, BlockPos pos) {
BlocksHelper.setWithoutUpdate(world, pos, BlocksHelper.setWithoutUpdate(world, pos,
EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().with(BlueVineLanternBlock.NATURAL, true)); EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().with(BlueVineLanternBlock.NATURAL, true));
for (Direction dir : BlocksHelper.HORIZONTAL) { for (Direction dir : BlocksHelper.HORIZONTAL) {

View file

@ -11,7 +11,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
@ -21,7 +21,7 @@ public class BulbVineSeedBlock extends EndPlantWithAgeBlock {
} }
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int h = BlocksHelper.downRay(world, pos, random.nextInt(24)) - 1; int h = BlocksHelper.downRay(world, pos, random.nextInt(24)) - 1;
if (h > 2) { if (h > 2) {
BlocksHelper.setWithoutUpdate(world, pos, BlocksHelper.setWithoutUpdate(world, pos,

View file

@ -11,7 +11,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
@ -45,7 +45,7 @@ public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
} }
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
} }
@Override @Override

View file

@ -1,7 +1,7 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.TransparentBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -40,7 +40,7 @@ public class EmeraldIceBlock extends TransparentBlock implements IRenderTypeable
} }
@Override @Override
public void afterBreak(Level world, PlayerEntity player, BlockPos pos, BlockState state, public void afterBreak(Level world, Player player, BlockPos pos, BlockState state,
@Nullable BlockEntity blockEntity, ItemStack stack) { @Nullable BlockEntity blockEntity, ItemStack stack) {
super.afterBreak(world, player, pos, state, blockEntity, stack); super.afterBreak(world, player, pos, state, blockEntity, stack);
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) { if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) {

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;

View file

@ -2,9 +2,9 @@ package ru.betterend.blocks;
import java.util.Random; import java.util.Random;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock; import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -12,7 +12,7 @@ import ru.betterend.util.BlocksHelper;
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock { public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
@Override @Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) { public void grow(WorldGenLevel world, Random random, BlockPos pos) {
if (canGrow(world, pos)) { if (canGrow(world, pos)) {
BlocksHelper.setWithoutUpdate(world, pos, BlocksHelper.setWithoutUpdate(world, pos,
EndBlocks.END_LILY.defaultBlockState().with(EndLilyBlock.SHAPE, TripleShape.BOTTOM)); EndBlocks.END_LILY.defaultBlockState().with(EndLilyBlock.SHAPE, TripleShape.BOTTOM));
@ -27,7 +27,7 @@ public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
} }
} }
private boolean canGrow(StructureWorldAccess world, BlockPos pos) { private boolean canGrow(WorldGenLevel world, BlockPos pos) {
BlockPos up = pos.up(); BlockPos up = pos.up();
while (world.getBlockState(up).getFluidState().getFluid().equals(Fluids.WATER.getStill())) { while (world.getBlockState(up).getFluidState().getFluid().equals(Fluids.WATER.getStill())) {
up = up.up(); up = up.up();

View file

@ -3,11 +3,11 @@ package ru.betterend.blocks;
import java.util.Random; import java.util.Random;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock; import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -15,7 +15,7 @@ import ru.betterend.util.BlocksHelper;
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock { public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
@Override @Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) { public void grow(WorldGenLevel world, Random random, BlockPos pos) {
if (canGrow(world, pos)) { if (canGrow(world, pos)) {
BlockState startLeaf = EndBlocks.END_LOTUS_STEM.defaultBlockState().with(EndLotusStemBlock.LEAF, true); BlockState startLeaf = EndBlocks.END_LOTUS_STEM.defaultBlockState().with(EndLotusStemBlock.LEAF, true);
BlockState roots = EndBlocks.END_LOTUS_STEM.defaultBlockState() BlockState roots = EndBlocks.END_LOTUS_STEM.defaultBlockState()
@ -34,7 +34,7 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
int height = random.nextBoolean() ? 0 : random.nextBoolean() ? 1 : random.nextBoolean() ? 1 : -1; int height = random.nextBoolean() ? 0 : random.nextBoolean() ? 1 : random.nextBoolean() ? 1 : -1;
TripleShape shape = (height == 0) ? TripleShape.TOP : TripleShape.MIDDLE; TripleShape shape = (height == 0) ? TripleShape.TOP : TripleShape.MIDDLE;
Direction dir = BlocksHelper.randomHorizontal(random); Direction dir = BlocksHelper.randomHorizontal(random);
BlockPos leafCenter = bpos.toImmutable().offset(dir); BlockPos leafCenter = bpos.immutable().offset(dir);
if (hasLeaf(world, leafCenter)) { if (hasLeaf(world, leafCenter)) {
generateLeaf(world, leafCenter); generateLeaf(world, leafCenter);
BlocksHelper.setWithoutUpdate(world, bpos, BlocksHelper.setWithoutUpdate(world, bpos,
@ -79,7 +79,7 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
} }
} }
private boolean canGrow(StructureWorldAccess world, BlockPos pos) { private boolean canGrow(WorldGenLevel world, BlockPos pos) {
MutableBlockPos bpos = new MutableBlockPos(); MutableBlockPos bpos = new MutableBlockPos();
bpos.set(pos); bpos.set(pos);
while (world.getBlockState(bpos).getFluidState().getFluid().equals(Fluids.WATER.getStill())) { while (world.getBlockState(bpos).getFluidState().getFluid().equals(Fluids.WATER.getStill())) {
@ -88,7 +88,7 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
return world.isAir(bpos) && world.isAir(bpos.up()); return world.isAir(bpos) && world.isAir(bpos.up());
} }
private void generateLeaf(StructureWorldAccess world, BlockPos pos) { private void generateLeaf(WorldGenLevel world, BlockPos pos) {
MutableBlockPos p = new MutableBlockPos(); MutableBlockPos p = new MutableBlockPos();
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState(); BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
BlocksHelper.setWithoutUpdate(world, pos, leaf.with(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM)); BlocksHelper.setWithoutUpdate(world, pos, leaf.with(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
@ -104,7 +104,7 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
} }
} }
private boolean hasLeaf(StructureWorldAccess world, BlockPos pos) { private boolean hasLeaf(WorldGenLevel world, BlockPos pos) {
MutableBlockPos p = new MutableBlockPos(); MutableBlockPos p = new MutableBlockPos();
p.setY(pos.getY()); p.setY(pos.getY());
int count = 0; int count = 0;

View file

@ -11,7 +11,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.Waterloggable; import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.HorizontalFacingBlock;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -52,7 +52,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
this.setDefaultState(this.stateManager.defaultBlockState().with(FACING, Direction.NORTH).with(LIT, false)); this.setDefaultState(this.stateManager.defaultBlockState().with(FACING, Direction.NORTH).with(LIT, false));
} }
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (world.isClientSide) { if (world.isClientSide) {
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@ -62,7 +62,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
} }
} }
private void openScreen(Level world, BlockPos pos, PlayerEntity player) { private void openScreen(Level world, BlockPos pos, Player player) {
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof EndStoneSmelterBlockEntity) { if (blockEntity instanceof EndStoneSmelterBlockEntity) {
player.openHandledScreen((EndStoneSmelterBlockEntity) blockEntity); player.openHandledScreen((EndStoneSmelterBlockEntity) blockEntity);

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.block.SnowBlock; import net.minecraft.world.level.block.SnowBlock;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -50,7 +50,7 @@ public class EndTerrainBlock extends BlockBase {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (pathBlock != null && player.getMainHandStack().getItem().isIn(FabricToolTags.SHOVELS)) { if (pathBlock != null && player.getMainHandStack().getItem().isIn(FabricToolTags.SHOVELS)) {
world.playLocalSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); world.playLocalSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -86,7 +86,7 @@ public class EternalPedestal extends PedestalBlock {
} }
@Override @Override
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) { public float calcBlockBreakingDelta(BlockState state, Player player, BlockView world, BlockPos pos) {
return 0.0F; return 0.0F;
} }

View file

@ -6,7 +6,7 @@ import com.google.common.collect.Lists;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -16,7 +16,7 @@ import net.minecraft.world.explosion.Explosion;
public class EternalRunedFlavolite extends RunedFlavolite { public class EternalRunedFlavolite extends RunedFlavolite {
@Override @Override
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) { public float calcBlockBreakingDelta(BlockState state, Player player, BlockView world, BlockPos pos) {
return 0.0F; return 0.0F;
} }

View file

@ -12,7 +12,7 @@ import net.minecraft.state.property.Properties;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -27,7 +27,7 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
} }
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int height = MHelper.randRange(1, 2, random); int height = MHelper.randRange(1, 2, random);
int h = BlocksHelper.upRay(world, pos, height + 2); int h = BlocksHelper.upRay(world, pos, height + 2);
if (h < height) { if (h < height) {

View file

@ -1,6 +1,6 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.HydraluxShape; import ru.betterend.blocks.BlockProperties.HydraluxShape;
import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock; import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -15,7 +15,7 @@ import ru.betterend.util.MHelper;
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock { public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock {
@Override @Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) { public void grow(WorldGenLevel world, Random random, BlockPos pos) {
int h = MHelper.randRange(4, 8, random); int h = MHelper.randRange(4, 8, random);
MutableBlockPos mut = new MutableBlockPos().set(pos); MutableBlockPos mut = new MutableBlockPos().set(pos);

View file

@ -20,7 +20,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -7,7 +7,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties.PentaShape; import ru.betterend.blocks.BlockProperties.PentaShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -16,7 +16,7 @@ import ru.betterend.util.MHelper;
public class LanceleafSeedBlock extends EndPlantWithAgeBlock { public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int height = MHelper.randRange(4, 6, random); int height = MHelper.randRange(4, 6, random);
int h = BlocksHelper.upRay(world, pos, height + 2); int h = BlocksHelper.upRay(world, pos, height + 2);
if (h < height + 1) { if (h < height + 1) {

View file

@ -5,15 +5,15 @@ import java.util.Random;
import net.minecraft.world.level.block.AbstractBlock; import net.minecraft.world.level.block.AbstractBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock; import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;
public class LumecornSeedBlock extends EndPlantWithAgeBlock { public class LumecornSeedBlock extends EndPlantWithAgeBlock {
@Override @Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) { public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
EndFeatures.LUMECORN.getFeature().generate(world, null, random, pos, null); EndFeatures.LUMECORN.getFeature().place(world, null, random, pos, null);
} }
@Override @Override

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.FluidDrainable;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.Pair; import net.minecraft.util.Pair;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;

View file

@ -8,9 +8,9 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.entity.ItemEntity; import net.minecraft.world.entity.ItemEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -35,7 +35,7 @@ public class MengerSpongeWetBlock extends BlockBaseNotFull implements IRenderTyp
if (world.getDimension().isUltrawarm()) { if (world.getDimension().isUltrawarm()) {
world.setBlockAndUpdate(pos, EndBlocks.MENGER_SPONGE.defaultBlockState(), 3); world.setBlockAndUpdate(pos, EndBlocks.MENGER_SPONGE.defaultBlockState(), 3);
world.syncWorldEvent(2009, pos, 0); world.syncWorldEvent(2009, pos, 0);
world.playLocalSound((PlayerEntity) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0F, world.playLocalSound((Player) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0F,
(1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F); (1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F);
} }
} }
@ -80,7 +80,7 @@ public class MengerSpongeWetBlock extends BlockBaseNotFull implements IRenderTyp
} }
@Override @Override
public void onBreak(Level world, BlockPos pos, BlockState state, PlayerEntity player) { public void onBreak(Level world, BlockPos pos, BlockState state, Player player) {
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR); BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
if (!world.isClientSide()) { if (!world.isClientSide()) {
world.syncWorldEvent(2001, pos, getRawIdFromState(state)); world.syncWorldEvent(2001, pos, getRawIdFromState(state));

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -8,8 +8,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.pathing.NavigationType; import net.minecraft.world.entity.ai.pathing.NavigationType;
import net.minecraft.world.entity.effect.StatusEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.effect.StatusEffects; import net.minecraft.world.effect.MobEffects;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -30,8 +30,8 @@ public class MurkweedBlock extends EndPlantBlock {
@Override @Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (entity instanceof LivingEntity && !((LivingEntity) entity).hasStatusEffect(StatusEffects.BLINDNESS)) { if (entity instanceof LivingEntity && !((LivingEntity) entity).hasMobEffect(MobEffects.BLINDNESS)) {
((LivingEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 50)); ((LivingEntity) entity).addMobEffect(new MobEffectInstance(MobEffects.BLINDNESS, 50));
} }
} }

View file

@ -11,7 +11,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.Waterloggable; import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -14,7 +14,7 @@ import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -113,7 +113,7 @@ public class RespawnObeliskBlock extends BlockBase implements IColorProvider, IR
} }
@Override @Override
public void onBreak(Level world, BlockPos pos, BlockState state, PlayerEntity player) { public void onBreak(Level world, BlockPos pos, BlockState state, Player player) {
if (player.isCreative()) { if (player.isCreative()) {
TripleShape shape = state.getValue(SHAPE); TripleShape shape = state.getValue(SHAPE);
if (shape == TripleShape.MIDDLE) { if (shape == TripleShape.MIDDLE) {
@ -152,7 +152,7 @@ public class RespawnObeliskBlock extends BlockBase implements IColorProvider, IR
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
ItemStack itemStack = player.getStackInHand(hand); ItemStack itemStack = player.getStackInHand(hand);
boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5; boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5;

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.entity.ItemEntity; import net.minecraft.world.entity.ItemEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -89,7 +89,7 @@ public class SilkMothHiveBlock extends BlockBase {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (hand == Hand.MAIN_HAND) { if (hand == Hand.MAIN_HAND) {
ItemStack stack = player.getMainHandStack(); ItemStack stack = player.getMainHandStack();

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.entity.ItemEntity; import net.minecraft.world.entity.ItemEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -112,7 +112,7 @@ public class SilkMothNestBlock extends BlockBase implements IRenderTypeable {
} }
@Override @Override
public void onBreak(Level world, BlockPos pos, BlockState state, PlayerEntity player) { public void onBreak(Level world, BlockPos pos, BlockState state, Player player) {
if (!state.getValue(ACTIVE) && player.isCreative()) { if (!state.getValue(ACTIVE) && player.isCreative()) {
BlocksHelper.setWithUpdate(world, pos.below(), Blocks.AIR); BlocksHelper.setWithUpdate(world, pos.below(), Blocks.AIR);
} }
@ -151,7 +151,7 @@ public class SilkMothNestBlock extends BlockBase implements IRenderTypeable {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (hand == Hand.MAIN_HAND) { if (hand == Hand.MAIN_HAND) {
ItemStack stack = player.getMainHandStack(); ItemStack stack = player.getMainHandStack();

View file

@ -30,7 +30,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) { public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlockPos bigPos = growBig(world, pos); BlockPos bigPos = growBig(world, pos);
if (bigPos != null) { if (bigPos != null) {
if (EndFeatures.GIGANTIC_AMARANITA.getFeature().generate(world, null, random, bigPos, null)) { if (EndFeatures.GIGANTIC_AMARANITA.getFeature().place(world, null, random, bigPos, null)) {
replaceMushroom(world, bigPos); replaceMushroom(world, bigPos);
replaceMushroom(world, bigPos.south()); replaceMushroom(world, bigPos.south());
replaceMushroom(world, bigPos.east()); replaceMushroom(world, bigPos.east());
@ -38,7 +38,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
} }
return; return;
} }
EndFeatures.LARGE_AMARANITA.getFeature().generate(world, null, random, pos, null); EndFeatures.LARGE_AMARANITA.getFeature().place(world, null, random, pos, null);
} }
@Override @Override

View file

@ -95,6 +95,6 @@ public class SmallJellyshroomBlock extends AttachedBlock implements IRenderTypea
@Override @Override
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) { public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR); BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
EndFeatures.JELLYSHROOM.getFeature().generate(world, null, random, pos, null); EndFeatures.JELLYSHROOM.getFeature().place(world, null, random, pos, null);
} }
} }

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.Waterloggable; import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;

View file

@ -18,7 +18,7 @@ import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.Waterloggable; import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures; import ru.betterend.registry.EndFeatures;

View file

@ -5,7 +5,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -37,7 +37,7 @@ public class UmbrellaTreeClusterBlock extends BlockBase {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
ItemStack stack = player.getMainHandStack(); ItemStack stack = player.getMainHandStack();
if (stack.getItem() == Items.GLASS_BOTTLE) { if (stack.getItem() == Items.GLASS_BOTTLE) {

View file

@ -3,7 +3,7 @@ package ru.betterend.blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.FeatureSaplingBlock; import ru.betterend.blocks.basis.FeatureSaplingBlock;
import ru.betterend.client.render.ERenderLayer; import ru.betterend.client.render.ERenderLayer;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.mob.PiglinBrain; import net.minecraft.world.entity.mob.PiglinBrain;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -48,7 +48,7 @@ public class EndBarrelBlock extends BarrelBlock implements BlockPatterned {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (world.isClientSide) { if (world.isClientSide) {
return ActionResult.SUCCESS; return ActionResult.SUCCESS;

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
@ -25,7 +25,7 @@ public class EndBlockStripableLogLog extends EndPillarBlock {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (player.getMainHandStack().getItem().isIn(FabricToolTags.AXES)) { if (player.getMainHandStack().getItem().isIn(FabricToolTags.AXES)) {
world.playLocalSound(player, pos, SoundEvents.ITEM_AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); world.playLocalSound(player, pos, SoundEvents.ITEM_AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.FurnaceBlock; import net.minecraft.world.level.block.FurnaceBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -42,7 +42,7 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockPatterned, IRe
} }
@Override @Override
protected void openScreen(Level world, BlockPos pos, PlayerEntity player) { protected void openScreen(Level world, BlockPos pos, Player player) {
BlockEntity blockEntity = world.getBlockEntity(pos); BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof EFurnaceBlockEntity) { if (blockEntity instanceof EFurnaceBlockEntity) {
player.openHandledScreen((NamedScreenHandlerFactory) blockEntity); player.openHandledScreen((NamedScreenHandlerFactory) blockEntity);

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.HorizontalFacingBlock; import net.minecraft.world.level.block.HorizontalFacingBlock;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.block.FluidFillable;
import net.minecraft.world.level.block.Waterloggable; import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
@ -33,7 +33,7 @@ public abstract class EndPlantWithAgeBlock extends EndPlantBlock {
stateManager.add(AGE); stateManager.add(AGE);
} }
public abstract void growAdult(StructureWorldAccess world, Random random, BlockPos pos); public abstract void growAdult(WorldGenLevel world, Random random, BlockPos pos);
@Override @Override
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) { public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {

View file

@ -12,10 +12,10 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -79,10 +79,10 @@ public class EndSignBlock extends AbstractSignBlock implements BlockPatterned, I
@Override @Override
public void onPlaced(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { public void onPlaced(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
if (placer != null && placer instanceof PlayerEntity) { if (placer != null && placer instanceof Player) {
ESignBlockEntity sign = (ESignBlockEntity) world.getBlockEntity(pos); ESignBlockEntity sign = (ESignBlockEntity) world.getBlockEntity(pos);
if (!world.isClientSide) { if (!world.isClientSide) {
sign.setEditor((PlayerEntity) placer); sign.setEditor((Player) placer);
((ServerPlayer) placer).networkHandler.sendPacket(new SignEditorOpenS2CPacket(pos)); ((ServerPlayer) placer).networkHandler.sendPacket(new SignEditorOpenS2CPacket(pos));
} else { } else {
sign.setEditable(true); sign.setEditable(true);

View file

@ -7,7 +7,7 @@ import net.minecraft.world.level.block.FluidFillable;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;

View file

@ -21,7 +21,7 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.client.render.ERenderLayer; import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable; import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.patterns.Patterns; import ru.betterend.patterns.Patterns;
@ -73,7 +73,7 @@ public abstract class FeatureSaplingBlock extends BlockBaseNotFull implements Fe
@Override @Override
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) { public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {
getFeature().generate(world, world.getChunkManager().getChunkGenerator(), random, pos, null); getFeature().place(world, world.getChunkManager().getChunkGenerator(), random, pos, null);
} }
@Override @Override

View file

@ -13,7 +13,7 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.item.ItemConvertible; import net.minecraft.world.level.ItemLike;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -29,17 +29,17 @@ import ru.betterend.util.MHelper;
public class FurBlock extends AttachedBlock implements IRenderTypeable { public class FurBlock extends AttachedBlock implements IRenderTypeable {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
private final ItemConvertible drop; private final ItemLike drop;
private final int dropChance; private final int dropChance;
public FurBlock(ItemConvertible drop, int light, int dropChance, boolean wet) { public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS) super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS)
.sounds(wet ? SoundType.WET_GRASS : SoundType.GRASS).luminance(light).breakByHand(true).noCollision()); .sounds(wet ? SoundType.WET_GRASS : SoundType.GRASS).luminance(light).breakByHand(true).noCollision());
this.drop = drop; this.drop = drop;
this.dropChance = dropChance; this.dropChance = dropChance;
} }
public FurBlock(ItemConvertible drop, int dropChance) { public FurBlock(ItemLike drop, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS) super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS)
.sounds(SoundType.GRASS).breakByHand(true).noCollision()); .sounds(SoundType.GRASS).breakByHand(true).noCollision());
this.drop = drop; this.drop = drop;

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.block.BlockEntityProvider;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.ShapeContext; import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
@ -100,7 +100,7 @@ public class PedestalBlock extends BlockBaseNotFull implements BlockEntityProvid
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (world.isClientSide || !state.is(this)) if (world.isClientSide || !state.is(this))
return ActionResult.CONSUME; return ActionResult.CONSUME;
@ -286,7 +286,7 @@ public class PedestalBlock extends BlockBaseNotFull implements BlockEntityProvid
for (int i = 2; i < Direction.values().length; i++) { for (int i = 2; i < Direction.values().length; i++) {
dropPos = pos.relative(Direction.byId(i)); dropPos = pos.relative(Direction.byId(i));
if (world.getBlockState(dropPos).isAir()) { if (world.getBlockState(dropPos).isAir()) {
return dropPos.toImmutable(); return dropPos.immutable();
} }
} }
return getDropPos(world, pos.up()); return getDropPos(world, pos.up());

View file

@ -10,7 +10,7 @@ import net.minecraft.world.level.block.Waterloggable;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;

View file

@ -6,7 +6,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
@ -25,7 +25,7 @@ public class StrippableBarkBlock extends BarkBlock {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
if (player.getMainHandStack().getItem().isIn(FabricToolTags.AXES)) { if (player.getMainHandStack().getItem().isIn(FabricToolTags.AXES)) {
world.playLocalSound(player, pos, SoundEvents.ITEM_AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); world.playLocalSound(player, pos, SoundEvents.ITEM_AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemPlacementContext; import net.minecraft.world.item.ItemPlacementContext;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
@ -68,7 +68,7 @@ public class TripleTerrainBlock extends EndTerrainBlock {
} }
@Override @Override
public ActionResult onUse(BlockState state, Level world, BlockPos pos, PlayerEntity player, Hand hand, public ActionResult onUse(BlockState state, Level world, BlockPos pos, Player player, Hand hand,
BlockHitResult hit) { BlockHitResult hit) {
TripleShape shape = state.getValue(SHAPE); TripleShape shape = state.getValue(SHAPE);
if (shape == TripleShape.BOTTOM) { if (shape == TripleShape.BOTTOM) {

View file

@ -20,7 +20,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.entity.ItemEntity; import net.minecraft.world.entity.ItemEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock { public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
@ -28,7 +28,7 @@ public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
stateManager.add(AGE); stateManager.add(AGE);
} }
public abstract void grow(StructureWorldAccess world, Random random, BlockPos pos); public abstract void grow(WorldGenLevel world, Random random, BlockPos pos);
@Override @Override
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) { public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {

View file

@ -14,7 +14,7 @@ import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -85,7 +85,7 @@ public class UpDownPlantBlock extends BlockBaseNotFull implements IRenderTypeabl
} }
@Override @Override
public void afterBreak(Level world, PlayerEntity player, BlockPos pos, BlockState state, BlockEntity blockEntity, public void afterBreak(Level world, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity,
ItemStack stack) { ItemStack stack) {
super.afterBreak(world, player, pos, state, blockEntity, stack); super.afterBreak(world, player, pos, state, blockEntity, stack);
world.updateNeighbor(pos, Blocks.AIR, pos.below()); world.updateNeighbor(pos, Blocks.AIR, pos.below());

View file

@ -9,7 +9,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.DyeItem;
import net.minecraft.world.item.ItemConvertible; import net.minecraft.world.level.ItemLike;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.recipe.builders.GridRecipe;
@ -17,7 +17,7 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
public class ColoredMaterial { public class ColoredMaterial {
private static final Map<Integer, ItemConvertible> DYES = Maps.newHashMap(); private static final Map<Integer, ItemLike> DYES = Maps.newHashMap();
private static final Map<Integer, String> COLORS = Maps.newHashMap(); private static final Map<Integer, String> COLORS = Maps.newHashMap();
private final Map<Integer, Block> colors = Maps.newHashMap(); private final Map<Integer, Block> colors = Maps.newHashMap();
@ -26,7 +26,7 @@ public class ColoredMaterial {
} }
public ColoredMaterial(Function<FabricBlockSettings, Block> constructor, Block source, Map<Integer, String> colors, public ColoredMaterial(Function<FabricBlockSettings, Block> constructor, Block source, Map<Integer, String> colors,
Map<Integer, ItemConvertible> dyes, boolean craftEight) { Map<Integer, ItemLike> dyes, boolean craftEight) {
String id = Registry.BLOCK.getKey(source).getPath(); String id = Registry.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> { colors.forEach((color, name) -> {
String blockName = id + "_" + name; String blockName = id + "_" + name;

View file

@ -62,8 +62,8 @@ public class WoodenMaterial {
public final Block shelf; public final Block shelf;
public final Block composter; public final Block composter;
public final Tag.Identified<Block> logBlockTag; public final Tag.Named<Block> logBlockTag;
public final Tag.Identified<Item> logItemTag; public final Tag.Named<Item> logItemTag;
public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor) { public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor) {
FabricBlockSettings materialPlanks = FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(planksColor); FabricBlockSettings materialPlanks = FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(planksColor);

View file

@ -5,7 +5,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.entity.LootableContainerBlockEntity; import net.minecraft.world.level.block.entity.LootableContainerBlockEntity;
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.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories; import net.minecraft.inventory.Inventories;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -13,7 +13,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.screen.GenericContainerScreenHandler; import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
@ -73,7 +73,7 @@ public class EBarrelBlockEntity extends LootableContainerBlockEntity {
return GenericContainerScreenHandler.createGeneric9x3(syncId, playerInventory, this); return GenericContainerScreenHandler.createGeneric9x3(syncId, playerInventory, this);
} }
public void onOpen(PlayerEntity player) { public void onOpen(Player player) {
if (!player.isSpectator()) { if (!player.isSpectator()) {
if (this.viewerCount < 0) { if (this.viewerCount < 0) {
this.viewerCount = 0; this.viewerCount = 0;
@ -117,7 +117,7 @@ public class EBarrelBlockEntity extends LootableContainerBlockEntity {
} }
} }
public void onClose(PlayerEntity player) { public void onClose(Player player) {
if (!player.isSpectator()) { if (!player.isSpectator()) {
--this.viewerCount; --this.viewerCount;
} }
@ -132,7 +132,7 @@ public class EBarrelBlockEntity extends LootableContainerBlockEntity {
double d = (double) this.pos.getX() + 0.5D + (double) vec3i.getX() / 2.0D; double d = (double) this.pos.getX() + 0.5D + (double) vec3i.getX() / 2.0D;
double e = (double) this.pos.getY() + 0.5D + (double) vec3i.getY() / 2.0D; double e = (double) this.pos.getY() + 0.5D + (double) vec3i.getY() / 2.0D;
double f = (double) this.pos.getZ() + 0.5D + (double) vec3i.getZ() / 2.0D; double f = (double) this.pos.getZ() + 0.5D + (double) vec3i.getZ() / 2.0D;
this.world.playLocalSound((PlayerEntity) null, d, e, f, soundEvent, SoundSource.BLOCKS, 0.5F, this.world.playLocalSound((Player) null, d, e, f, soundEvent, SoundSource.BLOCKS, 0.5F,
this.world.random.nextFloat() * 0.1F + 0.9F); this.world.random.nextFloat() * 0.1F + 0.9F);
} }
} }

View file

@ -14,12 +14,12 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.LockableContainerBlockEntity; import net.minecraft.world.level.block.entity.LockableContainerBlockEntity;
import net.minecraft.world.entity.ExperienceOrbEntity; import net.minecraft.world.entity.ExperienceOrbEntity;
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.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventories; import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.SidedInventory; import net.minecraft.inventory.SidedInventory;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemConvertible; import net.minecraft.world.level.ItemLike;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -171,7 +171,7 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity
return smeltTime; return smeltTime;
} }
public void dropExperience(PlayerEntity player) { public void dropExperience(Player player) {
assert world != null; assert world != null;
List<Recipe<?>> list = Lists.newArrayList(); List<Recipe<?>> list = Lists.newArrayList();
for (Entry<ResourceLocation> entry : this.recipesUsed.object2IntEntrySet()) { for (Entry<ResourceLocation> entry : this.recipesUsed.object2IntEntrySet()) {
@ -205,7 +205,7 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity
} }
@Override @Override
public boolean canPlayerUse(PlayerEntity player) { public boolean canPlayerUse(Player player) {
assert this.world != null; assert this.world != null;
if (this.world.getBlockEntity(this.pos) != this) { if (this.world.getBlockEntity(this.pos) != this) {
return false; return false;
@ -442,7 +442,7 @@ public class EndStoneSmelterBlockEntity extends LockableContainerBlockEntity
return AVAILABLE_FUELS.containsKey(stack.getItem()) || getFabricFuel(stack) > 2000; return AVAILABLE_FUELS.containsKey(stack.getItem()) || getFabricFuel(stack) > 2000;
} }
public static void registerFuel(ItemConvertible fuel, int time) { public static void registerFuel(ItemLike fuel, int time) {
AVAILABLE_FUELS.put(fuel.asItem(), time); AVAILABLE_FUELS.put(fuel.asItem(), time);
} }

View file

@ -4,7 +4,7 @@ import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -97,7 +97,7 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
} }
@Override @Override
public boolean canPlayerUse(PlayerEntity player) { public boolean canPlayerUse(Player player) {
return true; return true;
} }

View file

@ -24,7 +24,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.LightmapCoordinatesRetriever; import net.minecraft.client.render.block.entity.LightmapCoordinatesRetriever;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;

View file

@ -21,7 +21,7 @@ import net.minecraft.client.render.block.entity.SignBlockEntityRenderer.SignMode
import net.minecraft.client.texture.NativeImage; import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.text.OrderedText; import net.minecraft.text.OrderedText;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;

View file

@ -3,14 +3,14 @@ package ru.betterend.blocks.entities.render;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.Minecraft;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -47,7 +47,7 @@ public class PedestalItemRenderer<T extends PedestalBlockEntity> extends BlockEn
ItemStack activeItem = blockEntity.getStack(0); ItemStack activeItem = blockEntity.getStack(0);
matrices.push(); matrices.push();
MinecraftClient minecraft = MinecraftClient.getInstance(); Minecraft minecraft = Minecraft.getInstance();
BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, world, null); BakedModel model = minecraft.getItemRenderer().getHeldItemModel(activeItem, world, null);
Vector3f translate = model.getTransformation().ground.translation; Vector3f translate = model.getTransformation().ground.translation;
PedestalBlock pedestal = (PedestalBlock) state.getBlock(); PedestalBlock pedestal = (PedestalBlock) state.getBlock();

View file

@ -3,7 +3,7 @@ package ru.betterend.client.gui;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
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.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SimpleInventory; import net.minecraft.inventory.SimpleInventory;
@ -109,7 +109,7 @@ public class EndStoneSmelterScreenHandler extends AbstractRecipeScreenHandler<In
} }
@Override @Override
public boolean canUse(PlayerEntity player) { public boolean canUse(Player player) {
return this.inventory.canPlayerUse(player); return this.inventory.canPlayerUse(player);
} }
@ -123,7 +123,7 @@ public class EndStoneSmelterScreenHandler extends AbstractRecipeScreenHandler<In
} }
@Override @Override
public ItemStack transferSlot(PlayerEntity player, int index) { public ItemStack transferSlot(Player player, int index) {
ItemStack itemStack = ItemStack.EMPTY; ItemStack itemStack = ItemStack.EMPTY;
Slot slot = this.slots.get(index); Slot slot = this.slots.get(index);
if (slot != null && slot.hasStack()) { if (slot != null && slot.hasStack()) {

View file

@ -1,6 +1,6 @@
package ru.betterend.client.gui.slot; package ru.betterend.client.gui.slot;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
@ -8,10 +8,10 @@ import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
public class SmelterOutputSlot extends Slot { public class SmelterOutputSlot extends Slot {
private PlayerEntity player; private Player player;
private int amount; private int amount;
public SmelterOutputSlot(PlayerEntity player, Inventory inventory, int index, int x, int y) { public SmelterOutputSlot(Player player, Inventory inventory, int index, int x, int y) {
super(inventory, index, x, y); super(inventory, index, x, y);
this.player = player; this.player = player;
} }
@ -28,7 +28,7 @@ public class SmelterOutputSlot extends Slot {
return super.takeStack(amount); return super.takeStack(amount);
} }
public ItemStack onTakeItem(PlayerEntity player, ItemStack stack) { public ItemStack onTakeItem(Player player, ItemStack stack) {
this.onCrafted(stack); this.onCrafted(stack);
super.onTakeItem(player, stack); super.onTakeItem(player, stack);
return stack; return stack;

View file

@ -5,7 +5,7 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.math.Matrix3f; import net.minecraft.util.math.Matrix3f;

View file

@ -6,7 +6,7 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;

View file

@ -6,7 +6,7 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.core.Vec3i; import net.minecraft.core.Vec3i;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;

View file

@ -1,10 +1,10 @@
package ru.betterend.effects; package ru.betterend.effects;
import net.minecraft.world.entity.effect.StatusEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.effect.StatusEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.potion.Potion; import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.potion.Potions; import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.mixin.common.BrewingAccessor; import ru.betterend.mixin.common.BrewingAccessor;
@ -12,12 +12,12 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
public class EndPotions { public class EndPotions {
public final static Potion END_VEIL = registerPotion("end_veil", EndStatusEffects.END_VEIL, 3600); public final static Potion END_VEIL = registerPotion("end_veil", EndMobEffects.END_VEIL, 3600);
public final static Potion LONG_END_VEIL = registerPotion("long_end_veil", EndStatusEffects.END_VEIL, 9600); public final static Potion LONG_END_VEIL = registerPotion("long_end_veil", EndMobEffects.END_VEIL, 9600);
public static Potion registerPotion(String name, StatusEffect effect, int duration) { public static Potion registerPotion(String name, MobEffect effect, int duration) {
return registerPotion(name, return registerPotion(name,
new Potion(name, new StatusEffectInstance[] { new StatusEffectInstance(effect, duration) })); new Potion(name, new MobEffectInstance(effect, duration)));
} }
public static Potion registerPotion(String name, Potion potion) { public static Potion registerPotion(String name, Potion potion) {

View file

@ -1,15 +1,15 @@
package ru.betterend.effects; package ru.betterend.effects;
import net.minecraft.world.entity.effect.StatusEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.effects.status.EndVeilEffect; import ru.betterend.effects.status.EndVeilEffect;
public class EndStatusEffects { public class EndMobEffects {
public final static StatusEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect()); public final static MobEffect END_VEIL = registerEffect("end_veil", new EndVeilEffect());
public static <E extends StatusEffect> StatusEffect registerEffect(String name, E effect) { public static <E extends MobEffect> MobEffect registerEffect(String name, E effect) {
return Registry.register(Registry.STATUS_EFFECT, BetterEnd.makeID(name), effect); return Registry.register(Registry.STATUS_EFFECT, BetterEnd.makeID(name), effect);
} }
} }

View file

@ -1,12 +1,12 @@
package ru.betterend.effects.status; package ru.betterend.effects.status;
import net.minecraft.world.entity.effect.StatusEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.effect.StatusEffectType; import net.minecraft.world.effect.MobEffectType;
public class EndVeilEffect extends StatusEffect { public class EndVeilEffect extends MobEffect {
public EndVeilEffect() { public EndVeilEffect() {
super(StatusEffectType.BENEFICIAL, 0x0D554A); super(MobEffectType.BENEFICIAL, 0x0D554A);
} }
@Override @Override

View file

@ -12,28 +12,28 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.SpawnReason; import net.minecraft.world.entity.SpawnReason;
import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.control.MoveControl;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.damage.DamageSource; import net.minecraft.world.entity.damage.DamageSource;
import net.minecraft.world.entity.data.DataTracker; import net.minecraft.world.entity.data.DataTracker;
import net.minecraft.world.entity.data.TrackedData; import net.minecraft.world.entity.data.TrackedData;
import net.minecraft.world.entity.data.TrackedDataHandlerRegistry; import net.minecraft.world.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.world.entity.effect.StatusEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.effect.StatusEffects; import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.passive.SchoolingFishEntity; import net.minecraft.world.entity.passive.SchoolingFishEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket; import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
@ -50,7 +50,7 @@ public class CubozoaEntity extends SchoolingFishEntity {
} }
@Override @Override
public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, public EntityData initialize(ServerLevelAccessor world, LocalDifficulty difficulty, SpawnReason spawnReason,
EntityData entityData, CompoundTag entityTag) { EntityData entityData, CompoundTag entityTag) {
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag); EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
if (EndBiomes.getFromBiome(world.getBiome(getBlockPos())) == EndBiomes.SULPHUR_SPRINGS) { if (EndBiomes.getFromBiome(world.getBiome(getBlockPos())) == EndBiomes.SULPHUR_SPRINGS) {
@ -86,8 +86,8 @@ public class CubozoaEntity extends SchoolingFishEntity {
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0) return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0).add(Attributes.FOLLOW_RANGE, 16.0)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0).add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.5); .add(Attributes.MOVEMENT_SPEED, 0.5);
} }
public int getVariant() { public int getVariant() {
@ -98,7 +98,7 @@ public class CubozoaEntity extends SchoolingFishEntity {
return this.dataTracker.get(SCALE) / 32F + 0.75F; return this.dataTracker.get(SCALE) / 32F + 0.75F;
} }
public static boolean canSpawn(EntityType<CubozoaEntity> type, ServerWorldAccess world, SpawnReason spawnReason, public static boolean canSpawn(EntityType<CubozoaEntity> type, ServerLevelAccessor world, SpawnReason spawnReason,
BlockPos pos, Random random) { BlockPos pos, Random random) {
Box box = new Box(pos).expand(16); Box box = new Box(pos).expand(16);
List<CubozoaEntity> list = world.getEntitiesByClass(CubozoaEntity.class, box, (entity) -> { List<CubozoaEntity> list = world.getEntitiesByClass(CubozoaEntity.class, box, (entity) -> {
@ -131,14 +131,14 @@ public class CubozoaEntity extends SchoolingFishEntity {
} }
@Override @Override
public void onPlayerCollision(PlayerEntity player) { public void onPlayerCollision(Player player) {
if (player instanceof ServerPlayer && player.damage(DamageSource.mob(this), 0.5F)) { if (player instanceof ServerPlayer && player.damage(DamageSource.mob(this), 0.5F)) {
if (!this.isSilent()) { if (!this.isSilent()) {
((ServerPlayer) player).networkHandler ((ServerPlayer) player).networkHandler
.sendPacket(new GameStateChangeS2CPacket(GameStateChangeS2CPacket.PUFFERFISH_STING, 0.0F)); .sendPacket(new GameStateChangeS2CPacket(GameStateChangeS2CPacket.PUFFERFISH_STING, 0.0F));
} }
if (random.nextBoolean()) { if (random.nextBoolean()) {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 20, 0)); player.addMobEffect(new MobEffectInstance(MobEffects.POISON, 20, 0));
} }
} }
} }
@ -154,7 +154,7 @@ public class CubozoaEntity extends SchoolingFishEntity {
} }
if (this.state == MoveControl.State.MOVE_TO && !this.entity.getNavigation().isIdle()) { if (this.state == MoveControl.State.MOVE_TO && !this.entity.getNavigation().isIdle()) {
float f = (float) (this.speed * this.entity.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED)); float f = (float) (this.speed * this.entity.getAttributeValue(Attributes.MOVEMENT_SPEED));
this.entity.setMovementSpeed(Mth.lerp(0.125F, this.entity.getMovementSpeed(), f)); this.entity.setMovementSpeed(Mth.lerp(0.125F, this.entity.getMovementSpeed(), f));
double d = this.targetX - this.entity.getX(); double d = this.targetX - this.entity.getX();
double e = this.targetY - this.entity.getY(); double e = this.targetY - this.entity.getY();

View file

@ -20,16 +20,16 @@ import net.minecraft.world.entity.ai.pathing.EntityNavigation;
import net.minecraft.world.entity.ai.pathing.Path; import net.minecraft.world.entity.ai.pathing.Path;
import net.minecraft.world.entity.ai.pathing.PathNodeType; import net.minecraft.world.entity.ai.pathing.PathNodeType;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.mob.MobEntity; import net.minecraft.world.entity.mob.MobEntity;
import net.minecraft.world.entity.passive.AnimalEntity; import net.minecraft.world.entity.passive.AnimalEntity;
import net.minecraft.world.entity.passive.PassiveEntity; import net.minecraft.world.entity.passive.PassiveEntity;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Heightmap.Type; import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import ru.betterend.registry.EndEntities; import ru.betterend.registry.EndEntities;
@ -48,9 +48,9 @@ public class DragonflyEntity extends AnimalEntity implements Flutterer {
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 8.0D) return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 8.0D)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0D).add(EntityAttributes.GENERIC_FLYING_SPEED, 1.0D) .add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.FLYING_SPEED, 1.0D)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.1D); .add(Attributes.MOVEMENT_SPEED, 0.1D);
} }
@Override @Override
@ -190,7 +190,7 @@ public class DragonflyEntity extends AnimalEntity implements Flutterer {
return EndEntities.DRAGONFLY.create(world); return EndEntities.DRAGONFLY.create(world);
} }
public static boolean canSpawn(EntityType<DragonflyEntity> type, ServerWorldAccess world, SpawnReason spawnReason, public static boolean canSpawn(EntityType<DragonflyEntity> type, ServerLevelAccessor world, SpawnReason spawnReason,
BlockPos pos, Random random) { BlockPos pos, Random random) {
int y = world.getChunk(pos).sampleHeightmap(Type.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15); int y = world.getChunk(pos).sampleHeightmap(Type.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15);
return y > 0 && pos.getY() >= y; return y > 0 && pos.getY() >= y;

View file

@ -10,7 +10,7 @@ import net.minecraft.world.entity.ItemEntity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.SpawnReason; import net.minecraft.world.entity.SpawnReason;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.damage.DamageSource; import net.minecraft.world.entity.damage.DamageSource;
import net.minecraft.world.entity.data.DataTracker; import net.minecraft.world.entity.data.DataTracker;
import net.minecraft.world.entity.data.TrackedData; import net.minecraft.world.entity.data.TrackedData;
@ -19,12 +19,12 @@ import net.minecraft.world.entity.passive.SchoolingFishEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
@ -43,7 +43,7 @@ public class EndFishEntity extends SchoolingFishEntity {
} }
@Override @Override
public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, public EntityData initialize(ServerLevelAccessor world, LocalDifficulty difficulty, SpawnReason spawnReason,
EntityData entityData, CompoundTag entityTag) { EntityData entityData, CompoundTag entityTag) {
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag); EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
if (EndBiomes.getFromBiome(world.getBiome(getBlockPos())) == EndBiomes.SULPHUR_SPRINGS) { if (EndBiomes.getFromBiome(world.getBiome(getBlockPos())) == EndBiomes.SULPHUR_SPRINGS) {
@ -115,8 +115,8 @@ public class EndFishEntity extends SchoolingFishEntity {
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0) return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0).add(Attributes.FOLLOW_RANGE, 16.0)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0).add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.75); .add(Attributes.MOVEMENT_SPEED, 0.75);
} }
public int getVariant() { public int getVariant() {
@ -127,7 +127,7 @@ public class EndFishEntity extends SchoolingFishEntity {
return this.dataTracker.get(SCALE) / 32F + 0.75F; return this.dataTracker.get(SCALE) / 32F + 0.75F;
} }
public static boolean canSpawn(EntityType<EndFishEntity> type, ServerWorldAccess world, SpawnReason spawnReason, public static boolean canSpawn(EntityType<EndFishEntity> type, ServerLevelAccessor world, SpawnReason spawnReason,
BlockPos pos, Random random) { BlockPos pos, Random random) {
Box box = new Box(pos).expand(16); Box box = new Box(pos).expand(16);
List<EndFishEntity> list = world.getEntitiesByClass(EndFishEntity.class, box, (entity) -> { List<EndFishEntity> list = world.getEntitiesByClass(EndFishEntity.class, box, (entity) -> {

View file

@ -15,15 +15,15 @@ import net.minecraft.world.entity.ai.control.MoveControl;
import net.minecraft.world.entity.ai.goal.FollowTargetGoal; import net.minecraft.world.entity.ai.goal.FollowTargetGoal;
import net.minecraft.world.entity.ai.goal.Goal; import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.damage.DamageSource; import net.minecraft.world.entity.damage.DamageSource;
import net.minecraft.world.entity.data.DataTracker; import net.minecraft.world.entity.data.DataTracker;
import net.minecraft.world.entity.data.TrackedData; import net.minecraft.world.entity.data.TrackedData;
import net.minecraft.world.entity.data.TrackedDataHandlerRegistry; import net.minecraft.world.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.world.entity.effect.StatusEffects; import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.mob.SlimeEntity; import net.minecraft.world.entity.mob.SlimeEntity;
import net.minecraft.world.entity.passive.IronGolemEntity; import net.minecraft.world.entity.passive.IronGolemEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -35,9 +35,9 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.LocalDifficulty; import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import ru.betterend.interfaces.ISlime; import ru.betterend.interfaces.ISlime;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
@ -59,21 +59,20 @@ public class EndSlimeEntity extends SlimeEntity {
this.goalSelector.add(2, new FaceTowardTargetGoal()); this.goalSelector.add(2, new FaceTowardTargetGoal());
this.goalSelector.add(3, new RandomLookGoal()); this.goalSelector.add(3, new RandomLookGoal());
this.goalSelector.add(5, new MoveGoal()); this.goalSelector.add(5, new MoveGoal());
this.targetSelector.add(1, this.targetSelector.add(1, new FollowTargetGoal<Player>(this, Player.class, 10, true, false, (livingEntity) -> {
new FollowTargetGoal<PlayerEntity>(this, PlayerEntity.class, 10, true, false, (livingEntity) -> { return Math.abs(livingEntity.getY() - this.getY()) <= 4.0D;
return Math.abs(livingEntity.getY() - this.getY()) <= 4.0D; }));
}));
this.targetSelector.add(3, new FollowTargetGoal<IronGolemEntity>(this, IronGolemEntity.class, true)); this.targetSelector.add(3, new FollowTargetGoal<IronGolemEntity>(this, IronGolemEntity.class, true));
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 1.0D) return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 1.0D)
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 1.0D).add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0D) .add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.FOLLOW_RANGE, 16.0D)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.15D); .add(Attributes.MOVEMENT_SPEED, 0.15D);
} }
@Override @Override
public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, public EntityData initialize(ServerLevelAccessor world, LocalDifficulty difficulty, SpawnReason spawnReason,
EntityData entityData, CompoundTag entityTag) { EntityData entityData, CompoundTag entityTag) {
EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag); EntityData data = super.initialize(world, difficulty, spawnReason, entityData, entityTag);
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(getBlockPos())); EndBiome biome = EndBiomes.getFromBiome(world.getBiome(getBlockPos()));
@ -198,18 +197,18 @@ public class EndSlimeEntity extends SlimeEntity {
return this.dataTracker.get(VARIANT) == 0; return this.dataTracker.get(VARIANT) == 0;
} }
public static boolean canSpawn(EntityType<EndSlimeEntity> type, ServerWorldAccess world, SpawnReason spawnReason, public static boolean canSpawn(EntityType<EndSlimeEntity> type, ServerLevelAccessor world, SpawnReason spawnReason,
BlockPos pos, Random random) { BlockPos pos, Random random) {
return random.nextInt(16) == 0 || isPermanentBiome(world, pos) return random.nextInt(16) == 0 || isPermanentBiome(world, pos)
|| (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8)); || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
} }
private static boolean isPermanentBiome(ServerWorldAccess world, BlockPos pos) { private static boolean isPermanentBiome(ServerLevelAccessor world, BlockPos pos) {
Biome biome = world.getBiome(pos); Biome biome = world.getBiome(pos);
return EndBiomes.getFromBiome(biome) == EndBiomes.CHORUS_FOREST; return EndBiomes.getFromBiome(biome) == EndBiomes.CHORUS_FOREST;
} }
private static boolean notManyEntities(ServerWorldAccess world, BlockPos pos, int radius, int maxCount) { private static boolean notManyEntities(ServerLevelAccessor world, BlockPos pos, int radius, int maxCount) {
Box box = new Box(pos).expand(radius); Box box = new Box(pos).expand(radius);
List<EndSlimeEntity> list = world.getEntitiesByClass(EndSlimeEntity.class, box, (entity) -> { List<EndSlimeEntity> list = world.getEntitiesByClass(EndSlimeEntity.class, box, (entity) -> {
return true; return true;
@ -217,7 +216,7 @@ public class EndSlimeEntity extends SlimeEntity {
return list.size() <= maxCount; return list.size() <= maxCount;
} }
private static boolean isWaterNear(ServerWorldAccess world, BlockPos pos, int radius, int radius2) { private static boolean isWaterNear(ServerLevelAccessor world, BlockPos pos, int radius, int radius2) {
for (int x = pos.getX() - radius; x <= pos.getX() + radius; x++) { for (int x = pos.getX() - radius; x <= pos.getX() + radius; x++) {
POS.setX(x); POS.setX(x);
for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; z++) { for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; z++) {
@ -293,7 +292,7 @@ public class EndSlimeEntity extends SlimeEntity {
return EndSlimeEntity.this.getTarget() == null return EndSlimeEntity.this.getTarget() == null
&& (EndSlimeEntity.this.onGround || EndSlimeEntity.this.isTouchingWater() && (EndSlimeEntity.this.onGround || EndSlimeEntity.this.isTouchingWater()
|| EndSlimeEntity.this.isInLava() || EndSlimeEntity.this.isInLava()
|| EndSlimeEntity.this.hasStatusEffect(StatusEffects.LEVITATION)) || EndSlimeEntity.this.hasMobEffect(MobEffects.LEVITATION))
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl; && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
} }
@ -321,8 +320,7 @@ public class EndSlimeEntity extends SlimeEntity {
} else if (!livingEntity.isAlive()) { } else if (!livingEntity.isAlive()) {
return false; return false;
} else { } else {
return livingEntity instanceof PlayerEntity && ((PlayerEntity) livingEntity).abilities.invulnerable return livingEntity instanceof Player && ((Player) livingEntity).abilities.invulnerable ? false
? false
: EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl; : EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
} }
} }
@ -338,7 +336,7 @@ public class EndSlimeEntity extends SlimeEntity {
return false; return false;
} else if (!livingEntity.isAlive()) { } else if (!livingEntity.isAlive()) {
return false; return false;
} else if (livingEntity instanceof PlayerEntity && ((PlayerEntity) livingEntity).abilities.invulnerable) { } else if (livingEntity instanceof Player && ((Player) livingEntity).abilities.invulnerable) {
return false; return false;
} else { } else {
return --this.ticksLeft > 0; return --this.ticksLeft > 0;
@ -381,8 +379,8 @@ public class EndSlimeEntity extends SlimeEntity {
} else { } else {
this.state = MoveControl.State.WAIT; this.state = MoveControl.State.WAIT;
if (this.entity.isOnGround()) { if (this.entity.isOnGround()) {
this.entity.setMovementSpeed((float) (this.speed this.entity.setMovementSpeed(
* this.entity.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED))); (float) (this.speed * this.entity.getAttributeValue(Attributes.MOVEMENT_SPEED)));
if (this.ticksUntilJump-- <= 0) { if (this.ticksUntilJump-- <= 0) {
this.ticksUntilJump = EndSlimeEntity.this.getTicksUntilNextJump(); this.ticksUntilJump = EndSlimeEntity.this.getTicksUntilNextJump();
if (this.jumpOften) { if (this.jumpOften) {
@ -400,8 +398,8 @@ public class EndSlimeEntity extends SlimeEntity {
this.entity.setMovementSpeed(0.0F); this.entity.setMovementSpeed(0.0F);
} }
} else { } else {
this.entity.setMovementSpeed((float) (this.speed this.entity.setMovementSpeed(
* this.entity.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED))); (float) (this.speed * this.entity.getAttributeValue(Attributes.MOVEMENT_SPEED)));
} }
} }

View file

@ -14,17 +14,17 @@ import net.minecraft.world.entity.ai.goal.LookAtEntityGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.WanderAroundFarGoal; import net.minecraft.world.entity.ai.goal.WanderAroundFarGoal;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.damage.DamageSource; import net.minecraft.world.entity.damage.DamageSource;
import net.minecraft.world.entity.effect.StatusEffectInstance; import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.effect.StatusEffects; import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.mob.HostileEntity; import net.minecraft.world.entity.mob.HostileEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.betterend.registry.EndSounds; import ru.betterend.registry.EndSounds;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
@ -38,15 +38,15 @@ public class ShadowWalkerEntity extends HostileEntity {
protected void initGoals() { protected void initGoals() {
this.goalSelector.add(2, new AttackGoal(this, 1.0D, false)); this.goalSelector.add(2, new AttackGoal(this, 1.0D, false));
this.goalSelector.add(7, new WanderAroundFarGoal(this, 1.0D)); this.goalSelector.add(7, new WanderAroundFarGoal(this, 1.0D));
this.goalSelector.add(8, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F)); this.goalSelector.add(8, new LookAtEntityGoal(this, Player.class, 8.0F));
this.goalSelector.add(8, new LookAroundGoal(this)); this.goalSelector.add(8, new LookAroundGoal(this));
this.targetSelector.add(2, new FollowTargetGoal<PlayerEntity>(this, PlayerEntity.class, true)); this.targetSelector.add(2, new FollowTargetGoal<Player>(this, Player.class, true));
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return HostileEntity.createHostileAttributes().add(EntityAttributes.GENERIC_FOLLOW_RANGE, 35.0) return HostileEntity.createHostileAttributes().add(Attributes.FOLLOW_RANGE, 35.0)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.15).add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 4.5) .add(Attributes.MOVEMENT_SPEED, 0.15).add(Attributes.ATTACK_DAMAGE, 4.5).add(Attributes.ARMOR, 2.0)
.add(EntityAttributes.GENERIC_ARMOR, 2.0).add(EntityAttributes.ZOMBIE_SPAWN_REINFORCEMENTS); .add(Attributes.ZOMBIE_SPAWN_REINFORCEMENTS);
} }
@Override @Override
@ -94,14 +94,14 @@ public class ShadowWalkerEntity extends HostileEntity {
boolean attack = super.tryAttack(target); boolean attack = super.tryAttack(target);
if (attack && target instanceof LivingEntity) { if (attack && target instanceof LivingEntity) {
LivingEntity living = (LivingEntity) target; LivingEntity living = (LivingEntity) target;
if (!(living.hasStatusEffect(StatusEffects.BLINDNESS))) { if (!(living.hasMobEffect(MobEffects.BLINDNESS))) {
living.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 60)); living.addMobEffect(new MobEffectInstance(MobEffects.BLINDNESS, 60));
} }
} }
return attack; return attack;
} }
public static boolean canSpawn(EntityType<ShadowWalkerEntity> type, ServerWorldAccess world, public static boolean canSpawn(EntityType<ShadowWalkerEntity> type, ServerLevelAccessor world,
SpawnReason spawnReason, BlockPos pos, Random random) { SpawnReason spawnReason, BlockPos pos, Random random) {
if (HostileEntity.canSpawnInDark(type, world, spawnReason, pos, random)) { if (HostileEntity.canSpawnInDark(type, world, spawnReason, pos, random)) {
Box box = new Box(pos).expand(16); Box box = new Box(pos).expand(16);

View file

@ -24,7 +24,7 @@ import net.minecraft.world.entity.ai.pathing.BirdNavigation;
import net.minecraft.world.entity.ai.pathing.EntityNavigation; import net.minecraft.world.entity.ai.pathing.EntityNavigation;
import net.minecraft.world.entity.ai.pathing.PathNodeType; import net.minecraft.world.entity.ai.pathing.PathNodeType;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer; import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.entity.damage.DamageSource; import net.minecraft.world.entity.damage.DamageSource;
import net.minecraft.world.entity.mob.MobEntity; import net.minecraft.world.entity.mob.MobEntity;
import net.minecraft.world.entity.passive.AnimalEntity; import net.minecraft.world.entity.passive.AnimalEntity;
@ -41,9 +41,9 @@ import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.Heightmap.Type; import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
@ -68,9 +68,9 @@ public class SilkMothEntity extends AnimalEntity implements Flutterer {
} }
public static DefaultAttributeContainer.Builder createMobAttributes() { public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D) return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0D)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0D).add(EntityAttributes.GENERIC_FLYING_SPEED, 0.4D) .add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.FLYING_SPEED, 0.4D)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.1D); .add(Attributes.MOVEMENT_SPEED, 0.1D);
} }
public void setHive(Level world, BlockPos hive) { public void setHive(Level world, BlockPos hive) {
@ -92,7 +92,7 @@ public class SilkMothEntity extends AnimalEntity implements Flutterer {
hivePos = NbtHelper.toBlockPos(tag.getCompound("HivePos")); hivePos = NbtHelper.toBlockPos(tag.getCompound("HivePos"));
ResourceLocation worldID = new ResourceLocation(tag.getString("HiveWorld")); ResourceLocation worldID = new ResourceLocation(tag.getString("HiveWorld"));
try { try {
hiveWorld = world.getServer().getLevel(RegistryKey.of(Registry.DIMENSION, worldID)); hiveWorld = world.getServer().getLevel(ResourceKey.of(Registry.DIMENSION, worldID));
} catch (Exception e) { } catch (Exception e) {
BetterEnd.LOGGER.warning("Silk Moth Hive Level {} is missing!", worldID); BetterEnd.LOGGER.warning("Silk Moth Hive Level {} is missing!", worldID);
hivePos = null; hivePos = null;
@ -174,13 +174,13 @@ public class SilkMothEntity extends AnimalEntity implements Flutterer {
this.world.spawnEntity(drop); this.world.spawnEntity(drop);
} }
public static boolean canSpawn(EntityType<SilkMothEntity> type, ServerWorldAccess world, SpawnReason spawnReason, public static boolean canSpawn(EntityType<SilkMothEntity> type, ServerLevelAccessor world, SpawnReason spawnReason,
BlockPos pos, Random random) { BlockPos pos, Random random) {
int y = world.getChunk(pos).sampleHeightmap(Type.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15); int y = world.getChunk(pos).sampleHeightmap(Type.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15);
return y > 0 && pos.getY() >= y && notManyEntities(world, pos, 32, 1); return y > 0 && pos.getY() >= y && notManyEntities(world, pos, 32, 1);
} }
private static boolean notManyEntities(ServerWorldAccess world, BlockPos pos, int radius, int maxCount) { private static boolean notManyEntities(ServerLevelAccessor world, BlockPos pos, int radius, int maxCount) {
Box box = new Box(pos).expand(radius); Box box = new Box(pos).expand(radius);
List<SilkMothEntity> list = world.getEntitiesByClass(SilkMothEntity.class, box, (entity) -> true); List<SilkMothEntity> list = world.getEntitiesByClass(SilkMothEntity.class, box, (entity) -> true);
return list.size() <= maxCount; return list.size() <= maxCount;

View file

@ -5,7 +5,7 @@ import java.util.Map;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.minecraft.world.item.ItemConvertible; import net.minecraft.world.level.ItemLike;
import ru.betterend.blocks.HydraluxPetalColoredBlock; import ru.betterend.blocks.HydraluxPetalColoredBlock;
import ru.betterend.blocks.complex.ColoredMaterial; import ru.betterend.blocks.complex.ColoredMaterial;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -27,7 +27,7 @@ public class FlamboyantRefabricatedIntegration extends ModIntegration {
*/ */
Map<Integer, String> colors = Maps.newHashMap(); Map<Integer, String> colors = Maps.newHashMap();
Map<Integer, ItemConvertible> dyes = Maps.newHashMap(); Map<Integer, ItemLike> dyes = Maps.newHashMap();
/* /*
* for (Object val: values) { Integer color = (Integer) getFieldValue(fDyeColor, * for (Object val: values) { Integer color = (Integer) getFieldValue(fDyeColor,
* "signColor", val); String name = (String) getFieldValue(fDyeColor, "name", * "signColor", val); String name = (String) getFieldValue(fDyeColor, "name",
@ -56,7 +56,7 @@ public class FlamboyantRefabricatedIntegration extends ModIntegration {
new ColoredMaterial(HydraluxPetalColoredBlock::new, EndBlocks.HYDRALUX_PETAL_BLOCK, colors, dyes, true); new ColoredMaterial(HydraluxPetalColoredBlock::new, EndBlocks.HYDRALUX_PETAL_BLOCK, colors, dyes, true);
} }
private void addColor(String hex, String name, Map<Integer, String> colors, Map<Integer, ItemConvertible> dyes) { private void addColor(String hex, String name, Map<Integer, String> colors, Map<Integer, ItemLike> dyes) {
int color = MHelper.color(hex); int color = MHelper.color(hex);
colors.put(color, name); colors.put(color, name);
dyes.put(color, getItem(name + "_dye")); dyes.put(color, getItem(name + "_dye"));

View file

@ -13,15 +13,15 @@ import net.minecraft.world.item.Item;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.tags.Tag.Identified; import net.minecraft.tags.Tag.Named;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.data.BuiltinRegistries;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.world.features.EndFeature; import ru.betterend.world.features.EndFeature;
@ -54,8 +54,8 @@ public abstract class ModIntegration {
return getBlock(name).defaultBlockState(); return getBlock(name).defaultBlockState();
} }
public RegistryKey<Biome> getKey(String name) { public ResourceKey<Biome> getKey(String name) {
return RegistryKey.of(Registry.BIOME_KEY, getID(name)); return ResourceKey.of(Registry.BIOME_KEY, getID(name));
} }
public boolean modIsInstalled() { public boolean modIsInstalled() {
@ -196,13 +196,13 @@ public abstract class ModIntegration {
return null; return null;
} }
public Tag.Identified<Item> getItemTag(String name) { public Tag.Named<Item> getItemTag(String name) {
ResourceLocation id = getID(name); ResourceLocation id = getID(name);
Tag<Item> tag = ItemTags.getTagGroup().getTag(id); Tag<Item> tag = ItemTags.getTagGroup().getTag(id);
return tag == null ? (Identified<Item>) TagRegistry.item(id) : (Identified<Item>) tag; return tag == null ? (Identified<Item>) TagRegistry.item(id) : (Identified<Item>) tag;
} }
public Tag.Identified<Block> getBlockTag(String name) { public Tag.Named<Block> getBlockTag(String name) {
ResourceLocation id = getID(name); ResourceLocation id = getID(name);
Tag<Block> tag = BlockTags.getTagGroup().getTag(id); Tag<Block> tag = BlockTags.getTagGroup().getTag(id);
return tag == null ? (Identified<Block>) TagRegistry.block(id) : (Identified<Block>) tag; return tag == null ? (Identified<Block>) TagRegistry.block(id) : (Identified<Block>) tag;

View file

@ -12,10 +12,10 @@ public class NourishIntegration extends ModIntegration {
@Override @Override
public void register() { public void register() {
Tag.Identified<Item> fats = getItemTag("fats"); Tag.Named<Item> fats = getItemTag("fats");
Tag.Identified<Item> fruit = getItemTag("fruit"); Tag.Named<Item> fruit = getItemTag("fruit");
Tag.Identified<Item> protein = getItemTag("protein"); Tag.Named<Item> protein = getItemTag("protein");
Tag.Identified<Item> sweets = getItemTag("sweets"); Tag.Named<Item> sweets = getItemTag("sweets");
TagHelper.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED); TagHelper.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagHelper.addTag(fruit, EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED, EndItems.BLOSSOM_BERRY, TagHelper.addTag(fruit, EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED, EndItems.BLOSSOM_BERRY,

View file

@ -5,8 +5,8 @@ import java.util.stream.Collectors;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.collection.WeightedList; import net.minecraft.util.collection.WeightedList;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.data.BuiltinRegistries;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.integration.ModIntegration; import ru.betterend.integration.ModIntegration;
import ru.betterend.integration.byg.biomes.BYGBiomes; import ru.betterend.integration.byg.biomes.BYGBiomes;

View file

@ -3,8 +3,8 @@ package ru.betterend.integration.byg.biomes;
import java.util.List; import java.util.List;
import net.minecraft.world.entity.SpawnGroup; import net.minecraft.world.entity.SpawnGroup;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.biome.BiomeEffects; import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry; import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;

View file

@ -4,8 +4,8 @@ import java.util.List;
import net.minecraft.world.entity.SpawnGroup; import net.minecraft.world.entity.SpawnGroup;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.biome.BiomeEffects; import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry; import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import net.minecraft.world.gen.GenerationStep.Feature; import net.minecraft.world.gen.GenerationStep.Feature;

View file

@ -6,16 +6,16 @@ import java.util.function.Supplier;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.entity.SpawnGroup; import net.minecraft.world.entity.SpawnGroup;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.data.BuiltinRegistries;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.biome.BiomeEffects; import net.minecraft.world.biome.BiomeEffects;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry; import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import net.minecraft.world.gen.GenerationStep.Feature; import net.minecraft.world.gen.GenerationStep.Feature;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredFeatures; import net.minecraft.world.level.levelgen.feature.ConfiguredFeatures;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.integration.byg.features.BYGFeatures; import ru.betterend.integration.byg.features.BYGFeatures;
@ -33,7 +33,7 @@ public class OldBulbisGardens extends EndBiome {
BiomeEffects effects = biome.getEffects(); BiomeEffects effects = biome.getEffects();
Block ivis = Integrations.BYG.getBlock("ivis_phylium"); Block ivis = Integrations.BYG.getBlock("ivis_phylium");
Block origin = biome.getGenerationSettings().getSurfaceConfig().getTopMaterial().getBlock(); Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens").setFogColor(215, 132, 207).setFogDensity(1.8F) BiomeDefinition def = new BiomeDefinition("old_bulbis_gardens").setFogColor(215, 132, 207).setFogDensity(1.8F)
.setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155) .setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin) .setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin)

View file

@ -7,11 +7,11 @@ import com.google.common.base.Function;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
@ -21,8 +21,8 @@ import ru.betterend.world.features.DefaultFeature;
public class BigEtherTreeFeature extends DefaultFeature { public class BigEtherTreeFeature extends DefaultFeature {
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
DefaultFeatureConfig config) { NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND)) if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
return false; return false;
@ -77,7 +77,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
return true; return true;
} }
// private void makeLeavesSphere(StructureWorldAccess world, BlockPos pos, // private void makeLeavesSphere(WorldGenLevel world, BlockPos pos,
// BlockState leaves, Function<BlockState, Boolean> ignore) { // BlockState leaves, Function<BlockState, Boolean> ignore) {
// //
// } // }

View file

@ -10,13 +10,13 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
@ -35,8 +35,8 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH; private static final List<Vector3f> BRANCH;
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
DefaultFeatureConfig config) { NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND)) if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
return false; return false;

View file

@ -10,13 +10,13 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
@ -35,8 +35,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH; private static final List<Vector3f> BRANCH;
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
DefaultFeatureConfig config) { NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND)) if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
return false; return false;

View file

@ -9,13 +9,13 @@ import com.google.common.collect.Lists;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.client.util.math.Vector3f; import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.integration.Integrations; import ru.betterend.integration.Integrations;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
@ -36,8 +36,8 @@ public class OldBulbisTreeFeature extends DefaultFeature {
private static final List<Vector3f> SIDE; private static final List<Vector3f> SIDE;
@Override @Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
DefaultFeatureConfig config) { NoneFeatureConfiguration config) {
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND)) if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
return false; return false;
if (!world.getBlockState(pos.down(4)).getBlock().isIn(EndTags.GEN_TERRAIN)) if (!world.getBlockState(pos.down(4)).getBlock().isIn(EndTags.GEN_TERRAIN))
@ -82,11 +82,9 @@ public class OldBulbisTreeFeature extends DefaultFeature {
Vector3f vec = spline.get(spline.size() - 1); Vector3f vec = spline.get(spline.size() - 1);
float radius = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.35F; float radius = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.35F;
bigSphere(world, pos.offset(vec.getX(), vec.getY(), vec.getZ()), radius, cap, glow, wood, replacement, bigSphere(world, pos.offset(vec.x(), vec.y(), vec.z()), radius, cap, glow, wood, replacement, random);
random);
vec = SplineHelper.getPos(spline, 0.3F); vec = SplineHelper.getPos(spline, 0.3F);
makeRoots(world, pos.offset(vec.getX(), vec.getY(), vec.getZ()), size * 0.4F + 5, random, wood, makeRoots(world, pos.offset(vec.x(), vec.y(), vec.z()), size * 0.4F + 5, random, wood, replacement);
replacement);
sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch); sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch);
} }
@ -102,19 +100,19 @@ public class OldBulbisTreeFeature extends DefaultFeature {
return true; return true;
} }
private void bigSphere(StructureWorldAccess world, BlockPos pos, float radius, BlockState cap, BlockState glow, private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow,
BlockState wood, Function<BlockState, Boolean> replacement, Random random) { BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong()); OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap); SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap);
SDF sphereInner = new SDFSphere().setRadius(radius * 0.53F).setBlock(Blocks.AIR); SDF sphereInner = new SDFSphere().setRadius(radius * 0.53F).setBlock(Blocks.AIR);
sphereInner = new SDFDisplacement().setFunction((vec) -> { sphereInner = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1); return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1);
}).setSource(sphereInner); }).setSource(sphereInner);
SDF sphereGlow = new SDFSphere().setRadius(radius * 0.6F).setBlock(glow); SDF sphereGlow = new SDFSphere().setRadius(radius * 0.6F).setBlock(glow);
sphereGlow = new SDFDisplacement().setFunction((vec) -> { sphereGlow = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.getX() * 0.1, vec.getY() * 0.1, vec.getZ() * 0.1) * 2F; return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1) * 2F;
}).setSource(sphereGlow); }).setSource(sphereGlow);
sphereGlow = new SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner); sphereGlow = new SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner);
@ -150,7 +148,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
sphere.fillArea(world, pos, new Box(pos.up((int) offsetY)).expand(radius * 1.3F)); sphere.fillArea(world, pos, new Box(pos.up((int) offsetY)).expand(radius * 1.3F));
} }
private void makeRoots(StructureWorldAccess world, BlockPos pos, float radius, Random random, BlockState wood, private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood,
Function<BlockState, Boolean> replacement) { Function<BlockState, Boolean> replacement) {
int count = (int) (radius * 1.5F); int count = (int) (radius * 1.5F);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {

View file

@ -17,7 +17,7 @@ import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.api.widgets.Widgets; import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry; import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.widget.Widget; import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.Minecraft;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -90,7 +90,7 @@ public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDi
slot.setZ(getZ() + 50); slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2); slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta); slot.render(matrices, mouseX, mouseY, delta);
MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, text.asOrderedText(), bounds.x + 25, Minecraft.getInstance().textRenderer.drawWithShadow(matrices, text.asOrderedText(), bounds.x + 25,
bounds.y + 8, -1); bounds.y + 8, -1);
} }
}; };

View file

@ -1,7 +1,7 @@
package ru.betterend.interfaces; package ru.betterend.interfaces;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
public interface IBiomeArray { public interface IBiomeArray {
public void setBiome(Biome biome, BlockPos pos); public void setBiome(Biome biome, BlockPos pos);

View file

@ -2,9 +2,9 @@ package ru.betterend.interfaces;
import java.util.List; import java.util.List;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.biome.Biome; import net.minecraft.world.level.biome.Biome;
public interface IBiomeList { public interface IBiomeList {
public List<RegistryKey<Biome>> getBiomes(); public List<ResourceKey<Biome>> getBiomes();
} }

View file

@ -2,7 +2,7 @@ package ru.betterend.item;
import net.minecraft.advancement.criterion.Criteria; import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemUsage; import net.minecraft.world.item.ItemUsage;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -29,7 +29,7 @@ public class DrinkItem extends PatternedItem {
} }
@Override @Override
public TypedActionResult<ItemStack> use(Level world, PlayerEntity user, Hand hand) { public TypedActionResult<ItemStack> use(Level world, Player user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand); return ItemUsage.consumeHeldItem(world, user, hand);
} }
@ -41,12 +41,12 @@ public class DrinkItem extends PatternedItem {
serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this)); serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
} }
if (user instanceof PlayerEntity && !((PlayerEntity) user).abilities.creativeMode) { if (user instanceof Player && !((Player) user).abilities.creativeMode) {
stack.decrement(1); stack.decrement(1);
} }
if (!world.isClientSide) { if (!world.isClientSide) {
user.clearStatusEffects(); user.clearMobEffects();
} }
return stack.isEmpty() ? new ItemStack(Items.GLASS_BOTTLE) : stack; return stack.isEmpty() ? new ItemStack(Items.GLASS_BOTTLE) : stack;

View file

@ -7,7 +7,7 @@ import ru.betterend.registry.EndItems;
public class EnchantedPetalItem extends PatternedItem { public class EnchantedPetalItem extends PatternedItem {
public EnchantedPetalItem() { public EnchantedPetalItem() {
super(EndItems.makeItemSettings().rarity(Rarity.RARE).maxCount(16)); super(EndItems.makeItemSettings().rarity(Rarity.RARE).stacksTo(16));
} }
@Override @Override

View file

@ -6,9 +6,9 @@ import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.attribute.EntityAttribute; import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.attribute.EntityAttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.attribute.EntityAttributes; import net.minecraft.world.entity.attribute.Attributes;
import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -30,20 +30,20 @@ public class EndArmorItem extends ArmorItem implements Patterned {
return; return;
} }
Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers = accessor.be_getAttributeModifiers(); Multimap<Attribute, AttributeModifier> attributeModifiers = accessor.be_getAttributeModifiers();
// In case Mojang or anyone else decided to fix this // In case Mojang or anyone else decided to fix this
if (attributeModifiers.keys().contains(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE)) { if (attributeModifiers.keys().contains(Attributes.KNOCKBACK_RESISTANCE)) {
return; return;
} }
UUID uuid = accessor.be_getModifiers()[slot.getEntitySlotId()]; UUID uuid = accessor.be_getModifiers()[slot.getEntitySlotId()];
// Rebuild attributeModifiers to include knockback resistance // Rebuild attributeModifiers to include knockback resistance
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder(); ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder();
builder.putAll(attributeModifiers); builder.putAll(attributeModifiers);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uuid, builder.put(Attributes.KNOCKBACK_RESISTANCE, new AttributeModifier(uuid, "Armor knockback resistance",
"Armor knockback resistance", knockbackResistance, EntityAttributeModifier.Operation.ADDITION)); knockbackResistance, AttributeModifier.Operation.ADDITION));
accessor.be_setAttributeModifiers(builder.build()); accessor.be_setAttributeModifiers(builder.build());
} }

View file

@ -5,6 +5,6 @@ import ru.betterend.registry.EndItems;
public class EternalCrystalItem extends PatternedItem { public class EternalCrystalItem extends PatternedItem {
public EternalCrystalItem() { public EternalCrystalItem() {
super(EndItems.makeItemSettings().maxCount(16).rarity(Rarity.EPIC)); super(EndItems.makeItemSettings().stacksTo(16).rarity(Rarity.EPIC));
} }
} }

View file

@ -3,7 +3,7 @@ package ru.betterend.item;
import java.util.List; import java.util.List;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.world.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -26,11 +26,11 @@ public class GuideBookItem extends PatternedItem {
} }
public GuideBookItem() { public GuideBookItem() {
super(EndItems.makeItemSettings().maxCount(1)); super(EndItems.makeItemSettings().stacksTo(1));
} }
@Override @Override
public TypedActionResult<ItemStack> use(Level world, PlayerEntity user, Hand hand) { public TypedActionResult<ItemStack> use(Level world, Player user, Hand hand) {
if (!world.isClientSide && user instanceof ServerPlayer) { if (!world.isClientSide && user instanceof ServerPlayer) {
PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID); PatchouliAPI.get().openBookGUI((ServerPlayer) user, BOOK_ID);
return TypedActionResult.success(user.getStackInHand(hand)); return TypedActionResult.success(user.getStackInHand(hand));

View file

@ -1,12 +1,13 @@
package ru.betterend.item; package ru.betterend.item;
import net.minecraft.world.item.MusicDiscItem; import net.minecraft.world.item.Item;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.RecordItem;
import ru.betterend.patterns.Patterned; import ru.betterend.patterns.Patterned;
import ru.betterend.patterns.Patterns; import ru.betterend.patterns.Patterns;
public class PatternedDiscItem extends MusicDiscItem implements Patterned { public class PatternedDiscItem extends RecordItem implements Patterned {
public PatternedDiscItem(int comparatorOutput, SoundEvent sound, Properties settings) { public PatternedDiscItem(int comparatorOutput, SoundEvent sound, Item.Properties settings) {
super(comparatorOutput, sound, settings); super(comparatorOutput, sound, settings);
} }

View file

@ -7,7 +7,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.sound.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.LazyLoadedValue; import net.minecraft.util.LazyLoadedValue;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;

View file

@ -9,18 +9,19 @@ import com.google.common.collect.Sets;
import io.netty.util.internal.ThreadLocalRandom; import io.netty.util.internal.ThreadLocalRandom;
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool; import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DiggerItem;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.attribute.EntityAttribute;
import net.minecraft.world.entity.attribute.EntityAttributeModifier;
import net.minecraft.world.entity.attribute.EntityAttributes;
import net.minecraft.world.entity.player.PlayerEntity;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.MiningToolItem;
import net.minecraft.world.item.Tier; import net.minecraft.world.item.Tier;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -30,72 +31,70 @@ import ru.betterend.patterns.Patterned;
import ru.betterend.patterns.Patterns; import ru.betterend.patterns.Patterns;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
public class EndHammerItem extends MiningToolItem implements DynamicAttributeTool, Patterned { public class EndHammerItem extends DiggerItem implements DynamicAttributeTool, Patterned {
public final static UUID ATTACK_KNOCKBACK_MODIFIER_ID = Mth.randomUuid(ThreadLocalRandom.current()); public final static UUID ATTACK_KNOCKBACK_MODIFIER_ID = Mth.createInsecureUUID(ThreadLocalRandom.current());
private final Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers; private final Multimap<Attribute, AttributeModifier> attributeModifiers;
public EndHammerItem(Tier material, float attackDamage, float attackSpeed, double knockback, Properties settings) { public EndHammerItem(Tier material, float attackDamage, float attackSpeed, double knockback, Properties settings) {
super(attackDamage, attackSpeed, material, Sets.newHashSet(), settings); super(attackDamage, attackSpeed, material, Sets.newHashSet(), settings);
Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder(); Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder();
builder.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier",
new EntityAttributeModifier(ATTACK_DAMAGE_MODIFIER_ID, "Weapon modifier", attackDamage + material.getAttackDamageBonus(), AttributeModifier.Operation.ADDITION));
attackDamage + material.getAttackDamage(), EntityAttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier",
builder.put(EntityAttributes.GENERIC_ATTACK_SPEED, new EntityAttributeModifier(ATTACK_SPEED_MODIFIER_ID, attackSpeed, AttributeModifier.Operation.ADDITION));
"Weapon modifier", attackSpeed, EntityAttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_KNOCKBACK, new AttributeModifier(ATTACK_KNOCKBACK_MODIFIER_ID, "Weapon modifier",
builder.put(EntityAttributes.GENERIC_ATTACK_KNOCKBACK, new EntityAttributeModifier(ATTACK_KNOCKBACK_MODIFIER_ID, knockback, AttributeModifier.Operation.ADDITION));
"Weapon modifier", knockback, EntityAttributeModifier.Operation.ADDITION));
this.attributeModifiers = builder.build(); this.attributeModifiers = builder.build();
} }
@Override @Override
public boolean canMine(BlockState state, Level world, BlockPos pos, PlayerEntity miner) { public boolean canAttackBlock(BlockState state, Level world, BlockPos pos, Player miner) {
return state.getMaterial().equals(Material.STONE) || state.getMaterial().equals(Material.GLASS) return state.getMaterial().equals(Material.STONE) || state.getMaterial().equals(Material.GLASS)
|| state.is(Blocks.DIAMOND_BLOCK) || state.is(Blocks.EMERALD_BLOCK) || state.is(Blocks.LAPIS_BLOCK) || state.is(Blocks.DIAMOND_BLOCK) || state.is(Blocks.EMERALD_BLOCK) || state.is(Blocks.LAPIS_BLOCK)
|| state.is(Blocks.REDSTONE_BLOCK); || state.is(Blocks.REDSTONE_BLOCK);
} }
@Override @Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
stack.damage(1, attacker, ((entity) -> { stack.hurtAndBreak(1, attacker, (entity -> {
entity.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND); entity.broadcastBreakEvent(EquipmentSlot.MAINHAND);
})); }));
return true; return true;
} }
@Override @Override
public boolean postMine(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) {
if (state.getHardness(world, pos) != 0.0F) { if (state.getDestroySpeed(world, pos) != 0.0F) {
stack.damage(1, miner, ((entity) -> { stack.hurtAndBreak(1, miner, (entity -> {
entity.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND); entity.broadcastBreakEvent(EquipmentSlot.MAINHAND);
})); }));
} }
return true; return true;
} }
@Override @Override
public float getDestroySpeed(ItemStack stack, BlockState state) { public float getDestroySpeed(ItemStack stack, BlockState state) {
if (state.getMaterial().equals(Material.GLASS)) { if (state.getMaterial().equals(Material.GLASS)) {
return this.getMaterial().getDestroySpeed() * 2.0F; return getTier().getSpeed() * 2.0F;
} }
if (isCorrectToolForDrops(state)) { if (isCorrectToolForDrops(state)) {
float mult = 1.0F; float mult = 1.0F;
if (state.is(Blocks.DIAMOND_BLOCK) || state.is(Blocks.EMERALD_BLOCK) || state.is(Blocks.LAPIS_BLOCK) if (state.is(Blocks.DIAMOND_BLOCK) || state.is(Blocks.EMERALD_BLOCK) || state.is(Blocks.LAPIS_BLOCK)
|| state.is(Blocks.REDSTONE_BLOCK)) { || state.is(Blocks.REDSTONE_BLOCK)) {
mult = this.getMaterial().getDestroySpeed(); mult = getTier().getSpeed();
} else { } else {
mult = this.getMaterial().getDestroySpeed() / 2.0F; mult = getTier().getSpeed() / 2.0F;
} }
return mult > 1.0F ? mult : 1.0F; return Math.max(mult, 1.0F);
} }
return 1.0F; return 1.0F;
} }
@Override @Override
public float getDestroySpeed(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) { public float getMiningSpeedMultiplier(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
if (tag.equals(EndTags.HAMMERS)) { if (tag.equals(EndTags.HAMMERS)) {
return this.getDestroySpeed(stack, state); return this.getDestroySpeed(stack, state);
} }
@ -135,8 +134,8 @@ public class EndHammerItem extends MiningToolItem implements DynamicAttributeToo
} }
@Override @Override
public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot) { public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
return slot == EquipmentSlot.MAINHAND ? this.attributeModifiers : super.getAttributeModifiers(slot); return slot == EquipmentSlot.MAINHAND ? this.attributeModifiers : super.getDefaultAttributeModifiers(slot);
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show more