Flatten apples

This commit is contained in:
Sollace 2019-02-07 12:14:41 +02:00
parent daa96b1246
commit 168403b6e4
9 changed files with 53 additions and 28 deletions

View file

@ -11,6 +11,7 @@ import com.minelittlepony.unicopia.block.BlockSugar;
import com.minelittlepony.unicopia.block.BlockTomatoPlant;
import com.minelittlepony.unicopia.block.IColourful;
import com.minelittlepony.unicopia.block.USapling;
import com.minelittlepony.unicopia.item.ItemApple;
import com.minelittlepony.unicopia.block.BlockCloudDoor;
import com.minelittlepony.unicopia.block.BlockCloudFarm;
import com.minelittlepony.unicopia.block.BlockCloudFence;
@ -57,7 +58,7 @@ public class UBlocks {
public static final Block apple_leaves = new BlockFruitLeaves(Unicopia.MODID, "apple_leaves", apple_tree)
.setBaseGrowthChance(1200)
.setTint(0xFFEE81)
.setHarvestFruit(w -> UItems.apple.getRandomApple())
.setHarvestFruit(w -> ItemApple.getRandomItemStack(null))
.setUnharvestFruit(w -> new ItemStack(UItems.rotten_apple));
static void init(IForgeRegistry<Block> registry) {

View file

@ -53,9 +53,10 @@ import com.minelittlepony.unicopia.forgebullshit.OreReplacer;
import com.minelittlepony.unicopia.forgebullshit.RegistryLockSpinner;
public class UItems {
public static final ItemAppleMultiType apple = new ItemAppleMultiType("minecraft", "apple")
.setSubTypes("apple", "green", "sweet", "sour")
.setTypeRarities(10, 20, 10, 30);
public static final ItemApple red_apple = new ItemApple("minecraft", "apple");
public static final ItemApple green_apple = new ItemApple(Unicopia.MODID, "apple_green");
public static final ItemApple sweet_apple = new ItemApple(Unicopia.MODID, "apple_sweet");
public static final ItemApple sour_apple = new ItemApple(Unicopia.MODID, "apple_sour");
public static final ItemAppleMultiType zap_apple = new ItemZapApple(Unicopia.MODID, "zap_apple")
.setSubTypes("zap_apple", "red", "green", "sweet", "sour", "zap");
@ -188,7 +189,7 @@ public class UItems {
static void init(IForgeRegistry<Item> registry) {
RegistryLockSpinner.open(Item.REGISTRY, Items.class, r -> r
.replace(Items.APPLE, apple)
.replace(Items.APPLE, red_apple)
.replace(Items.STICK, stick)
.replace(Item.getItemFromBlock(Blocks.TALLGRASS), tall_grass)
.replace(Item.getItemFromBlock(Blocks.DOUBLE_PLANT), double_plant)
@ -196,6 +197,7 @@ public class UItems {
.replace(Item.getItemFromBlock(Blocks.RED_FLOWER), red_flower));
registry.registerAll(
green_apple, sweet_apple, sour_apple,
cloud_spawner, dew_drop, cloud_matter, cloud_block,
cloud_stairs, cloud_slab, cloud_fence, cloud_banister,
cloud_farmland, mist_door, anvil,
@ -216,10 +218,11 @@ public class UItems {
if (UClient.isClientSide()) {
ItemModels.registerAllVariants(cloud_slab, CloudType.getVariants("_cloud_slab"));
ItemModels.registerAllVariants(cloud_block, CloudType.getVariants("_cloud_block"));
ItemModels.registerAllVariants(apple, Unicopia.MODID, apple.getVariants());
ItemModels.registerAll(
cloud_spawner,
green_apple, sweet_apple, sour_apple,
zap_apple,
rotten_apple, cooked_zap_apple, dew_drop,
@ -252,7 +255,7 @@ public class UItems {
static void fixRecipes() {
new OreReplacer()
.registerAll(stack -> stack.getItem().getRegistryName().equals(apple.getRegistryName()))
.registerAll(stack -> stack.getItem().getRegistryName().equals(red_apple.getRegistryName()))
.done();
}

View file

@ -13,8 +13,10 @@ import com.minelittlepony.util.collection.Weighted;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
public class ItemApple extends ItemFood implements IEdible {
@ -22,28 +24,28 @@ public class ItemApple extends ItemFood implements IEdible {
public static final Pool<Object, Weighted<Supplier<ItemStack>>> typeVariantMap = Pool.of(BlockPlanks.EnumType.OAK,
BlockPlanks.EnumType.OAK, new Weighted<Supplier<ItemStack>>()
.put(1, () -> new ItemStack(UItems.rotten_apple))
.put(2, () -> new ItemStack(UItems.apple, 1, 1))
.put(3, () -> new ItemStack(UItems.apple, 1, 0)),
.put(2, () -> new ItemStack(UItems.green_apple))
.put(3, () -> new ItemStack(UItems.red_apple)),
BlockPlanks.EnumType.SPRUCE, new Weighted<Supplier<ItemStack>>()
.put(1, () -> new ItemStack(UItems.apple, 1, 3))
.put(2, () -> new ItemStack(UItems.apple, 1, 1))
.put(3, () -> new ItemStack(UItems.apple, 1, 2))
.put(1, () -> new ItemStack(UItems.sour_apple))
.put(2, () -> new ItemStack(UItems.green_apple))
.put(3, () -> new ItemStack(UItems.sweet_apple))
.put(4, () -> new ItemStack(UItems.rotten_apple)),
BlockPlanks.EnumType.BIRCH, new Weighted<Supplier<ItemStack>>()
.put(1, () -> new ItemStack(UItems.rotten_apple))
.put(2, () -> new ItemStack(UItems.apple, 1, 2))
.put(5, () -> new ItemStack(UItems.apple, 1, 1)),
.put(2, () -> new ItemStack(UItems.sweet_apple))
.put(5, () -> new ItemStack(UItems.green_apple)),
BlockPlanks.EnumType.JUNGLE, new Weighted<Supplier<ItemStack>>()
.put(5, () -> new ItemStack(UItems.apple, 1, 1))
.put(2, () -> new ItemStack(UItems.apple, 1, 2))
.put(1, () -> new ItemStack(UItems.apple, 1, 3)),
.put(5, () -> new ItemStack(UItems.green_apple))
.put(2, () -> new ItemStack(UItems.sweet_apple))
.put(1, () -> new ItemStack(UItems.sour_apple)),
BlockPlanks.EnumType.ACACIA, new Weighted<Supplier<ItemStack>>()
.put(1, () -> new ItemStack(UItems.rotten_apple))
.put(2, () -> new ItemStack(UItems.apple, 1, 2))
.put(5, () -> new ItemStack(UItems.apple, 1, 1)),
.put(2, () -> new ItemStack(UItems.sweet_apple))
.put(5, () -> new ItemStack(UItems.green_apple)),
BlockPlanks.EnumType.DARK_OAK, new Weighted<Supplier<ItemStack>>()
.put(1, () -> new ItemStack(UItems.rotten_apple))
.put(2, () -> new ItemStack(UItems.apple, 1, 2))
.put(2, () -> new ItemStack(UItems.sweet_apple))
.put(5, () -> new ItemStack(UItems.zap_apple)
)
);
@ -73,6 +75,16 @@ public class ItemApple extends ItemFood implements IEdible {
}
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (this == UItems.red_apple && isInCreativeTab(tab)) {
items.add(new ItemStack(this));
items.add(new ItemStack(UItems.green_apple));
items.add(new ItemStack(UItems.sweet_apple));
items.add(new ItemStack(UItems.sour_apple));
}
}
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(getToxicityLevel(stack).getTooltip());

View file

@ -1,6 +1,8 @@
package com.minelittlepony.unicopia.item;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public class ItemRottenApple extends ItemApple {
@ -12,4 +14,11 @@ public class ItemRottenApple extends ItemApple {
public int getItemBurnTime(ItemStack stack) {
return 150;
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (isInCreativeTab(tab)) {
items.add(new ItemStack(this));
}
}
}

View file

@ -8,7 +8,7 @@ import org.lwjgl.input.Keyboard;
import com.google.gson.annotations.Expose;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UItems;
import com.minelittlepony.unicopia.item.ItemApple;
import com.minelittlepony.unicopia.particle.Particles;
import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
@ -333,7 +333,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
}
private ItemStack getApple(World w, IBlockState log) {
return UItems.apple.getRandomApple(getVariant(log));
return ItemApple.getRandomItemStack(getVariant(log));
}
private int measureTree(World w, IBlockState log, BlockPos pos) {

View file

@ -75,9 +75,9 @@ curse.inferno.tagline=Fire II
item.spellbook.name=Spellbook
item.bag_of_holding.name=Bag of Holding
item.apple.green.name=Granny Smith Apple
item.apple.sweet.name=Sweet Apple Acres Apple
item.apple.sour.name=Sour Apple
item.apple_green.name=Granny Smith Apple
item.apple_sweet.name=Sweet Apple Acres Apple
item.apple_sour.name=Sour Apple
item.rotten_apple.name=Rotten Apple

View file

@ -16,7 +16,7 @@
{ "item": "minecraft:iron_nugget" }
],
"A": [
{ "item": "minecraft:apple", "data": 0 }
{ "item": "minecraft:apple" }
]
},
"result": { "item": "unicopia:apple_cider", "data": 0, "count": 1 }

View file

@ -17,7 +17,7 @@
{ "item": "unicopia:burned_juice", "data": 0 }
],
"A": [
{ "item": "minecraft:apple", "data": 0 }
{ "item": "minecraft:apple" }
]
},
"result": { "item": "unicopia:apple_cider", "data": 0, "count": 1 }

View file

@ -11,7 +11,7 @@
{ "item": "minecraft:glass_bottle" }
],
"A": [
{ "item": "minecraft:apple", "data": 0 }
{ "item": "minecraft:apple" }
]
},
"result": { "item": "unicopia:juice", "data": 0, "count": 1 }