- 91
- 1
- 5
Я уже 2 дня мучаюсь, но ни один из методов не сработал
Java:
package com.enginners.ores;
import java.util.Random;
import com.enginners.mod.CVCRInformation;
import com.enginners.other.OreBase;
import com.enginners.registries.CVCRBlocksRegistries;
import com.enginners.registries.CVCRItemsRegistries;
import com.enginners.utils.enums.OreType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class LimestoneOre extends OreBase {
public static final PropertyEnum<OreType> ORETYPE = PropertyEnum.create("oretype", OreType.class);
public static final ResourceLocation LIMESTONE_ORE = new ResourceLocation(CVCRInformation.MOD_ID, "limestone_ore");
public LimestoneOre(String name, Material material, String oreDictionary, String modId) {
super(name, Material.ROCK, modId, oreDictionary);
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(ORETYPE, OreType.values()[meta]);
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, ORETYPE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(ORETYPE).ordinal();
}
@Override
public int damageDropped(IBlockState state) {
return state.getValue(ORETYPE).ordinal();
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune){
return this == CVCRBlocksRegistries.LimestoneOre ? CVCRItemsRegistries.Limeball : Item.getItemFromBlock(this);
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state){
return new ItemStack(Item.getItemFromBlock(CVCRBlocksRegistries.LimestoneOre), 1, this.damageDropped(state));
}
@Override
public int quantityDropped(Random random){
return 2 + random.nextInt(1);
}
@Override
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune){
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
@Override
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune){
Random rand = world instanceof World ? ((World)world).rand : new Random();
if (this.getItemDropped(state, RANDOM, fortune) != Item.getItemFromBlock(this)){
int i = 0;
if (this == CVCRBlocksRegistries.LimestoneOre){
i = MathHelper.getInt(rand, 0, 5);
} return i;
} return 0;
}
@Override
protected ItemStack getSilkTouchDrop(IBlockState state){
return new ItemStack(CVCRBlocksRegistries.LimestoneOre);
}
@Override
public int quantityDroppedWithBonus(int fortune, Random random){
if (fortune > 0 && Item.getItemFromBlock(this)!= this.getItemDropped(this.getBlockState().getValidStates().iterator().next(), random, fortune)){
int i = random.nextInt(fortune + 2) - 1;
if (i < 0){
i = 0;
} return this.quantityDropped(random) * (i + 1);
} else {
return this.quantityDropped(random);
}
}
}
Код:
{
"forge_marker": 1,
"variants": {
"normal": [{}],
"inventory": [{}],
"oretype": {
"overworld": {
"model": "cube_all",
"textures": {
"all": "complicatedvanillacraftingrecipes:blocks/limestone_ore_overworld"
}
}
}
}
}
Код:
{
"parent": "block/cube_all",
"textures": {
"all": "complicatedvanillacraftingrecipes:blocks/limestone_ore_overworld"
}
}
Код:
{
"parent": "complicatedvanillacraftingrecipes:block/limestone_ore"
}
Последнее редактирование модератором: