mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-01-31 19:16:44 +01:00
Added baited fishing rod
This commit is contained in:
parent
101a560a01
commit
6b3b5c7c86
9 changed files with 61 additions and 4 deletions
|
@ -19,7 +19,7 @@ public interface UConventionalTags {
|
|||
TagKey<Item> MUSHROOMS = item("mushrooms");
|
||||
TagKey<Item> MUFFINS = item("muffins");
|
||||
TagKey<Item> MANGOES = item("mangoes");
|
||||
TagKey<Item> OEATMEALS = item("oatmeals");
|
||||
TagKey<Item> OATMEALS = item("oatmeals");
|
||||
|
||||
TagKey<Item> FRUITS = item("fruits");
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
|||
getOrCreateTagBuilder(UConventionalTags.SEEDS).add(Items.BEETROOT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.TORCHFLOWER_SEEDS, Items.WHEAT_SEEDS)
|
||||
.add(UItems.OAT_SEEDS)
|
||||
.forceAddTag(UTags.APPLE_SEEDS);
|
||||
getOrCreateTagBuilder(UConventionalTags.OEATMEALS).add(UItems.OATMEAL);
|
||||
getOrCreateTagBuilder(UConventionalTags.OATMEALS).add(UItems.OATMEAL);
|
||||
getOrCreateTagBuilder(UConventionalTags.GRAIN).add(Items.WHEAT, UItems.OATS);
|
||||
getOrCreateTagBuilder(UConventionalTags.NUTS).addOptionalTag(UConventionalTags.CROPS_PEANUTS);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.Items;
|
|||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.data.client.ItemModelGenerator;
|
||||
import net.minecraft.data.client.ModelIds;
|
||||
import net.minecraft.data.client.Models;
|
||||
import net.minecraft.data.client.TextureKey;
|
||||
import net.minecraft.data.client.TextureMap;
|
||||
|
||||
|
@ -133,5 +134,8 @@ public class UModelProvider extends FabricModelProvider {
|
|||
.addOverride(ModelIds.getItemSubModelId(UItems.GEMSTONE, "_pure"), "affinity", 0)
|
||||
.addOverride(ModelIds.getItemSubModelId(UItems.GEMSTONE, "_corrupted"), "affinity", 1)
|
||||
.upload(UItems.GEMSTONE, itemModelGenerator);
|
||||
|
||||
// fishing rod
|
||||
ItemModels.register(itemModelGenerator, Models.HANDHELD_ROD, UItems.BAITED_FISHING_ROD);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,13 @@ public class URecipeProvider extends FabricRecipeProvider {
|
|||
.input(ConventionalItemTags.GLASS_BLOCKS)
|
||||
.input(UItems.SUNGLASSES).criterion("has_broken_sunglasses", conditionsFromItem(UItems.BROKEN_SUNGLASSES))
|
||||
.offerTo(exporter, convertBetween(UItems.SUNGLASSES, UItems.BROKEN_SUNGLASSES));
|
||||
|
||||
// fishing
|
||||
ShapelessRecipeJsonBuilder.create(RecipeCategory.TOOLS, UItems.BAITED_FISHING_ROD)
|
||||
.input(Items.FISHING_ROD).criterion(hasItem(Items.FISHING_ROD), conditionsFromItem(Items.FISHING_ROD))
|
||||
.input(UItems.WHEAT_WORMS)
|
||||
.group("fishing_rod")
|
||||
.offerTo(exporter);
|
||||
}
|
||||
|
||||
private void generateVanillaRecipeExtensions(Consumer<RecipeJsonProvider> exporter) {
|
||||
|
|
|
@ -30,29 +30,34 @@ public interface UEntities {
|
|||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||
EntityType<MagicProjectileEntity> THROWN_ITEM = register("thrown_item", FabricEntityTypeBuilder.<MagicProjectileEntity>create(SpawnGroup.MISC, MagicProjectileEntity::new)
|
||||
.trackRangeBlocks(100)
|
||||
.disableSummon()
|
||||
.trackedUpdateRate(2)
|
||||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||
EntityType<PhysicsBodyProjectileEntity> MUFFIN = register("muffin", FabricEntityTypeBuilder.<PhysicsBodyProjectileEntity>create(SpawnGroup.MISC, PhysicsBodyProjectileEntity::new)
|
||||
.trackRangeBlocks(100)
|
||||
.disableSummon()
|
||||
.trackedUpdateRate(2)
|
||||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||
EntityType<MagicBeamEntity> MAGIC_BEAM = register("magic_beam", FabricEntityTypeBuilder.<MagicBeamEntity>create(SpawnGroup.MISC, MagicBeamEntity::new)
|
||||
.trackRangeBlocks(100)
|
||||
.disableSummon()
|
||||
.trackedUpdateRate(2)
|
||||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||
EntityType<FloatingArtefactEntity> FLOATING_ARTEFACT = register("floating_artefact", FabricEntityTypeBuilder.create(SpawnGroup.MISC, FloatingArtefactEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.disableSummon()
|
||||
.dimensions(EntityDimensions.fixed(1, 1)));
|
||||
EntityType<CastSpellEntity> CAST_SPELL = register("cast_spell", FabricEntityTypeBuilder.create(SpawnGroup.MISC, CastSpellEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.disableSummon()
|
||||
.dimensions(EntityDimensions.changing(4, 4)));
|
||||
EntityType<FairyEntity> TWITTERMITE = register("twittermite", FabricEntityTypeBuilder.create(SpawnGroup.MISC, FairyEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.dimensions(EntityDimensions.fixed(0.1F, 0.1F)));
|
||||
EntityType<FriendlyCreeperEntity> FRIENDLY_CREEPER = register("friendly_creeper", FabricEntityTypeBuilder.create(SpawnGroup.MISC, FriendlyCreeperEntity::new)
|
||||
.trackRangeChunks(8)
|
||||
.dimensions(EntityDimensions.fixed(0.6f, 1.7f))
|
||||
);
|
||||
.disableSummon()
|
||||
.dimensions(EntityDimensions.fixed(0.6f, 1.7f)));
|
||||
EntityType<SpellbookEntity> SPELLBOOK = register("spellbook", FabricEntityTypeBuilder.create(SpawnGroup.MISC, SpellbookEntity::new)
|
||||
.trackRangeBlocks(200)
|
||||
.dimensions(EntityDimensions.fixed(0.9F, 0.5F)));
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.FishingBobberEntity;
|
||||
import net.minecraft.item.FishingRodItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BaitedFishingRodItem extends FishingRodItem {
|
||||
|
||||
public BaitedFishingRodItem(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
TypedActionResult<ItemStack> result = super.use(world, user, hand);
|
||||
if (!world.isClient) {
|
||||
if (user.fishHook != null) {
|
||||
user.fishHook.discard();
|
||||
ItemStack stack = user.getStackInHand(hand);
|
||||
int lure = (EnchantmentHelper.getLure(stack) + 1) * 2;
|
||||
int luck = (EnchantmentHelper.getLuckOfTheSea(stack) + 1) * 2;
|
||||
world.spawnEntity(new FishingBobberEntity(user, world, luck, lure));
|
||||
}
|
||||
|
||||
if (result.getValue().isOf(this)) {
|
||||
ItemStack stack = Items.FISHING_ROD.getDefaultStack();
|
||||
stack.setDamage(result.getValue().getDamage());
|
||||
return TypedActionResult.success(stack, world.isClient());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -89,6 +89,7 @@ public interface UItems {
|
|||
Item HORSE_SHOE_FRIES = register("horse_shoe_fries", new Item(new Item.Settings().maxCount(32).food(UFoodComponents.HAY_FRIES)), ItemGroups.FOOD_AND_DRINK);
|
||||
|
||||
Item WHEAT_WORMS = register("wheat_worms", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.WORMS)), ItemGroups.NATURAL);
|
||||
Item BAITED_FISHING_ROD = register("baited_fishing_rod", new BaitedFishingRodItem(new Item.Settings().maxDamage(64)), ItemGroups.TOOLS);
|
||||
Item MUFFIN = register("muffin", new MuffinItem(new Item.Settings().maxCount(32).food(FoodComponents.BREAD), 0), ItemGroups.FOOD_AND_DRINK);
|
||||
Item PINECONE = register("pinecone", new ForageableItem(new Item.Settings().food(UFoodComponents.PINECONE).maxCount(16), () -> Blocks.SPRUCE_LEAVES), ItemGroups.FOOD_AND_DRINK);
|
||||
Item ACORN = register("acorn", new ForageableItem(new Item.Settings().food(UFoodComponents.ACORN).maxCount(16), () -> Blocks.OAK_LEAVES), ItemGroups.FOOD_AND_DRINK);
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
"item.unicopia.crispy_hay_fries": "Crispy Hay Fries",
|
||||
"item.unicopia.horse_shoe_fries": "Horse Shoe Fries",
|
||||
"item.unicopia.wheat_worms": "Wheat Worms",
|
||||
"item.unicopia.baited_fishing_rod": "Baited Fishing Rod",
|
||||
"item.unicopia.muffin": "Muffin",
|
||||
"item.unicopia.oatmeal_cookie": "Oatmeal Cookie",
|
||||
"item.unicopia.pinecone_cookie": "Pinecone Cookie",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Loading…
Reference in a new issue