mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 06:26:43 +01:00
Added several new food items and changed how item variants are registered
This commit is contained in:
parent
663d37a602
commit
7f91a0758c
19 changed files with 247 additions and 71 deletions
|
@ -22,7 +22,6 @@ import com.minelittlepony.unicopia.spell.SpellRegistry;
|
|||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -39,7 +38,6 @@ import net.minecraft.item.crafting.Ingredient;
|
|||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
@ -47,10 +45,14 @@ import net.minecraftforge.registries.IForgeRegistry;
|
|||
import static com.minelittlepony.unicopia.Predicates.*;
|
||||
|
||||
import com.minelittlepony.unicopia.edibles.BushToxicityDeterminent;
|
||||
import com.minelittlepony.unicopia.edibles.CookedToxicityDeterminent;
|
||||
import com.minelittlepony.unicopia.edibles.FlowerToxicityDeterminent;
|
||||
import com.minelittlepony.unicopia.edibles.ItemEdible;
|
||||
import com.minelittlepony.unicopia.edibles.Toxicity;
|
||||
import com.minelittlepony.unicopia.edibles.UItemFoodDelegate;
|
||||
import com.minelittlepony.unicopia.forgebullshit.BuildInTexturesBakery;
|
||||
import com.minelittlepony.unicopia.forgebullshit.FUF;
|
||||
import com.minelittlepony.unicopia.forgebullshit.ItemModels;
|
||||
import com.minelittlepony.unicopia.forgebullshit.RegistryLockSpinner;
|
||||
|
||||
public class UItems {
|
||||
|
@ -76,9 +78,8 @@ public class UItems {
|
|||
|
||||
public static final ItemCloud cloud_spawner = new ItemCloud(Unicopia.MODID, "cloud");
|
||||
|
||||
public static final Item cloud_block = new UItemMultiTexture(UBlocks.cloud, stack -> {
|
||||
return CloudType.byMetadata(stack.getMetadata()).getTranslationKey();
|
||||
}, INTERACT_WITH_CLOUDS)
|
||||
public static final Item cloud_block = new UItemMultiTexture(UBlocks.cloud, stack ->
|
||||
CloudType.byMetadata(stack.getMetadata()).getTranslationKey(), INTERACT_WITH_CLOUDS)
|
||||
.setRegistryName(Unicopia.MODID, "cloud_block");
|
||||
|
||||
public static final Item cloud_stairs = new UItemBlock(UBlocks.cloud_stairs, Unicopia.MODID, "cloud_stairs", INTERACT_WITH_CLOUDS);
|
||||
|
@ -94,7 +95,7 @@ public class UItems {
|
|||
|
||||
public static final Item sugar_block = new UItemDecoration(UBlocks.sugar_block, Unicopia.MODID, "sugar_block");
|
||||
|
||||
public static final Item cloud_slab = new UItemSlab(UBlocks.cloud_slab, UBlocks.cloud_slab, UBlocks.cloud_double_slab, INTERACT_WITH_CLOUDS)
|
||||
public static final Item cloud_slab = new UItemSlab(UBlocks.cloud_slab, UBlocks.cloud_double_slab, INTERACT_WITH_CLOUDS)
|
||||
.setTranslationKey("cloud_slab")
|
||||
.setRegistryName(Unicopia.MODID, "cloud_slab");
|
||||
|
||||
|
@ -142,6 +143,17 @@ public class UItems {
|
|||
).setFoodDelegate(new ItemEdible(new FlowerToxicityDeterminent(BlockFlower.EnumFlowerColor.RED)))
|
||||
.setTranslationKey("rose");
|
||||
|
||||
public static final Item daffodil_daisy_sandwich = new ItemEdible(Unicopia.MODID, "daffodil_daisy_sandwich", 3, 2, CookedToxicityDeterminent.instance);
|
||||
public static final Item hay_burger = new ItemEdible(Unicopia.MODID, "hay_burger", 3, 4, CookedToxicityDeterminent.instance);
|
||||
public static final Item hay_fries = new ItemEdible(Unicopia.MODID, "hay_fries", 1, 5, CookedToxicityDeterminent.instance);
|
||||
public static final Item salad = new ItemEdible(Unicopia.MODID, "salad", 4, 2, CookedToxicityDeterminent.instance);
|
||||
|
||||
public static final Item wheat_worms = new ItemEdible(Unicopia.MODID, "wheat_worms", 1, 0, stack -> Toxicity.SEVERE);
|
||||
|
||||
public static final Item apple_cider = new ItemEdible(Unicopia.MODID, "apple_cider", 4, 2, stack -> Toxicity.FAIR);
|
||||
public static final Item juice = new ItemEdible(Unicopia.MODID, "juice", 2, 2, stack -> Toxicity.SAFE);
|
||||
public static final Item burned_juice = new ItemEdible(Unicopia.MODID, "burned_juice", 3, 1, stack -> Toxicity.FAIR);
|
||||
|
||||
static void registerItems(IForgeRegistry<Item> registry) {
|
||||
RegistryLockSpinner.unlock(Item.REGISTRY);
|
||||
|
||||
|
@ -153,67 +165,64 @@ public class UItems {
|
|||
|
||||
RegistryLockSpinner.lock(Item.REGISTRY);
|
||||
|
||||
registry.registerAll(cloud_spawner, dew_drop, cloud_matter, cloud_block,
|
||||
cloud_stairs, cloud_slab, cloud_farmland,
|
||||
mist_door, anvil,
|
||||
registry.registerAll(
|
||||
cloud_spawner, dew_drop, cloud_matter, cloud_block,
|
||||
cloud_stairs, cloud_slab, cloud_farmland,
|
||||
mist_door, anvil,
|
||||
|
||||
bag_of_holding, spell, curse, spellbook,
|
||||
bag_of_holding, spell, curse, spellbook,
|
||||
|
||||
alfalfa_seeds, alfalfa_leaves,
|
||||
cereal, sugar_cereal, sugar_block,
|
||||
rotten_apple, zap_apple, cooked_zap_apple,
|
||||
alfalfa_seeds, alfalfa_leaves,
|
||||
cereal, sugar_cereal, sugar_block,
|
||||
rotten_apple, zap_apple, cooked_zap_apple,
|
||||
|
||||
cloudsdale_tomato, tomato_seeds, tomato,
|
||||
cloudsdale_tomato, tomato_seeds, tomato,
|
||||
|
||||
apple_seeds, apple_leaves);
|
||||
apple_seeds, apple_leaves,
|
||||
|
||||
daffodil_daisy_sandwich, hay_burger, hay_fries, salad, wheat_worms,
|
||||
apple_cider, juice, burned_juice);
|
||||
|
||||
if (UClient.isClientSide()) {
|
||||
registerAllVariants(apple, apple.getVariants());
|
||||
registerAllVariants(zap_apple, zap_apple.getVariants());
|
||||
registerAllVariants(rotten_apple, "rotten_apple");
|
||||
registerAllVariants(cooked_zap_apple, "cooked_zap_apple");
|
||||
registerAllVariants(cloud_spawner, "cloud_small", "cloud_medium", "cloud_large");
|
||||
registerAllVariants(dew_drop, "dew_drop");
|
||||
registerAllVariants(cloud_matter, "cloud_matter");
|
||||
registerAllVariants(cloud_stairs, "cloud_stairs");
|
||||
registerAllVariants(cloud_farmland, "cloud_farmland");
|
||||
registerAllVariants(cloud_slab, CloudType.getVariants("_cloud_slab"));
|
||||
registerAllVariants(cloud_block, CloudType.getVariants("_cloud_block"));
|
||||
registerAllVariants(mist_door, "mist_door");
|
||||
registerAllVariants(anvil, "anvil");
|
||||
registerAllVariants(bag_of_holding, "bag_of_holding");
|
||||
registerAllVariants(spell, "gem");
|
||||
registerAllVariants(curse, "corrupted_gem");
|
||||
registerAllVariants(spellbook, "spellbook");
|
||||
registerAllVariants(alfalfa_seeds, "alfalfa_seeds");
|
||||
registerAllVariants(alfalfa_leaves, "alfalfa_leaves");
|
||||
registerAllVariants(cereal, "cereal");
|
||||
registerAllVariants(sugar_cereal, "sugar_cereal");
|
||||
registerAllVariants(sugar_block, "sugar_block");
|
||||
registerAllVariants(tomato, "tomato", "rotten_tomato");
|
||||
registerAllVariants(cloudsdale_tomato, "cloudsdale_tomato", "rotten_cloudsdale_tomato");
|
||||
registerAllVariants(tomato_seeds, "tomato_seeds");
|
||||
registerAllVariants(apple_seeds, "apple_seeds");
|
||||
registerAllVariants(apple_leaves, "apple_leaves");
|
||||
ItemModels.registerAllVariants(cloud_slab, CloudType.getVariants("_cloud_slab"));
|
||||
ItemModels.registerAllVariants(cloud_block, CloudType.getVariants("_cloud_block"));
|
||||
ItemModels.registerAll(
|
||||
cloud_spawner,
|
||||
|
||||
BuildInTexturesBakery.getBuiltInTextures().add(new ResourceLocation("unicopia", "items/empty_slot_gem"));
|
||||
apple, zap_apple,
|
||||
rotten_apple, cooked_zap_apple, dew_drop,
|
||||
|
||||
tomato, cloudsdale_tomato,
|
||||
|
||||
cloud_spawner, cloud_matter, cloud_stairs, cloud_farmland, mist_door, anvil,
|
||||
bag_of_holding, spell, curse, spellbook,
|
||||
|
||||
alfalfa_seeds, alfalfa_leaves,
|
||||
cereal, sugar_cereal, sugar_block,
|
||||
tomato_seeds,
|
||||
|
||||
apple_seeds, apple_leaves,
|
||||
|
||||
daffodil_daisy_sandwich, hay_burger, hay_fries, salad, wheat_worms,
|
||||
|
||||
apple_cider, juice, burned_juice);
|
||||
|
||||
BuildInTexturesBakery.getBuiltInTextures().add(new ResourceLocation(Unicopia.MODID, "items/empty_slot_gem"));
|
||||
}
|
||||
|
||||
registerFuels();
|
||||
}
|
||||
|
||||
private static void registerAllVariants(Item item, String... variants) {
|
||||
for (int i = 0; i < variants.length; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation("unicopia:" + variants[i]));
|
||||
}
|
||||
}
|
||||
|
||||
static void registerFuels() {
|
||||
FurnaceRecipes.instance().addSmeltingRecipe(
|
||||
new ItemStack(UItems.zap_apple, 1),
|
||||
new ItemStack(UItems.cooked_zap_apple, 1), 0.1F);
|
||||
new ItemStack(zap_apple, 1),
|
||||
new ItemStack(cooked_zap_apple, 1), 0.1F);
|
||||
FurnaceRecipes.instance().addSmeltingRecipe(
|
||||
new ItemStack(juice),
|
||||
new ItemStack(burned_juice), 0);
|
||||
}
|
||||
|
||||
@FUF(reason = "There is no way to register custom recipe types that support nbt data. Waiting for mixins...")
|
||||
static void registerRecipes(IForgeRegistry<IRecipe> registry) {
|
||||
Ingredient dewdrop = Ingredient.fromItem(dew_drop);
|
||||
Ingredient cloud = Ingredient.fromStacks(new ItemStack(cloud_block, 1, 0));
|
||||
|
@ -233,7 +242,7 @@ public class UItems {
|
|||
@SideOnly(Side.CLIENT)
|
||||
static void registerColors(ItemColors registry) {
|
||||
registry.registerItemColorHandler((stack, tint) -> {
|
||||
if (Predicates.MAGI.test(Minecraft.getMinecraft().player)) {
|
||||
if (MAGI.test(Minecraft.getMinecraft().player)) {
|
||||
return SpellRegistry.instance().getSpellTintFromStack(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,19 @@ public class UnicopiaClient extends UClient {
|
|||
return Minecraft.getMinecraft().player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClientPlayer(@Nullable EntityPlayer player) {
|
||||
if (getPlayer() == player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getPlayer() == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getPlayer().getGameProfile().getId().equals(player.getGameProfile().getId());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
@ -101,13 +114,11 @@ public class UnicopiaClient extends UClient {
|
|||
return;
|
||||
}
|
||||
|
||||
if (UClient.isClientSide()) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.player != null && mc.world != null) {
|
||||
IPlayer player = PlayerSpeciesList.instance().getPlayer(mc.player);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.player != null && mc.world != null) {
|
||||
IPlayer player = PlayerSpeciesList.instance().getPlayer(mc.player);
|
||||
|
||||
UHud.instance.renderHud(player, event.getResolution());
|
||||
}
|
||||
UHud.instance.renderHud(player, event.getResolution());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,13 +132,15 @@ public class UnicopiaClient extends UClient {
|
|||
@SubscribeEvent
|
||||
public static void onGameTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == Phase.END) {
|
||||
if (Minecraft.getMinecraft().player != null) {
|
||||
EntityPlayer player = UClient.instance().getPlayer();
|
||||
|
||||
if (player != null) {
|
||||
Race newRace = getclientPlayerRace();
|
||||
|
||||
if (newRace != clientPlayerRace) {
|
||||
clientPlayerRace = newRace;
|
||||
|
||||
Unicopia.channel.send(new MsgRequestCapabilities(Minecraft.getMinecraft().player, clientPlayerRace), Target.SERVER);
|
||||
Unicopia.channel.send(new MsgRequestCapabilities(player, clientPlayerRace), Target.SERVER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +152,7 @@ public class UnicopiaClient extends UClient {
|
|||
@SubscribeEvent
|
||||
public static void setupPlayerCamera(EntityViewRenderEvent.CameraSetup event) {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
EntityPlayer player = UClient.instance().getPlayer();
|
||||
|
||||
if (player != null) {
|
||||
IView view = PlayerSpeciesList.instance().getPlayer(player).getCamera();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.minelittlepony.unicopia.edibles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CookedToxicityDeterminent implements IEdible {
|
||||
public static final IEdible instance = new CookedToxicityDeterminent();
|
||||
|
||||
@Override
|
||||
public Toxicity getToxicityLevel(ItemStack stack) {
|
||||
return Toxicity.byMetadata(stack.getMetadata());
|
||||
}
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
package com.minelittlepony.unicopia.edibles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -19,6 +24,7 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemEdible extends ItemFood implements IEdible {
|
||||
|
@ -26,7 +32,16 @@ public class ItemEdible extends ItemFood implements IEdible {
|
|||
private final IEdible toxicityDeterminant;
|
||||
|
||||
public ItemEdible(@Nonnull IEdible mapper) {
|
||||
super(0, 0, false);
|
||||
super(1, 0, false);
|
||||
|
||||
toxicityDeterminant = mapper;
|
||||
}
|
||||
|
||||
public ItemEdible(String domain, String name, int amount, int saturation, @Nonnull IEdible mapper) {
|
||||
super(amount, saturation, false);
|
||||
|
||||
setTranslationKey(name);
|
||||
setRegistryName(domain, name);
|
||||
|
||||
toxicityDeterminant = mapper;
|
||||
}
|
||||
|
@ -38,6 +53,15 @@ public class ItemEdible extends ItemFood implements IEdible {
|
|||
addSecondaryEffects(player, toxicity, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
Toxicity toxicity = getToxicityLevel(stack);
|
||||
|
||||
TextFormatting color = toxicity.toxicWhenCooked() ? TextFormatting.RED : toxicity.toxicWhenRaw() ? TextFormatting.DARK_PURPLE : TextFormatting.GRAY;
|
||||
|
||||
tooltip.add(color + I18n.format(toxicity.getTranslationKey()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
|
|
|
@ -12,6 +12,8 @@ public enum Toxicity {
|
|||
private final int level;
|
||||
private final int duration;
|
||||
|
||||
private static final Toxicity[] values = values();
|
||||
|
||||
Toxicity(int level, int duration) {
|
||||
this.level = level;
|
||||
this.duration = duration;
|
||||
|
@ -32,4 +34,12 @@ public enum Toxicity {
|
|||
public PotionEffect getPoisonEffect() {
|
||||
return new PotionEffect(MobEffects.POISON, duration, level);
|
||||
}
|
||||
|
||||
public String getTranslationKey() {
|
||||
return String.format("toxicity.%s.name", name().toLowerCase());
|
||||
}
|
||||
|
||||
public static Toxicity byMetadata(int metadata) {
|
||||
return values[metadata % values.length];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.minelittlepony.unicopia.forgebullshit;
|
||||
|
||||
/**
|
||||
* An item that has multiple subtypes.
|
||||
*/
|
||||
public interface IMultiItem {
|
||||
/**
|
||||
* Returns the names for all subtypes this item supports.
|
||||
* Used to register models and textures on the client.
|
||||
*/
|
||||
String[] getVariants();
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.minelittlepony.unicopia.forgebullshit;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
public class ItemModels {
|
||||
|
||||
/**
|
||||
* Registers models and item variants for all of the provided textures.
|
||||
*/
|
||||
public static void registerAll(Item...items) {
|
||||
for (Item i : items) {
|
||||
if (i instanceof IMultiItem && i.getHasSubtypes()) {
|
||||
registerAllVariants(i, ((IMultiItem)i).getVariants());
|
||||
} else {
|
||||
ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(i.getRegistryName().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a model for the given item and all associated variants.
|
||||
*/
|
||||
public static void registerAllVariants(Item item, String... variants) {
|
||||
for (int i = 0; i < variants.length; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName().getNamespace() + ":" + variants[i]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.item;
|
|||
import java.util.Random;
|
||||
|
||||
import com.minelittlepony.unicopia.UItems;
|
||||
import com.minelittlepony.unicopia.forgebullshit.IMultiItem;
|
||||
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -10,7 +11,7 @@ import net.minecraft.item.ItemFood;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class ItemApple extends ItemFood {
|
||||
public class ItemApple extends ItemFood implements IMultiItem {
|
||||
|
||||
private int[] typeRarities = new int[0];
|
||||
|
||||
|
@ -98,6 +99,7 @@ public class ItemApple extends ItemFood {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVariants() {
|
||||
return variants;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.item;
|
|||
|
||||
import com.minelittlepony.unicopia.CloudSize;
|
||||
import com.minelittlepony.unicopia.entity.EntityCloud;
|
||||
import com.minelittlepony.unicopia.forgebullshit.IMultiItem;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -15,7 +16,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemCloud extends Item {
|
||||
public class ItemCloud extends Item implements IMultiItem {
|
||||
|
||||
private static final String[] variants = new String[] {"cloud_small", "cloud_medium", "cloud_large"};
|
||||
|
||||
public ItemCloud(String domain, String name) {
|
||||
super();
|
||||
|
@ -28,6 +31,11 @@ public class ItemCloud extends Item {
|
|||
maxStackSize = 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVariants() {
|
||||
return variants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import com.minelittlepony.unicopia.forgebullshit.IMultiItem;
|
||||
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -16,11 +17,15 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemTomato extends ItemFood implements ITossable {
|
||||
public class ItemTomato extends ItemFood implements ITossable, IMultiItem {
|
||||
|
||||
private final String name;
|
||||
|
||||
public ItemTomato(String domain, String name, int heal, int sat) {
|
||||
super(heal, sat, false);
|
||||
|
||||
this.name = name;
|
||||
|
||||
setTranslationKey(name);
|
||||
setRegistryName(domain, name);
|
||||
|
||||
|
@ -28,6 +33,11 @@ public class ItemTomato extends ItemFood implements ITossable {
|
|||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVariants() {
|
||||
return new String[] {name, "rotten_" + name};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
|
||||
if (isInCreativeTab(tab)) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.item;
|
|||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
|
@ -15,8 +14,8 @@ public class UItemSlab extends ItemSlab {
|
|||
|
||||
private final Predicate<EntityPlayer> abilityTest;
|
||||
|
||||
public UItemSlab(Block block, BlockSlab singleSlab, BlockSlab doubleSlab, Predicate<EntityPlayer> abilityTest) {
|
||||
super(block, singleSlab, doubleSlab);
|
||||
public UItemSlab(BlockSlab singleSlab, BlockSlab doubleSlab, Predicate<EntityPlayer> abilityTest) {
|
||||
super(singleSlab, singleSlab, doubleSlab);
|
||||
|
||||
this.abilityTest = abilityTest;
|
||||
}
|
||||
|
@ -29,5 +28,4 @@ public class UItemSlab extends ItemSlab {
|
|||
|
||||
return super.canPlaceBlockOnSide(worldIn, pos, side, player, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@ class PlayerGravityDelegate implements IUpdatable<EntityPlayer>, IGravity, InbtS
|
|||
entity.motionZ += forward * MathHelper.cos(entity.rotationYaw * 0.017453292F);
|
||||
|
||||
if (ticksInAir > 0 && ticksInAir % 12 == 0) {
|
||||
entity.playSound(USounds.WING_FLAP, 0.1F, 1);
|
||||
entity.playSound(USounds.WING_FLAP, 0.5F, 1);
|
||||
}
|
||||
} else {
|
||||
if (ticksInAir != 0) {
|
||||
entity.playSound(USounds.WING_FLAP, 0.04F, 1);
|
||||
entity.playSound(USounds.WING_FLAP, 0.4F, 1);
|
||||
}
|
||||
|
||||
ticksInAir = 0;
|
||||
|
|
|
@ -77,6 +77,12 @@ item.alfalfa_seeds.name=Grain
|
|||
|
||||
item.cereal.name=Breakfast Cereal
|
||||
item.sugar_cereal.name=Boop 'o Roops
|
||||
item.daffodil_daisy_sandwich.name=Daffodil Daisy Sandwich
|
||||
item.hay_burger.name=Hay Burger
|
||||
item.hay_fries.name=Hay Fries
|
||||
item.salad.name=Salad
|
||||
item.wheat_worms.name=Wheat Worms
|
||||
item.apple_cider.name=Apple Cider
|
||||
|
||||
entity.racing_cloud.name=Bucking Bronco
|
||||
entity.construction_cloud.name=Construction Cloud
|
||||
|
@ -84,6 +90,11 @@ entity.cloud.name=Cloud
|
|||
entity.spell.name=Magic
|
||||
entity.spellbook.name=Spellbook
|
||||
|
||||
toxicity.safe.name=Safe
|
||||
toxicity.fair.name=Fair
|
||||
toxicity.severe.name=Toxic
|
||||
toxicity.lethal.name=Lethal
|
||||
|
||||
commands.race.success.self=Your race has been updated
|
||||
commands.race.success.otherself=%s changed race to %s
|
||||
commands.race.success.other=Changed %s's race to %s
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_cider"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/daffodil_daisy_sandwich"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/hay_burger"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/hay_fries"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/salad"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/wheat_worms"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue