More compiler fixes

This commit is contained in:
Frank 2021-12-07 14:53:33 +01:00
parent 6097311ca6
commit dca9f84ccf
23 changed files with 110 additions and 106 deletions

View file

@ -15,8 +15,7 @@ public class DragonTreeSaplingBlock extends PottableFeatureSapling {
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.DRAGON_TREE.getFeature();
}

View file

@ -1,6 +1,9 @@
package ru.betterend.blocks;
import java.util.Map;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -29,8 +32,6 @@ import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import java.util.Map;
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, RenderLayerProvider {
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
@ -88,7 +89,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
if (state.getValue(WATERLOGGED)) {
world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
}
return state;
}

View file

@ -11,8 +11,7 @@ import ru.betterend.registry.EndFeatures;
public class HelixTreeSaplingBlock extends PottableFeatureSapling {
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.HELIX_TREE.getFeature();
}

View file

@ -1,5 +1,9 @@
package ru.betterend.blocks;
import java.util.Random;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -34,15 +38,12 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.util.BlocksHelper;
import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
import ru.betterend.registry.EndBlocks;
import java.util.Random;
@SuppressWarnings("deprecation")
public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlock, LiquidBlockContainer, SimpleWaterloggedBlock {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
@ -90,7 +91,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
return Blocks.WATER.defaultBlockState();
}
else if (state.getValue(WATERLOGGED) && facing == Direction.UP && neighborState.is(Blocks.WATER)) {
world.getBlockTicks().scheduleTick(pos, this, 20);
//TODO: 1.18 see if it still ticks
world./*getBlockTicks().*/scheduleTick(pos, this, 20);
}
return state;
}
@ -118,7 +120,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
BlockPos up = pos.above();
if (world.getBlockState(up).is(Blocks.WATER)) {
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.VENT_BUBBLE_COLUMN);
world.getBlockTicks().scheduleTick(up, EndBlocks.VENT_BUBBLE_COLUMN, 5);
//TODO: 1.18 see if it still ticks
world./*getBlockTicks().*/scheduleTick(up, EndBlocks.VENT_BUBBLE_COLUMN, 5);
}
}

View file

@ -15,8 +15,7 @@ public class LacugroveSaplingBlock extends PottableFeatureSapling {
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.LACUGROVE.getFeature();
}

View file

@ -15,8 +15,7 @@ public class LucerniaSaplingBlock extends PottableFeatureSapling {
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.LUCERNIA.getFeature();
}

View file

@ -1,21 +1,30 @@
package ru.betterend.blocks;
import java.util.Optional;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import java.util.Random;
public class LumecornSeedBlock extends EndPlantWithAgeBlock {
@Override
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
EndFeatures.LUMECORN.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
((Feature<NoneFeatureConfiguration>) (EndFeatures.LUMECORN.getFeature())).place(new FeaturePlaceContext<>(
Optional.empty(),
world,
null,
random,
pos,
(NoneFeatureConfiguration) null));
}
@Override

View file

@ -15,8 +15,7 @@ public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
protected Feature<?> getFeature(BlockState state) {
return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
}

View file

@ -1,7 +1,12 @@
package ru.betterend.blocks;
import java.util.EnumMap;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -46,10 +51,6 @@ import ru.betterend.blocks.EndBlockProperties.CactusBottom;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndBlocks;
import java.util.EnumMap;
import java.util.List;
import java.util.Random;
@SuppressWarnings("deprecation")
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, RenderLayerProvider, PottablePlant {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
@ -115,9 +116,10 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
world.getBlockTicks().scheduleTick(pos, this, 2);
//TODO: 1.18 Check if this still workd
world./*getBlockTicks().*/scheduleTick(pos, this, 2);
if (state.getValue(WATERLOGGED)) {
world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
}
Direction dir = state.getValue(FACING);
BlockState downState = world.getBlockState(pos.relative(dir.getOpposite()));

View file

@ -4,20 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class PythadendronSaplingBlock extends PottableFeatureSapling {
public PythadendronSaplingBlock() {
super();
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
return EndFeatures.PYTHADENDRON_TREE.getFeature();
super((state)->EndFeatures.PYTHADENDRON_TREE.getFeature());
}
@Override

View file

@ -1,5 +1,8 @@
package ru.betterend.blocks;
import java.util.Optional;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.BlockGetter;
@ -7,7 +10,9 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -16,8 +21,6 @@ import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
import java.util.Random;
public class SmallAmaranitaBlock extends EndPlantBlock {
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12);
@ -30,8 +33,8 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlockPos bigPos = growBig(world, pos);
if (bigPos != null) {
if (EndFeatures.GIGANTIC_AMARANITA.getFeature()
.place(new FeaturePlaceContext<>(world, null, random, bigPos, null))) {
if (((Feature<NoneFeatureConfiguration>)EndFeatures.GIGANTIC_AMARANITA.getFeature())
.place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, bigPos, null))) {
replaceMushroom(world, bigPos);
replaceMushroom(world, bigPos.south());
replaceMushroom(world, bigPos.east());
@ -39,7 +42,7 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
}
return;
}
EndFeatures.LARGE_AMARANITA.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
((Feature<NoneFeatureConfiguration>)EndFeatures.LARGE_AMARANITA.getFeature()).place( new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos, null));
}
@Override

View file

@ -1,7 +1,13 @@
package ru.betterend.blocks;
import java.util.EnumMap;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -20,7 +26,9 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -35,10 +43,6 @@ import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndFeatures;
import java.util.EnumMap;
import java.util.List;
import java.util.Random;
public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLayerProvider, BonemealableBlock, PottablePlant {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
@ -101,7 +105,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
EndFeatures.JELLYSHROOM.getFeature().place(new FeaturePlaceContext<>(world, null, random, pos, null));
((Feature<NoneFeatureConfiguration>)EndFeatures.JELLYSHROOM.getFeature()).place(new FeaturePlaceContext<>(Optional.empty(), world, null, random, pos, null));
}
@Override

View file

