Re-added the BoP creative tab and the items
This commit is contained in:
parent
2ef252f106
commit
50cf0f59e1
6 changed files with 208 additions and 2 deletions
55
src/main/java/biomesoplenty/api/item/BOPItems.java
Normal file
55
src/main/java/biomesoplenty/api/item/BOPItems.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2019, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.api.item;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class BOPItems
|
||||
{
|
||||
public static Item bop_icon;
|
||||
|
||||
public static Item berries;
|
||||
public static Item peach;
|
||||
public static Item persimmon;
|
||||
public static Item pear;
|
||||
|
||||
public static Item fleshchunk;
|
||||
public static Item mudball;
|
||||
public static Item ash;
|
||||
public static Item mud_brick;
|
||||
public static Item other_slab;
|
||||
|
||||
public static Item boat_cherry;
|
||||
public static Item boat_umbran;
|
||||
public static Item boat_fir;
|
||||
public static Item boat_ethereal;
|
||||
public static Item boat_magic;
|
||||
public static Item boat_palm;
|
||||
public static Item boat_redwood;
|
||||
public static Item boat_willow;
|
||||
public static Item boat_hellbark;
|
||||
public static Item boat_jacaranda;
|
||||
public static Item boat_mahogany;
|
||||
|
||||
public static Item cherry_door;
|
||||
public static Item umbran_door;
|
||||
public static Item fir_door;
|
||||
public static Item ethereal_door;
|
||||
public static Item magic_door;
|
||||
public static Item palm_door;
|
||||
public static Item redwood_door;
|
||||
public static Item willow_door;
|
||||
public static Item hellbark_door;
|
||||
public static Item jacaranda_door;
|
||||
public static Item mahogany_door;
|
||||
|
||||
public static Item wood_slab_0;
|
||||
public static Item wood_slab_1;
|
||||
|
||||
public static Item record_wanderer;
|
||||
}
|
31
src/main/java/biomesoplenty/common/item/ItemBOPFood.java
Normal file
31
src/main/java/biomesoplenty/common/item/ItemBOPFood.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2019, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.common.item;
|
||||
|
||||
import biomesoplenty.common.util.inventory.ItemGroupBOP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBOPFood extends ItemFood
|
||||
{
|
||||
public int eatDuration;
|
||||
|
||||
public ItemBOPFood(int amount, float saturation, int eatDuration)
|
||||
{
|
||||
super(amount, saturation, false, new Item.Builder().group(ItemGroupBOP.instance));
|
||||
this.eatDuration = eatDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseDuration(ItemStack stack)
|
||||
{
|
||||
return this.eatDuration;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2019, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.common.util.inventory;
|
||||
|
||||
import biomesoplenty.api.item.BOPItems;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class ItemGroupBOP extends ItemGroup
|
||||
{
|
||||
public static final ItemGroupBOP instance = new ItemGroupBOP(ItemGroup.GROUPS.length, "biomesoplenty");
|
||||
|
||||
private ItemGroupBOP(int index, String label)
|
||||
{
|
||||
super(index, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createIcon()
|
||||
{
|
||||
return new ItemStack(BOPItems.bop_icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void fill(NonNullList<ItemStack> items)
|
||||
{
|
||||
super.fill(items);
|
||||
|
||||
// FIXME
|
||||
/*for (Fluid bucketFluid : FluidRegistry.getBucketFluids())
|
||||
{
|
||||
if (bucketFluid.getBlock() != null && bucketFluid.getBlock().getRegistryName().getResourceDomain().equals(BiomesOPlenty.MOD_ID))
|
||||
{
|
||||
ItemStack itemstack = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, bucketFluid);
|
||||
itemList.add(itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
for (EntityList.EntityEggInfo eggInfo : EntityList.ENTITY_EGGS.values())
|
||||
{
|
||||
if (eggInfo.spawnedID.getResourceDomain().equals(BiomesOPlenty.MOD_ID))
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(Items.SPAWN_EGG, 1);
|
||||
ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, eggInfo.spawnedID);
|
||||
itemList.add(itemstack);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
package biomesoplenty.core;
|
||||
|
||||
import biomesoplenty.init.ModBlocks;
|
||||
import biomesoplenty.init.ModItems;
|
||||
import net.minecraft.init.Bootstrap;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
|
@ -29,7 +30,7 @@ public class BiomesOPlenty
|
|||
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
|
||||
FMLModLoadingContext.get().getModEventBus().addListener(this::init);
|
||||
|
||||
// As of right now registry events are fired after construction
|
||||
ModItems.init();
|
||||
ModBlocks.init();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package biomesoplenty.init;
|
||||
|
||||
import biomesoplenty.common.block.BlockBOPAsh;
|
||||
import biomesoplenty.common.util.inventory.ItemGroupBOP;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
@ -27,7 +28,7 @@ public class ModBlocks
|
|||
|
||||
public static Block registerBlock(Block block, String name)
|
||||
{
|
||||
ItemBlock itemBlock = new ItemBlock(block, new Item.Builder().group(ItemGroup.MISC));
|
||||
ItemBlock itemBlock = new ItemBlock(block, new Item.Builder().group(ItemGroupBOP.instance));
|
||||
block.setRegistryName(name);
|
||||
itemBlock.setRegistryName(name);
|
||||
ForgeRegistries.BLOCKS.register(block);
|
||||
|
|
60
src/main/java/biomesoplenty/init/ModItems.java
Normal file
60
src/main/java/biomesoplenty/init/ModItems.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2019, the Biomes O' Plenty Team
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
******************************************************************************/
|
||||
package biomesoplenty.init;
|
||||
|
||||
import static biomesoplenty.api.item.BOPItems.*;
|
||||
|
||||
import biomesoplenty.common.item.ItemBOPFood;
|
||||
import biomesoplenty.common.util.inventory.ItemGroupBOP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemRecord;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ModItems
|
||||
{
|
||||
public static void init()
|
||||
{
|
||||
berries = registerItem(new ItemBOPFood(1, 0.1F, 8), "berries");
|
||||
pear = registerItem(new ItemFood(5, 0.3F, false, new Item.Builder().group(ItemGroupBOP.instance)), "pear");
|
||||
peach = registerItem(new ItemFood(5, 0.2F, false, new Item.Builder().group(ItemGroupBOP.instance)), "peach");
|
||||
persimmon = registerItem(new ItemFood(5, 0.2F, false, new Item.Builder().group(ItemGroupBOP.instance)), "persimmon");
|
||||
|
||||
// TODO: This should be ItemMudball
|
||||
mudball = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "mudball");
|
||||
mud_brick = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "mud_brick");
|
||||
ash = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "ash");
|
||||
fleshchunk = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "fleshchunk");
|
||||
|
||||
// TODO: This needs to be ItemBOPRecord and/or registered with its sounds
|
||||
record_wanderer = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "record_wanderer");
|
||||
|
||||
// TODO: These all need to be associated with their entities
|
||||
boat_fir = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_fir");
|
||||
boat_redwood = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_redwood");
|
||||
boat_cherry = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_cherry");
|
||||
boat_mahogany = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_mahogany");
|
||||
boat_jacaranda = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_jacaranda");
|
||||
boat_palm = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_palm");
|
||||
boat_willow = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_willow");
|
||||
boat_magic = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_magic");
|
||||
boat_umbran = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_umbran");
|
||||
boat_hellbark = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_hellbark");
|
||||
boat_ethereal = registerItem(new Item(new Item.Builder().group(ItemGroupBOP.instance)), "boat_ethereal");
|
||||
|
||||
bop_icon = registerItem(new Item(new Item.Builder()), "bop_icon");
|
||||
}
|
||||
|
||||
public static Item registerItem(Item item, String name)
|
||||
{
|
||||
item.setRegistryName(name);
|
||||
ForgeRegistries.ITEMS.register(item);
|
||||
return item;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue