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:
+16
@@ -8,9 +8,11 @@ import net.minecraft.world.item.Item;
|
||||
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.Set;
|
||||
@@ -44,6 +46,20 @@ public class ForgeBlockLootTableProvider extends BlockLootSubProvider implements
|
||||
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))));
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
+31
@@ -13,10 +13,13 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ForgeBlockStateProvider extends BlockStateProvider implements ModBlockStateProvider.BlockStateHelper {
|
||||
|
||||
public ForgeBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
|
||||
@@ -65,6 +68,34 @@ public class ForgeBlockStateProvider extends BlockStateProvider implements ModBl
|
||||
super.simpleBlockWithItem(block, models().cubeAll(name(block), blockTexture(block)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockWithItem(Block block, ResourceLocation sideTexture, ResourceLocation bottomTexture, ResourceLocation topTexture) {
|
||||
super.simpleBlockWithItem(block, models().cubeBottomTop(name(block), sideTexture, bottomTexture, topTexture));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTextureBlockWithItem(Block block, List<ResourceLocation> textures) {
|
||||
if (textures.isEmpty()) {
|
||||
throw new IllegalArgumentException("randomTextureBlockWithItem requires at least one texture");
|
||||
}
|
||||
|
||||
ConfiguredModel[] configuredModels = new ConfiguredModel[textures.size()];
|
||||
|
||||
for (int i = 0; i < textures.size(); i++) {
|
||||
ModelFile model = models().cubeAll(name(block) + "_" + i, textures.get(i));
|
||||
configuredModels[i] = ConfiguredModel.builder()
|
||||
.modelFile(model)
|
||||
.weight(1)
|
||||
.buildLast();
|
||||
}
|
||||
|
||||
getVariantBuilder(block)
|
||||
.partialState()
|
||||
.setModels(configuredModels);
|
||||
|
||||
simpleBlockItem(block, models().cubeAll(name(block) + "_0", textures.get(0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void horizontalFacingWithItem(Block block) {
|
||||
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name(block)));
|
||||
|
||||
Reference in New Issue
Block a user