Fixed Compiletime issue

This commit is contained in:
Frank 2022-12-09 16:01:06 +01:00
parent fd2559e038
commit a8856fff15
94 changed files with 562 additions and 574 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
@ -38,7 +39,7 @@ public class BoluxMushroomBlock extends EndPlantBlock {
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -8,6 +8,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -43,7 +44,7 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements AddMine
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -8,7 +8,6 @@ import org.betterx.betterend.registry.EndItems;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
@ -34,7 +33,7 @@ public class BulbVineBlock extends BaseVineBlock {
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -12,6 +12,7 @@ import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
@ -68,7 +69,7 @@ public class CrystalMossCoverBlock extends MultifaceBlock implements Bonemealabl
@Override
public boolean isValidBonemealTarget(
BlockGetter blockGetter,
LevelReader blockGetter,
BlockPos blockPos,
BlockState blockState,
boolean bl

View file

@ -114,7 +114,7 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock implements AddMineable
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -3,7 +3,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.blocks.basis.PedestalBlock;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@ -19,7 +19,7 @@ public class EndPedestal extends PedestalBlock {
@Override
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", BetterEnd.MOD_ID);

View file

@ -17,6 +17,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
@ -151,7 +152,7 @@ public class EndPortalBlock extends NetherPortalBlock implements RenderLayerProv
) {
if (targetWorld == null) return null;
Registry<DimensionType> registry = targetWorld.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
.registryOrThrow(Registries.DIMENSION_TYPE);
ResourceLocation targetWorldId = targetWorld.dimension().location();
ResourceLocation currentWorldId = currentWorld.dimension().location();
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();

View file

@ -8,7 +8,7 @@ import org.betterx.betterend.rituals.EternalRitual;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -60,7 +60,7 @@ public class EternalPedestal extends PedestalBlock {
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, false).setValue(HAS_LIGHT, false));
} else {
ItemStack itemStack = pedestal.getItem(0);
ResourceLocation id = Registry.ITEM.getKey(itemStack.getItem());
ResourceLocation id = BuiltInRegistries.ITEM.getKey(itemStack.getItem());
if (EndPortals.isAvailableItem(id)) {
world.setBlockAndUpdate(pos, updatedState.setValue(ACTIVATED, true).setValue(HAS_LIGHT, true));
if (pedestal.hasRitual()) {

View file

@ -19,14 +19,13 @@ import org.betterx.betterend.interfaces.PottableTerrain;
import org.betterx.betterend.registry.EndBlocks;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -58,6 +57,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.joml.Vector3f;
import java.io.File;
import java.util.List;
@ -191,7 +191,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
}
private void processBlock(Block[] target, Block block, String path, Map<String, Integer> idMap) {
ResourceLocation location = Registry.BLOCK.getKey(block);
ResourceLocation location = BuiltInRegistries.BLOCK.getKey(block);
if (idMap.containsKey(location.getPath())) {
target[idMap.get(location.getPath())] = block;
} else {
@ -315,7 +315,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
}
final int compareID = i + 1;
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
ResourceLocation modelPath = BuiltInRegistries.BLOCK.getKey(plants[i]);
ResourceLocation objSource = new ResourceLocation(
modelPath.getNamespace(),
"models/block/" + modelPath.getPath() + "_potted.json"
@ -329,7 +329,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.add();
continue;
} else if (plants[i] instanceof SaplingBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%modid%", loc.getNamespace());
@ -343,7 +343,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.add();
continue;
} else if (plants[i] instanceof PottableLeavesBlock) {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%leaves%", loc.getPath().contains("lucernia") ? loc.getPath() + "_1" : loc.getPath());
@ -396,7 +396,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
} else {
ResourceLocation loc = Registry.BLOCK.getKey(plants[i]);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(plants[i]);
modelPath = new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath() + "_potted");
Map<String, String> textures = Maps.newHashMap();
textures.put("%modid%", loc.getNamespace());
@ -418,7 +418,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
ResourceLocation soilLoc = BetterEnd.makeID("flower_pot_soil_" + i);
if (!modelCache.containsKey(soilLoc)) {
String texture = Registry.BLOCK.getKey(soils[i]).getPath() + "_top";
String texture = BuiltInRegistries.BLOCK.getKey(soils[i]).getPath() + "_top";
if (texture.contains("rutiscus")) {
texture += "_1";
}

View file

@ -62,7 +62,7 @@ public class HydraluxBlock extends UnderwaterPlantBlock implements AddMineableSh
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -59,7 +59,7 @@ public class LargeAmaranitaBlock extends EndPlantBlock implements AddMineableShe
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -2,7 +2,7 @@ package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PedestalBlock;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@ -17,7 +17,7 @@ public class PedestalVanilla extends PedestalBlock {
@Override
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath().replace("_block", "");
return new HashMap<String, String>() {
private static final long serialVersionUID = 1L;

View file

@ -8,6 +8,7 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
@ -40,7 +41,7 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements AddMine
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -92,7 +92,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return state.getValue(FACING) == Direction.UP && world.getBlockState(pos.below())
.is(CommonBlockTags.END_STONES);
}

View file

@ -12,8 +12,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import net.fabricmc.api.EnvType;
@ -57,7 +57,7 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements CustomColorPro
}
@Override
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}

View file

@ -16,7 +16,7 @@ import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionHand;
@ -433,7 +433,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
}
protected Map<String, String> createTexturesMap() {
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(parent);
String name = blockId.getPath();
Map<String, String> textures = Maps.newHashMap();
textures.put("%mod%", blockId.getNamespace());