@ -4,20 +4,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class TenaneaSaplingBlock extends PottableFeatureSapling {
public TenaneaSaplingBlock() {
super();
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
return EndFeatures.TENANEA.getFeature();
super((state)->EndFeatures.TENANEA.getFeature());
}
@Override

View file

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.client.render.BCLRenderLayer;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
@ -12,13 +11,7 @@ import ru.betterend.registry.EndFeatures;
public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling {
public UmbrellaTreeSaplingBlock() {
super();
}
@Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() {
return EndFeatures.UMBRELLA_TREE.getFeature();
super((state)-> EndFeatures.UMBRELLA_TREE.getFeature());
}
@Override

View file

@ -1,5 +1,8 @@
package ru.betterend.blocks;
import java.util.Optional;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -33,9 +36,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.util.BlocksHelper;
import ru.betterend.registry.EndBlocks;
import java.util.Optional;
import java.util.Random;
public class VentBubbleColumnBlock extends Block implements BucketPickup, LiquidBlockContainer {
public VentBubbleColumnBlock() {
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).noOcclusion().noCollission().noDrops());
@ -76,7 +76,8 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
BlockPos up = pos.above();
if (world.getBlockState(up).is(Blocks.WATER)) {
BlocksHelper.setWithoutUpdate(world, up, this);
world.getBlockTicks().scheduleTick(up, this, 5);
//TODO: 1.18 check if this ticks
world./*getBlockTicks().*/scheduleTick(up, this, 5);
}
}
return state;

View file

@ -1,14 +1,18 @@
package ru.betterend.blocks.basis;
import java.util.function.Function;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.interfaces.PottablePlant;
public abstract class PottableFeatureSapling extends FeatureSaplingBlock implements PottablePlant {
public PottableFeatureSapling() {
super();
public PottableFeatureSapling(Function<BlockState, Feature<?>> featureSupplier) {
super(featureSupplier);
}
public PottableFeatureSapling(int light) {
super(light);
public PottableFeatureSapling(int light, Function<BlockState, Feature<?>> featureSupplier) {
super(light, featureSupplier);
}
}

View file

@ -1,7 +1,12 @@
package ru.betterend.blocks.entities;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.fabricmc.fabric.api.registry.FuelRegistry;
@ -41,10 +46,6 @@ import ru.betterend.client.gui.EndStoneSmelterScreenHandler;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndBlockEntities;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeHolder, StackedContentsCompatible {
private static final int[] TOP_SLOTS = new int[] {0, 1};
@ -429,8 +430,9 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
}
@Override
public CompoundTag save(CompoundTag tag) {
super.save(tag);
public void saveAdditional(CompoundTag tag) {
super.saveAdditional(tag);
tag.putShort("BurnTime", (short) burnTime);
tag.putShort("FuelTime", (short) fuelTime);
tag.putShort("SmeltTime", (short) smeltTime);
@ -439,8 +441,6 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
CompoundTag usedRecipes = new CompoundTag();
recipesUsed.forEach((identifier, integer) -> usedRecipes.putInt(identifier.toString(), integer));
tag.put("RecipesUsed", usedRecipes);
return tag;
}
public boolean canPlaceItem(int slot, ItemStack stack) {

View file

@ -35,11 +35,11 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
}
@Override
public CompoundTag save(CompoundTag tag) {
public void saveAdditional(CompoundTag tag) {
if (hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
}
return super.save(tag);
super.saveAdditional(tag);
}
@Override

View file

@ -40,11 +40,11 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
}
@Override
public CompoundTag save(CompoundTag tag) {
public void saveAdditional(CompoundTag tag) {
if (hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
}
return super.save(tag);
super.saveAdditional(tag);
}
@Override

View file

@ -150,7 +150,7 @@ public class MetalMaterial {
final int level = material.getLevel();
rawOre = hasOre ? EndItems.registerEndItem(name + "_raw", new ModelProviderItem(itemSettings)) : null;
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseOreBlock(rawOre, 1, 3, 1)) : null;
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseOreBlock(()->rawOre, 1, 3, 1)) : null;
alloyingOre = hasOre ? TagAPI.makeItemTag(BetterEnd.MOD_ID, name + "_alloying") : null;
if (hasOre) {
TagAPI.addTag(alloyingOre, ore, rawOre);

View file

@ -1,5 +1,8 @@
package ru.betterend.mixin.common;
import java.util.Optional;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag;
@ -23,8 +26,6 @@ import ru.bclib.util.StructureHelper;
import ru.betterend.BetterEnd;
import ru.betterend.world.generator.GeneratorOptions;
import java.util.Random;
@Mixin(EndPodiumFeature.class)
public class EndPodiumFeatureMixin {
private static BlockPos be_portalPosition;
@ -56,7 +57,8 @@ public class EndPodiumFeatureMixin {
private FeaturePlaceContext<NoneFeatureConfiguration> be_setPosOnGround(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext) {
WorldGenLevel world = featurePlaceContext.level();
BlockPos pos = be_updatePortalPos(world);
return new FeaturePlaceContext<>(
return new FeaturePlaceContext<NoneFeatureConfiguration>(
Optional.empty(),
world,
featurePlaceContext.chunkGenerator(),
featurePlaceContext.random(),

View file

@ -1,6 +1,10 @@
package ru.betterend.util;
import java.util.Set;
import java.util.stream.IntStream;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -19,9 +23,6 @@ import ru.betterend.blocks.BlueVineBlock;
import ru.betterend.blocks.basis.FurBlock;
import ru.betterend.registry.EndBlocks;
import java.util.Set;
import java.util.stream.IntStream;
public class BlockFixer {
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
@ -75,7 +76,7 @@ public class BlockFixer {
for (Direction dir : BlocksHelper.HORIZONTAL) {
if (level.isEmptyBlock(POS.relative(dir))) {
try {
level.getLiquidTicks().scheduleTick(POS, state.getFluidState().getType(), 0);
level.scheduleTick(POS, state.getFluidState().getType(), 0);
}
catch (Exception e) {}
break;