More compiler fixes
This commit is contained in:
parent
cfa765437c
commit
4f053c161a
20 changed files with 84 additions and 67 deletions
|
@ -94,7 +94,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
|||
if (exitPos == null) return;
|
||||
if (entity instanceof ServerPlayer && ((ServerPlayer) entity).isCreative()) {
|
||||
((ServerPlayer) entity).teleportTo(destination, exitPos.getX() + 0.5, exitPos.getY(),
|
||||
exitPos.getZ() + 0.5, entity.yRot, entity.xRot);
|
||||
exitPos.getZ() + 0.5, entity.getYRot(), entity.getXRot());
|
||||
} else {
|
||||
((TeleportingEntity) entity).be_setExitPos(exitPos);
|
||||
Optional<Entity> teleported = Optional.ofNullable(entity.changeDimension(destination));
|
||||
|
@ -114,7 +114,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
|
|||
|
||||
private BlockPos findExitPos(ServerLevel currentWorld, ServerLevel targetWorld, BlockPos currentPos, Entity entity) {
|
||||
if (targetWorld == null) return null;
|
||||
Registry<DimensionType> registry = targetWorld.registryAccess().dimensionTypes();
|
||||
Registry<DimensionType> registry = targetWorld.registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
|
||||
ResourceLocation targetWorldId = targetWorld.dimension().location();
|
||||
ResourceLocation currentWorldId = currentWorld.dimension().location();
|
||||
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
|
||||
|
|
|
@ -79,7 +79,7 @@ public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null) {
|
||||
if (tool.getItem().is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool.is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
int fortune = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
|
||||
|
|
|
@ -108,8 +108,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
return new BlockEntityHydrothermalVent();
|
||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new BlockEntityHydrothermalVent(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,8 +44,8 @@ public class InfusionPedestal extends PedestalBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
return new InfusionPedestalEntity();
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new InfusionPedestalEntity(blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class NeedlegrassBlock extends EndPlantBlock {
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class SilkMothHiveBlock extends BaseBlock {
|
|||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (hand == InteractionHand.MAIN_HAND) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (stack.getItem().is(FabricToolTags.SHEARS) && state.getValue(FULLNESS) == 3) {
|
||||
if (stack.is(FabricToolTags.SHEARS) && state.getValue(FULLNESS) == 3) {
|
||||
BlocksHelper.setWithUpdate(world, pos, state.setValue(FULLNESS, 0));
|
||||
Direction dir = state.getValue(FACING);
|
||||
double px = pos.getX() + dir.getStepX() + 0.5;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderT
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -9,9 +10,12 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
@ -38,9 +42,9 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
|||
}
|
||||
|
||||
@Override
|
||||
public Fluid takeLiquid(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
public ItemStack pickupBlock(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
|
||||
return Fluids.WATER;
|
||||
return new ItemStack(Items.WATER_BUCKET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,4 +124,11 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
|||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getSource(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<SoundEvent> getPickupSound() {
|
||||
return Fluids.WATER.getPickupSound();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else if (dropChance < 1 || MHelper.RANDOM.nextInt(dropChance) == 0) {
|
||||
|
|
|
@ -355,8 +355,8 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
return new PedestalBlockEntity();
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new PedestalBlockEntity(blockPos, blockState);
|
||||
}
|
||||
|
||||
public boolean hasUniqueEntity() {
|
||||
|
@ -440,7 +440,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
|
|||
|
||||
@Nullable
|
||||
protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> blockEntityType, BlockEntityType<E> blockEntityType2, BlockEntityTicker<? super E> blockEntityTicker) {
|
||||
return blockEntityType2 == blockEntityType ? blockEntityTicker : null;
|
||||
return blockEntityType2 == blockEntityType ? (BlockEntityTicker<A>) blockEntityTicker : null;
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.betterend.blocks.entities;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
import ru.betterend.rituals.InfusionRitual;
|
||||
|
||||
|
@ -10,13 +11,21 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
|
|||
|
||||
private InfusionRitual linkedRitual;
|
||||
|
||||
public InfusionPedestalEntity() {
|
||||
super(EndBlockEntities.INFUSION_PEDESTAL);
|
||||
public InfusionPedestalEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(EndBlockEntities.INFUSION_PEDESTAL, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLevel(Level world){
|
||||
super.setLevel(world);
|
||||
if (hasRitual()) {
|
||||
linkedRitual.setLocation(world, this.getBlockPos());
|
||||
} else {
|
||||
linkRitual(new InfusionRitual(this, world, this.getBlockPos()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLevelAndPosition(Level world, BlockPos pos) {
|
||||
super.setLevelAndPosition(world, pos);
|
||||
if (hasRitual()) {
|
||||
linkedRitual.setLocation(world, pos);
|
||||
} else {
|
||||
|
@ -37,11 +46,11 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
protected void tick(Level tickLevel, BlockPos tickPos, BlockState tickState){
|
||||
if (hasRitual()) {
|
||||
linkedRitual.tick();
|
||||
}
|
||||
super.tick();
|
||||
super.tick(tickLevel, tickPos, tickState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
|
|||
private final int maxAge = 314;
|
||||
private int age;
|
||||
|
||||
public PedestalBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
public PedestalBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState) {
|
||||
super(EndBlockEntities.PEDESTAL, blockPos, blockState);
|
||||
}
|
||||
|
||||
|
@ -132,12 +132,16 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
|
|||
}
|
||||
}
|
||||
|
||||
public static void tick(Level tickLevel, BlockPos tickPos, BlockState tickState, PedestalBlockEntity blockEntity) {
|
||||
if (!blockEntity.isEmpty()) {
|
||||
blockEntity.age++;
|
||||
if (blockEntity.age > blockEntity.maxAge) {
|
||||
blockEntity.age = 0;
|
||||
protected void tick(Level tickLevel, BlockPos tickPos, BlockState tickState){
|
||||
if (!this.isEmpty()) {
|
||||
this.age++;
|
||||
if (this.age > this.maxAge) {
|
||||
this.age = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tick(Level tickLevel, BlockPos tickPos, BlockState tickState, PedestalBlockEntity blockEntity) {
|
||||
blockEntity.tick(tickLevel, tickPos, tickState);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue