Added variable size
Added variable and dynamic hitbox Added dynamic growth times Added name tag skin handling Added Frozen Bone item Added Permafrost block and frozen bone drop, with spawn rules Changed Stone Fossil and Deepslate Fossil to have random texture
This commit is contained in:
@@ -2,7 +2,10 @@ package net.cmr.jurassicrevived;
|
||||
|
||||
import net.cmr.jurassicrevived.block.entity.ModBlockEntities;
|
||||
import net.cmr.jurassicrevived.block.entity.custom.*;
|
||||
import net.cmr.jurassicrevived.worldgen.ModWorldgenDefinitions;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
|
||||
import net.cmr.jurassicrevived.platform.FabricEnergyWrapper;
|
||||
import net.cmr.jurassicrevived.platform.FabricTransferHelper;
|
||||
@@ -10,6 +13,7 @@ import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
|
||||
import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage;
|
||||
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import team.reborn.energy.api.EnergyStorage;
|
||||
|
||||
public class JRMod implements ModInitializer
|
||||
@@ -25,6 +29,14 @@ public class JRMod implements ModInitializer
|
||||
// Use Fabric to bootstrap the Common mod.
|
||||
CommonClass.init();
|
||||
|
||||
for (ModWorldgenDefinitions.OreDefinition ore : ModWorldgenDefinitions.ORES) {
|
||||
BiomeModifications.addFeature(
|
||||
BiomeSelectors.tag(ore.biomeTag()), // Dynamically uses IS_OVERWORLD or IS_SNOWY
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES,
|
||||
ore.placedFeatureKey()
|
||||
);
|
||||
}
|
||||
|
||||
FluidStorage.SIDED.registerForBlockEntities((be, side) ->
|
||||
new FabricTransferHelper.InternalFluidStorage(((TankBlockEntity) be).getFluidHandler(side)),
|
||||
ModBlockEntities.TANK_BE.get()
|
||||
|
||||
+16
@@ -9,9 +9,11 @@ import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.entries.AlternativesEntry;
|
||||
import net.minecraft.world.level.storage.loot.entries.LootItem;
|
||||
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
|
||||
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition;
|
||||
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -59,6 +61,20 @@ public class FabricBlockLootTableProvider extends net.fabricmc.fabric.api.datage
|
||||
//?}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable.Builder createRandomOreDrops(Block block, Item silkTouchDrop, Item firstDrop, Item secondDrop, float minRolls, float maxRolls, double firstDropChance) {
|
||||
return this.createSilkTouchDispatchTable(block,
|
||||
AlternativesEntry.alternatives(
|
||||
this.applyExplosionDecay(block,
|
||||
LootItem.lootTableItem(firstDrop)
|
||||
.when(LootItemRandomChanceCondition.randomChance((float) firstDropChance))
|
||||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(minRolls, maxRolls)))),
|
||||
this.applyExplosionDecay(block,
|
||||
LootItem.lootTableItem(secondDrop)
|
||||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(minRolls, maxRolls))))
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable.Builder createPotFlowerItemTable(Block block) {
|
||||
return super.createPotFlowerItemTable(block);
|
||||
|
||||
@@ -148,6 +148,57 @@ public class FabricModModelProvider extends FabricModelProvider implements ModBl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockWithItem(Block block, ResourceLocation sideTexture, ResourceLocation bottomTexture, ResourceLocation topTexture) {
|
||||
if (isGeneratingBlocks()) {
|
||||
TextureMapping mapping = new TextureMapping()
|
||||
.put(TextureSlot.SIDE, sideTexture)
|
||||
.put(TextureSlot.BOTTOM, bottomTexture)
|
||||
.put(TextureSlot.TOP, topTexture);
|
||||
ResourceLocation modelLocation = ModelTemplates.CUBE_BOTTOM_TOP.create(block, mapping, blockStateGenerator.modelOutput);
|
||||
blockStateGenerator.blockStateOutput.accept(BlockModelGenerators.createSimpleBlock(block, modelLocation));
|
||||
}
|
||||
if (isGeneratingItems()) {
|
||||
generateBlockItemModel(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTextureBlockWithItem(Block block, List<ResourceLocation> textures) {
|
||||
if (textures.isEmpty()) {
|
||||
throw new IllegalArgumentException("randomTextureBlockWithItem requires at least one texture");
|
||||
}
|
||||
|
||||
ResourceLocation baseModel = null;
|
||||
|
||||
if (isGeneratingBlocks()) {
|
||||
Variant[] variants = new Variant[textures.size()];
|
||||
|
||||
for (int i = 0; i < textures.size(); i++) {
|
||||
TextureMapping mapping = new TextureMapping().put(TextureSlot.ALL, textures.get(i));
|
||||
ResourceLocation model = ModelTemplates.CUBE_ALL.createWithSuffix(block, "_" + i, mapping, blockStateGenerator.modelOutput);
|
||||
|
||||
if (i == 0) {
|
||||
baseModel = model;
|
||||
}
|
||||
|
||||
variants[i] = Variant.variant()
|
||||
.with(VariantProperties.MODEL, model);
|
||||
}
|
||||
|
||||
blockStateGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block, variants));
|
||||
}
|
||||
|
||||
if (isGeneratingItems()) {
|
||||
ResourceLocation itemParent = baseModel != null ? baseModel : ModelLocationUtils.getModelLocation(block, "_0");
|
||||
itemModelGenerator.output.accept(ModelLocationUtils.getModelLocation(block.asItem()), () -> {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("parent", itemParent.toString());
|
||||
return json;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private PropertyDispatch createRotatedHorizontalFacingDispatch() {
|
||||
return PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING)
|
||||
.select(Direction.NORTH, Variant.variant().with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180))
|
||||
|
||||
Reference in New Issue
Block a user