Compiling version (some features are currently disabled and need a rewrite)
This commit is contained in:
parent
b1f4173ce4
commit
f8bcba4d3a
48 changed files with 488 additions and 506 deletions
|
@ -8,6 +8,7 @@ import org.betterx.bclib.api.v2.levelgen.LevelGenUtil;
|
|||
import org.betterx.bclib.config.Configs;
|
||||
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
@ -42,7 +43,7 @@ final class BiomeSourcePatch extends ForcedLevelPatch {
|
|||
|
||||
final CompoundTag worldGenSettings = root.getCompound("Data").getCompound("WorldGenSettings");
|
||||
final CompoundTag dimensions = worldGenSettings.getCompound("dimensions");
|
||||
final RegistryAccess registryAccess = RegistryAccess.builtinCopy();
|
||||
final RegistryAccess registryAccess = BuiltinRegistries.createAccess();
|
||||
final RegistryOps<Tag> registryOps = RegistryOps.create(NbtOps.INSTANCE, registryAccess);
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@ public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceW
|
|||
protected long currentSeed;
|
||||
protected int maxHeight;
|
||||
|
||||
private static List<Holder<Biome>> preInit(Registry<Biome> biomeRegistry, List<Holder<Biome>> biomes) {
|
||||
private static List<Holder<Biome>> preInit(
|
||||
Registry<Biome> biomeRegistry,
|
||||
List<Holder<Biome>> biomes
|
||||
) {
|
||||
biomes = biomes.stream().sorted(Comparator.comparing(holder -> holder.unwrapKey()
|
||||
.get()
|
||||
.location()
|
||||
|
@ -108,8 +111,9 @@ public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceW
|
|||
return biomeRegistry.stream()
|
||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||
|
||||
.map(biome -> biomeRegistry.getOrCreateHolderOrThrow(biomeRegistry.getResourceKey(biome)
|
||||
.get()))
|
||||
.map(biome -> (Holder<Biome>) biomeRegistry.getOrCreateHolderOrThrow(
|
||||
biomeRegistry.getResourceKey(biome).get())
|
||||
)
|
||||
.filter(biome -> {
|
||||
ResourceLocation location = biome.unwrapKey().orElseThrow().location();
|
||||
final String strLocation = location.toString();
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.world.level.dimension.LevelStem;
|
|||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.RandomState;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
|
||||
RecordCodecBuilder<BCLChunkGenerator, Holder<NoiseGeneratorSettings>> settingsCodec = NoiseGeneratorSettings.CODEC
|
||||
.fieldOf("settings")
|
||||
.forGetter((BCLChunkGenerator generator) -> generator.settings);
|
||||
.forGetter((BCLChunkGenerator generator) -> generator.generatorSettings());
|
||||
|
||||
|
||||
return NoiseBasedChunkGenerator
|
||||
|
@ -157,12 +157,12 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
}
|
||||
|
||||
@Override
|
||||
public WorldGenSettings enforceGeneratorInWorldGenSettings(
|
||||
public WorldDimensions enforceGeneratorInWorldGenSettings(
|
||||
RegistryAccess access,
|
||||
ResourceKey<LevelStem> dimensionKey,
|
||||
ResourceKey<DimensionType> dimensionTypeKey,
|
||||
ChunkGenerator loadedChunkGenerator,
|
||||
WorldGenSettings settings
|
||||
WorldDimensions worldDims
|
||||
) {
|
||||
BCLib.LOGGER.info("Enforcing Correct Generator for " + dimensionKey.location().toString() + ".");
|
||||
|
||||
|
@ -195,7 +195,7 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
dimensionKey,
|
||||
dimensionTypeKey,
|
||||
access,
|
||||
settings,
|
||||
worldDims,
|
||||
referenceGenerator
|
||||
);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagLoader;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
@ -71,9 +72,9 @@ public class LevelGenEvents {
|
|||
|
||||
private static Optional<Holder<WorldPreset>> adaptWorldPresetSettings(
|
||||
Optional<Holder<WorldPreset>> currentPreset,
|
||||
WorldGenSettings worldGenSettings
|
||||
WorldDimensions worldDims
|
||||
) {
|
||||
LevelStem endStem = worldGenSettings.dimensions().get(LevelStem.END);
|
||||
LevelStem endStem = worldDims.dimensions().get(LevelStem.END);
|
||||
|
||||
//We probably loaded a Datapack for the End
|
||||
if (!(endStem.generator().getBiomeSource() instanceof BCLibEndBiomeSource)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.resources.ResourceKey;
|
|||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
|
||||
|
@ -64,11 +64,11 @@ public class LevelGenUtil {
|
|||
}
|
||||
|
||||
|
||||
public static WorldGenSettings replaceGenerator(
|
||||
public static WorldDimensions replaceGenerator(
|
||||
ResourceKey<LevelStem> dimensionKey,
|
||||
ResourceKey<DimensionType> dimensionTypeKey,
|
||||
RegistryAccess registryAccess,
|
||||
WorldGenSettings worldGenSettings,
|
||||
WorldDimensions worldDimensions,
|
||||
ChunkGenerator generator
|
||||
) {
|
||||
Registry<DimensionType> dimensionTypeRegistry = registryAccess.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
|
||||
|
@ -76,15 +76,10 @@ public class LevelGenUtil {
|
|||
dimensionKey,
|
||||
dimensionTypeKey,
|
||||
dimensionTypeRegistry,
|
||||
worldGenSettings.dimensions(),
|
||||
worldDimensions.dimensions(),
|
||||
generator
|
||||
);
|
||||
return new WorldGenSettings(
|
||||
worldGenSettings.seed(),
|
||||
worldGenSettings.generateStructures(),
|
||||
worldGenSettings.generateBonusChest(),
|
||||
newDimensions
|
||||
);
|
||||
return new WorldDimensions(newDimensions);
|
||||
}
|
||||
|
||||
public static Registry<LevelStem> withDimension(
|
||||
|
@ -98,7 +93,7 @@ public class LevelGenUtil {
|
|||
LevelStem levelStem = inputDimensions.get(dimensionKey);
|
||||
Holder<DimensionType> dimensionType = levelStem == null
|
||||
? dimensionTypeRegistry.getOrCreateHolderOrThrow(dimensionTypeKey)
|
||||
: levelStem.typeHolder();
|
||||
: levelStem.type();
|
||||
return withDimension(dimensionKey, inputDimensions, new LevelStem(dimensionType, generator));
|
||||
}
|
||||
|
||||
|
@ -109,8 +104,7 @@ public class LevelGenUtil {
|
|||
) {
|
||||
MappedRegistry<LevelStem> writableRegistry = new MappedRegistry<>(
|
||||
Registry.LEVEL_STEM_REGISTRY,
|
||||
Lifecycle.experimental(),
|
||||
null
|
||||
Lifecycle.experimental()
|
||||
);
|
||||
writableRegistry.register(
|
||||
dimensionKey,
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BCLBiomeRegistry {
|
|||
);
|
||||
public static Registry<BCLBiome> BUILTIN_BCL_BIOMES = new MappedRegistry<>(
|
||||
BCL_BIOMES_REGISTRY,
|
||||
Lifecycle.stable(), null
|
||||
Lifecycle.stable()
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.betterx.bclib.BCLib;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
|
@ -102,7 +104,7 @@ public class StructureNBT {
|
|||
CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
|
||||
|
||||
StructureTemplate template = new StructureTemplate();
|
||||
template.load(nbttagcompound);
|
||||
template.load(HolderLookup.forRegistry(Registry.BLOCK), nbttagcompound);
|
||||
|
||||
return template;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.betterx.bclib.api.v2.levelgen.structures;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
|
@ -117,7 +119,11 @@ public class StructureWorld {
|
|||
ListTag map2 = tag.getList("states", 10);
|
||||
BlockState[] states = new BlockState[map2.size()];
|
||||
for (int i = 0; i < states.length; i++) {
|
||||
states[i] = NbtUtils.readBlockState((CompoundTag) map2.get(i));
|
||||
states[i] = NbtUtils.readBlockState(
|
||||
//TODO: 1.19.3 This appears to be used on a level registry, not the global one?
|
||||
HolderLookup.forRegistry(Registry.BLOCK),
|
||||
(CompoundTag) map2.get(i)
|
||||
);
|
||||
}
|
||||
|
||||
map.forEach((element) -> {
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.client.resources.model.BlockModelRotation;
|
|||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.ButtonBlock;
|
||||
|
@ -30,7 +31,14 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
|
|||
private final Block parent;
|
||||
|
||||
protected BaseButtonBlock(Block parent, Properties properties, boolean sensitive) {
|
||||
super(sensitive, properties.noCollission());
|
||||
this(parent, properties, 30, sensitive);
|
||||
}
|
||||
|
||||
protected BaseButtonBlock(Block parent, Properties properties, int ticksToStayPressed, boolean sensitive) {
|
||||
super(
|
||||
properties.noCollission(), ticksToStayPressed, sensitive,
|
||||
SoundEvents.STONE_BUTTON_CLICK_OFF, SoundEvents.STONE_BUTTON_CLICK_ON
|
||||
);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.client.resources.model.BlockModelRotation;
|
|||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
@ -42,7 +43,7 @@ public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, Blo
|
|||
}
|
||||
|
||||
public BaseDoorBlock(BlockBehaviour.Properties properties) {
|
||||
super(properties);
|
||||
super(properties, SoundEvents.WOODEN_DOOR_CLOSE, SoundEvents.WOODEN_DOOR_OPEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.client.renderer.block.model.BlockModel;
|
|||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.FenceGateBlock;
|
||||
|
@ -28,7 +29,7 @@ public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider
|
|||
private final Block parent;
|
||||
|
||||
public BaseGateBlock(Block source) {
|
||||
super(Properties.copy(source).noOcclusion());
|
||||
super(Properties.copy(source).noOcclusion(), SoundEvents.FENCE_GATE_CLOSE, SoundEvents.FENCE_GATE_OPEN);
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.client.renderer.block.model.BlockModel;
|
|||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.PressurePlateBlock;
|
||||
|
@ -28,7 +29,10 @@ public class BasePressurePlateBlock extends PressurePlateBlock implements BlockM
|
|||
private final Block parent;
|
||||
|
||||
public BasePressurePlateBlock(Sensitivity rule, Block source) {
|
||||
super(rule, Properties.copy(source).noCollission().noOcclusion().strength(0.5F));
|
||||
super(
|
||||
rule, Properties.copy(source).noCollission().noOcclusion().strength(0.5F),
|
||||
SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_ON
|
||||
);
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.renderer.block.model.BlockModel;
|
|||
import net.minecraft.client.resources.model.BlockModelRotation;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.TrapDoorBlock;
|
||||
|
@ -31,7 +32,7 @@ public class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvi
|
|||
}
|
||||
|
||||
public BaseTrapdoorBlock(BlockBehaviour.Properties properties) {
|
||||
super(properties);
|
||||
super(properties, SoundEvents.WOODEN_TRAPDOOR_CLOSE, SoundEvents.WOODEN_TRAPDOOR_OPEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.client.renderer.block.model.BlockModel;
|
|||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.WeightedPressurePlateBlock;
|
||||
|
@ -31,10 +32,11 @@ public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implement
|
|||
super(
|
||||
15,
|
||||
Properties.copy(source)
|
||||
.noCollission()
|
||||
.noOcclusion()
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(0.5F)
|
||||
.noCollission()
|
||||
.noOcclusion()
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(0.5F),
|
||||
SoundEvents.METAL_PRESSURE_PLATE_CLICK_OFF, SoundEvents.METAL_PRESSURE_PLATE_CLICK_ON
|
||||
);
|
||||
this.parent = source;
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
createWorldScreen
|
||||
.worldGenSettingsComponent
|
||||
.settings()
|
||||
.worldGenSettings()
|
||||
.selectedDimensions()
|
||||
.dimensions()
|
||||
)
|
||||
)));
|
||||
|
@ -269,11 +269,11 @@ public class WorldSetupScreen extends LayoutScreen {
|
|||
ChunkGenerator chunkGenerator
|
||||
) {
|
||||
createWorldScreen.worldGenSettingsComponent.updateSettings(
|
||||
(registryAccess, worldGenSettings) -> LevelGenUtil.replaceGenerator(
|
||||
(registryAccess, worldDimensions) -> LevelGenUtil.replaceGenerator(
|
||||
dimensionKey,
|
||||
dimensionTypeKey,
|
||||
registryAccess,
|
||||
worldGenSettings,
|
||||
worldDimensions,
|
||||
chunkGenerator
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import org.betterx.bclib.api.v2.ModIntegrationAPI;
|
||||
import org.betterx.bclib.client.render.EmissiveTextureInfo;
|
||||
import org.betterx.bclib.interfaces.BlockModelProvider;
|
||||
import org.betterx.bclib.interfaces.ItemModelProvider;
|
||||
import org.betterx.bclib.models.RecordItemModelProvider;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.block.BlockModelShaper;
|
||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
|
@ -21,12 +17,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomModelBakery {
|
||||
private final Map<ResourceLocation, UnbakedModel> models = Maps.newConcurrentMap();
|
||||
|
@ -114,43 +106,44 @@ public class CustomModelBakery {
|
|||
BlockModel model = provider.getItemModel(modelLocation);
|
||||
models.put(modelLocation, model);
|
||||
}
|
||||
|
||||
public static void loadEmissiveModels(Map<ResourceLocation, UnbakedModel> unbakedCache) {
|
||||
if (!ModIntegrationAPI.hasCanvas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<ResourceLocation, UnbakedModel> cacheCopy = new HashMap<>(unbakedCache);
|
||||
Set<Pair<String, String>> strings = Sets.newConcurrentHashSet();
|
||||
Registry.BLOCK.keySet().forEach(blockID -> {
|
||||
Block block = Registry.BLOCK.get(blockID);
|
||||
ImmutableList<BlockState> states = block.getStateDefinition().getPossibleStates();
|
||||
boolean addBlock = false;
|
||||
|
||||
for (BlockState state : states) {
|
||||
ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, state);
|
||||
UnbakedModel model = cacheCopy.get(stateID);
|
||||
if (model == null) {
|
||||
continue;
|
||||
}
|
||||
Collection<Material> materials = model.getMaterials(cacheCopy::get, strings);
|
||||
if (materials == null) {
|
||||
continue;
|
||||
}
|
||||
for (Material material : materials) {
|
||||
if (EmissiveTextureInfo.isEmissiveTexture(material.texture())) {
|
||||
addBlock = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (addBlock) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addBlock) {
|
||||
EmissiveTextureInfo.addBlock(blockID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//TODO: 1.19.3 Handled differently now
|
||||
// public static void loadEmissiveModels(Map<ResourceLocation, UnbakedModel> unbakedCache) {
|
||||
// if (!ModIntegrationAPI.hasCanvas()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Map<ResourceLocation, UnbakedModel> cacheCopy = new HashMap<>(unbakedCache);
|
||||
// Set<Pair<String, String>> strings = Sets.newConcurrentHashSet();
|
||||
// Registry.BLOCK.keySet().forEach(blockID -> {
|
||||
// Block block = Registry.BLOCK.get(blockID);
|
||||
// ImmutableList<BlockState> states = block.getStateDefinition().getPossibleStates();
|
||||
// boolean addBlock = false;
|
||||
//
|
||||
// for (BlockState state : states) {
|
||||
// ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, state);
|
||||
// UnbakedModel model = cacheCopy.get(stateID);
|
||||
// if (model == null) {
|
||||
// continue;
|
||||
// }
|
||||
// Collection<Material> materials = model.getMaterials(cacheCopy::get, strings);
|
||||
// if (materials == null) {
|
||||
// continue;
|
||||
// }
|
||||
// for (Material material : materials) {
|
||||
// if (EmissiveTextureInfo.isEmissiveTexture(material.texture())) {
|
||||
// addBlock = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (addBlock) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (addBlock) {
|
||||
// EmissiveTextureInfo.addBlock(blockID);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import org.betterx.bclib.BCLib;
|
|||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
|
@ -86,17 +85,13 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getMaterials(
|
||||
Function<ResourceLocation, UnbakedModel> function,
|
||||
Set<Pair<String, String>> set
|
||||
) {
|
||||
return materials;
|
||||
public void resolveParents(Function<ResourceLocation, UnbakedModel> function) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(
|
||||
ModelBakery modelBakery,
|
||||
ModelBaker modelBakery,
|
||||
Function<Material, TextureAtlasSprite> textureGetter,
|
||||
ModelState modelState,
|
||||
ResourceLocation resourceLocation
|
||||
|
|
|
@ -16,8 +16,7 @@ public interface NumericProvider {
|
|||
BCLib.makeID("worldgen/numeric_provider"));
|
||||
Registry<Codec<? extends NumericProvider>> NUMERIC_PROVIDER = new MappedRegistry<>(
|
||||
NUMERIC_PROVIDER_REGISTRY,
|
||||
Lifecycle.experimental(),
|
||||
null
|
||||
Lifecycle.experimental()
|
||||
);
|
||||
Codec<NumericProvider> CODEC = NUMERIC_PROVIDER.byNameCodec()
|
||||
.dispatch(NumericProvider::pcodec, Function.identity());
|
||||
|
|
|
@ -3,11 +3,11 @@ package org.betterx.bclib.items.boat;
|
|||
import org.betterx.bclib.BCLib;
|
||||
|
||||
import net.minecraft.client.model.BoatModel;
|
||||
import net.minecraft.client.model.ChestBoatModel;
|
||||
import net.minecraft.client.model.geom.ModelLayerLocation;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BoatItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
|
@ -64,8 +64,8 @@ public final class BoatTypeOverride {
|
|||
|
||||
public void createBoatModels(EntityRendererProvider.Context context) {
|
||||
if (boatModel == null) {
|
||||
boatModel = new BoatModel(context.bakeLayer(boatModelName), false);
|
||||
chestBoatModel = new BoatModel(context.bakeLayer(chestBoatModelName), true);
|
||||
boatModel = new BoatModel(context.bakeLayer(boatModelName));
|
||||
chestBoatModel = new ChestBoatModel(context.bakeLayer(chestBoatModelName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public final class BoatTypeOverride {
|
|||
}
|
||||
|
||||
public BoatItem createItem(boolean hasChest) {
|
||||
return createItem(hasChest, new Item.Properties().stacksTo(1).tab(CreativeModeTab.TAB_TRANSPORTATION));
|
||||
return createItem(hasChest, new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
public BoatItem createItem(boolean hasChest, Item.Properties itemSettings) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.betterx.bclib.mixin.client;
|
||||
|
||||
import org.betterx.bclib.api.v2.ModIntegrationAPI;
|
||||
import org.betterx.bclib.client.models.CustomModelBakery;
|
||||
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
|
@ -35,7 +34,8 @@ public abstract class ModelBakeryMixin {
|
|||
) {
|
||||
//CustomModelBakery.setModelsLoaded(false);
|
||||
if (ModIntegrationAPI.hasCanvas()) {
|
||||
CustomModelBakery.loadEmissiveModels(unbakedCache);
|
||||
//TODO:1.19.3 this needs to change
|
||||
//CustomModelBakery.loadEmissiveModels(unbakedCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,114 +1,97 @@
|
|||
package org.betterx.bclib.mixin.client;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.client.render.EmissiveTextureInfo;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
|
||||
import net.fabricmc.fabric.impl.client.texture.FabricSprite;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(TextureAtlas.class)
|
||||
public class TextureAtlasMixin {
|
||||
private static final int EMISSIVE_ALPHA = 254 << 24;
|
||||
private boolean bclib_modifyAtlas;
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void bclib_onAtlasInit(ResourceLocation resourceLocation, CallbackInfo info) {
|
||||
boolean hasOptifine = FabricLoader.getInstance().isModLoaded("optifabric");
|
||||
bclib_modifyAtlas = !hasOptifine && resourceLocation.toString().equals("minecraft:textures/atlas/blocks.png");
|
||||
if (bclib_modifyAtlas) {
|
||||
EmissiveTextureInfo.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "load(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$Info;IIIII)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;", at = @At("HEAD"), cancellable = true)
|
||||
private void bclib_loadSprite(
|
||||
ResourceManager resourceManager,
|
||||
TextureAtlasSprite.Info spriteInfo,
|
||||
int atlasWidth,
|
||||
int atlasHeight,
|
||||
int maxLevel,
|
||||
int posX,
|
||||
int posY,
|
||||
CallbackInfoReturnable<TextureAtlasSprite> info
|
||||
) {
|
||||
if (!bclib_modifyAtlas) {
|
||||
return;
|
||||
}
|
||||
|
||||
ResourceLocation location = spriteInfo.name();
|
||||
if (!location.getPath().startsWith("block")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ResourceLocation emissiveLocation = new ResourceLocation(
|
||||
location.getNamespace(),
|
||||
"textures/" + location.getPath() + "_e.png"
|
||||
);
|
||||
Optional<Resource> emissiveRes = resourceManager.getResource(emissiveLocation);
|
||||
if (emissiveRes.isPresent()) {
|
||||
NativeImage sprite = null;
|
||||
NativeImage emission = null;
|
||||
try {
|
||||
ResourceLocation spriteLocation = new ResourceLocation(
|
||||
location.getNamespace(),
|
||||
"textures/" + location.getPath() + ".png"
|
||||
);
|
||||
Resource resource = resourceManager.getResource(spriteLocation).orElse(null);
|
||||
sprite = NativeImage.read(resource.open());
|
||||
|
||||
resource = emissiveRes.get();
|
||||
emission = NativeImage.read(resource.open());
|
||||
} catch (IOException e) {
|
||||
BCLib.LOGGER.warning(e.getMessage());
|
||||
}
|
||||
if (sprite != null && emission != null) {
|
||||
int width = Math.min(sprite.getWidth(), emission.getWidth());
|
||||
int height = Math.min(sprite.getHeight(), emission.getHeight());
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
int argb = emission.getPixelRGBA(x, y);
|
||||
int alpha = (argb >> 24) & 255;
|
||||
if (alpha > 127) {
|
||||
int r = (argb >> 16) & 255;
|
||||
int g = (argb >> 8) & 255;
|
||||
int b = argb & 255;
|
||||
if (r > 0 || g > 0 || b > 0) {
|
||||
argb = (argb & 0x00FFFFFF) | EMISSIVE_ALPHA;
|
||||
sprite.setPixelRGBA(x, y, argb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextureAtlas self = (TextureAtlas) (Object) this;
|
||||
FabricSprite result = new FabricSprite(
|
||||
self,
|
||||
spriteInfo,
|
||||
maxLevel,
|
||||
atlasWidth,
|
||||
atlasHeight,
|
||||
posX,
|
||||
posY,
|
||||
sprite
|
||||
);
|
||||
EmissiveTextureInfo.addTexture(location);
|
||||
info.setReturnValue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO: 1.19.3 How were FabricSprites replaced?
|
||||
// @Inject(method = "<init>*", at = @At("TAIL"))
|
||||
// private void bclib_onAtlasInit(ResourceLocation resourceLocation, CallbackInfo info) {
|
||||
// boolean hasOptifine = FabricLoader.getInstance().isModLoaded("optifabric");
|
||||
// bclib_modifyAtlas = !hasOptifine && resourceLocation.toString().equals("minecraft:textures/atlas/blocks.png");
|
||||
// if (bclib_modifyAtlas) {
|
||||
// EmissiveTextureInfo.clear();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Inject(method = "load(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$Info;IIIII)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;", at = @At("HEAD"), cancellable = true)
|
||||
// private void bclib_loadSprite(
|
||||
// ResourceManager resourceManager,
|
||||
// TextureAtlasSprite.Info spriteInfo,
|
||||
// int atlasWidth,
|
||||
// int atlasHeight,
|
||||
// int maxLevel,
|
||||
// int posX,
|
||||
// int posY,
|
||||
// CallbackInfoReturnable<TextureAtlasSprite> info
|
||||
// ) {
|
||||
// if (!bclib_modifyAtlas) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ResourceLocation location = spriteInfo.name();
|
||||
// if (!location.getPath().startsWith("block")) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ResourceLocation emissiveLocation = new ResourceLocation(
|
||||
// location.getNamespace(),
|
||||
// "textures/" + location.getPath() + "_e.png"
|
||||
// );
|
||||
// Optional<Resource> emissiveRes = resourceManager.getResource(emissiveLocation);
|
||||
// if (emissiveRes.isPresent()) {
|
||||
// NativeImage sprite = null;
|
||||
// NativeImage emission = null;
|
||||
// try {
|
||||
// ResourceLocation spriteLocation = new ResourceLocation(
|
||||
// location.getNamespace(),
|
||||
// "textures/" + location.getPath() + ".png"
|
||||
// );
|
||||
// Resource resource = resourceManager.getResource(spriteLocation).orElse(null);
|
||||
// sprite = NativeImage.read(resource.open());
|
||||
//
|
||||
// resource = emissiveRes.get();
|
||||
// emission = NativeImage.read(resource.open());
|
||||
// } catch (IOException e) {
|
||||
// BCLib.LOGGER.warning(e.getMessage());
|
||||
// }
|
||||
// if (sprite != null && emission != null) {
|
||||
// int width = Math.min(sprite.getWidth(), emission.getWidth());
|
||||
// int height = Math.min(sprite.getHeight(), emission.getHeight());
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// int argb = emission.getPixelRGBA(x, y);
|
||||
// int alpha = (argb >> 24) & 255;
|
||||
// if (alpha > 127) {
|
||||
// int r = (argb >> 16) & 255;
|
||||
// int g = (argb >> 8) & 255;
|
||||
// int b = argb & 255;
|
||||
// if (r > 0 || g > 0 || b > 0) {
|
||||
// argb = (argb & 0x00FFFFFF) | EMISSIVE_ALPHA;
|
||||
// sprite.setPixelRGBA(x, y, argb);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// TextureAtlas self = (TextureAtlas) (Object) this;
|
||||
// FabricSprite result = new FabricSprite(
|
||||
// self,
|
||||
// spriteInfo,
|
||||
// maxLevel,
|
||||
// atlasWidth,
|
||||
// atlasHeight,
|
||||
// posX,
|
||||
// posY,
|
||||
// sprite
|
||||
// );
|
||||
// EmissiveTextureInfo.addTexture(location);
|
||||
// info.setReturnValue(result);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,48 +1,35 @@
|
|||
package org.betterx.bclib.mixin.common;
|
||||
|
||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeData;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(RegistryAccess.class)
|
||||
public interface RegistryAccessMixin {
|
||||
|
||||
@ModifyArg(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;"))
|
||||
private static Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> together_addRegistry(
|
||||
Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> supplier
|
||||
) {
|
||||
return () -> {
|
||||
ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder = ImmutableMap.builder();
|
||||
//Make sure this gets added before WORLD_PRESETS
|
||||
put(builder, BCLBiomeRegistry.BCL_BIOMES_REGISTRY, BiomeData.CODEC);
|
||||
|
||||
Map<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> res = supplier.get();
|
||||
builder.putAll(res);
|
||||
|
||||
return builder.build();
|
||||
};
|
||||
}
|
||||
|
||||
@Shadow
|
||||
static <E> void put(
|
||||
ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder,
|
||||
ResourceKey<? extends Registry<E>> resourceKey,
|
||||
Codec<E> codec
|
||||
) {
|
||||
throw new RuntimeException("Shadowed Call");
|
||||
}
|
||||
//TODO: 1.19.3 Will probably be a new custom data provider now
|
||||
// @ModifyArg(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;"))
|
||||
// private static Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> together_addRegistry(
|
||||
// Supplier<ImmutableMap<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>>> supplier
|
||||
// ) {
|
||||
// return () -> {
|
||||
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder = ImmutableMap.builder();
|
||||
// //Make sure this gets added before WORLD_PRESETS
|
||||
// put(builder, BCLBiomeRegistry.BCL_BIOMES_REGISTRY, BiomeData.CODEC);
|
||||
//
|
||||
// Map<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> res = supplier.get();
|
||||
// builder.putAll(res);
|
||||
//
|
||||
// return builder.build();
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// @Shadow
|
||||
// static <E> void put(
|
||||
// ImmutableMap.Builder<ResourceKey<Registry<?>>, RegistryAccess.RegistryData<?>> builder,
|
||||
// ResourceKey<? extends Registry<E>> resourceKey,
|
||||
// Codec<E> codec
|
||||
// ) {
|
||||
// throw new RuntimeException("Shadowed Call");
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,14 @@ public class BlastFurnaceRecipe extends CookingRecipe<BlastFurnaceRecipe, Contai
|
|||
|
||||
@Override
|
||||
protected BlastingRecipe buildRecipe() {
|
||||
return new BlastingRecipe(id, group, input, new ItemStack(output, count), experience, cookingTime);
|
||||
return new BlastingRecipe(
|
||||
id,
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
experience,
|
||||
cookingTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.CookingBookCategory;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
@ -11,6 +12,7 @@ import net.minecraft.world.level.ItemLike;
|
|||
public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Container, R extends Recipe<C>> extends AbstractSimpleRecipe<T, C, R> {
|
||||
protected float experience;
|
||||
protected int cookingTime;
|
||||
protected CookingBookCategory bookCategory;
|
||||
|
||||
CookingRecipe(ResourceLocation id, RecipeType<R> type, ItemLike output) {
|
||||
this(id, type, type.toString(), output);
|
||||
|
@ -20,6 +22,7 @@ public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Co
|
|||
super(id, type, category, output);
|
||||
cookingTime = 1000;
|
||||
experience = 0;
|
||||
this.bookCategory = CookingBookCategory.MISC;
|
||||
}
|
||||
|
||||
public T setInput(ItemLike in) {
|
||||
|
@ -39,4 +42,9 @@ public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Co
|
|||
cookingTime = time;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T setCookingBookCategory(CookingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
private int count;
|
||||
private int time;
|
||||
private float xp;
|
||||
protected CookingBookCategory bookCategory;
|
||||
|
||||
private FurnaceRecipe() {
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
INSTANCE.xp = 0;
|
||||
INSTANCE.exist = BCLRecipeManager.exists(output);
|
||||
INSTANCE.createAdvancement(INSTANCE.id, false);
|
||||
INSTANCE.bookCategory = CookingBookCategory.MISC;
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
@ -76,6 +78,11 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FurnaceRecipe setCookingBookCategory(CookingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
build(false, false, false);
|
||||
}
|
||||
|
@ -96,6 +103,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
SmeltingRecipe recipe = new SmeltingRecipe(
|
||||
new ResourceLocation(id + "_smelting"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -108,6 +116,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
BlastingRecipe recipe2 = new BlastingRecipe(
|
||||
new ResourceLocation(id + "_blasting"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -121,6 +130,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
CampfireCookingRecipe recipe2 = new CampfireCookingRecipe(
|
||||
new ResourceLocation(id + "_campfire"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -134,6 +144,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
SmokingRecipe recipe2 = new SmokingRecipe(
|
||||
new ResourceLocation(id + "_smoker"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
|
|
@ -31,6 +31,8 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
private int count;
|
||||
private boolean exist;
|
||||
|
||||
protected CraftingBookCategory bookCategory;
|
||||
|
||||
private GridRecipe() {
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,7 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
INSTANCE.shape = new String[]{"#"};
|
||||
INSTANCE.materialKeys.clear();
|
||||
INSTANCE.count = 1;
|
||||
INSTANCE.bookCategory = CraftingBookCategory.MISC;
|
||||
|
||||
INSTANCE.exist = output != null && BCLRecipeManager.exists(output);
|
||||
INSTANCE.createAdvancement(id, output);
|
||||
|
@ -122,6 +125,11 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
return materials;
|
||||
}
|
||||
|
||||
public GridRecipe setCraftingBookCategory(CraftingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void build() {
|
||||
if (!exist) {
|
||||
|
@ -145,11 +153,12 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
CraftingRecipe recipe = shaped ? new ShapedRecipe(
|
||||
id,
|
||||
group,
|
||||
bookCategory,
|
||||
width,
|
||||
height,
|
||||
materials,
|
||||
result
|
||||
) : new ShapelessRecipe(id, group, result, materials);
|
||||
) : new ShapelessRecipe(id, group, bookCategory, result, materials);
|
||||
|
||||
BCLRecipeManager.addRecipe(type, recipe);
|
||||
registerAdvancement(recipe);
|
||||
|
|
|
@ -34,7 +34,8 @@ public abstract class BaseRegistry<T> {
|
|||
|
||||
public Item.Properties makeItemSettings() {
|
||||
Item.Properties properties = new Item.Properties();
|
||||
return properties.tab(creativeTab);
|
||||
//TODO: 1.19.3 Creative mode tabs are handled differently now
|
||||
return properties;//.tab(creativeTab);
|
||||
}
|
||||
|
||||
private void registerInternal() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.betterx.bclib.util;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
|
@ -67,7 +69,7 @@ public class StructureHelper {
|
|||
CompoundTag nbttagcompound = NbtIo.readCompressed(stream);
|
||||
|
||||
StructureTemplate template = new StructureTemplate();
|
||||
template.load(nbttagcompound);
|
||||
template.load(HolderLookup.forRegistry(Registry.BLOCK), nbttagcompound);
|
||||
|
||||
return template;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue