Added "Apple Pie with Hoofprint" and adjust apple pie to be closer in line with farmer's delight's pies

This commit is contained in:
Sollace 2023-08-16 17:56:34 +01:00
parent 7d97224fc8
commit 7a5218dfe1
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
15 changed files with 88 additions and 50 deletions

View file

@ -1,6 +1,7 @@
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.*;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.util.SoundEmitter;
import net.minecraft.block.*;
@ -35,11 +36,11 @@ public class PieBlock extends Block implements Waterloggable {
private static final VoxelShape[] SHAPES;
static {
final int PIE_HEIGHT = 5;
final VoxelShape WEDGE = Block.createCuboidShape(1, 0, 1, 8, PIE_HEIGHT, 8);
final float OFFSET_AMOUNT = 7F/16F;
final int PIE_HEIGHT = 4;
final VoxelShape WEDGE = Block.createCuboidShape(2, 0, 2, 8, PIE_HEIGHT, 8);
final float OFFSET_AMOUNT = 6F/16F;
SHAPES = new VoxelShape[] {
Block.createCuboidShape(1, 0, 1, 15, PIE_HEIGHT, 15),
Block.createCuboidShape(2, 0, 2, 14, PIE_HEIGHT, 14),
VoxelShapes.union(WEDGE, WEDGE.offset(OFFSET_AMOUNT, 0, 0), WEDGE.offset(OFFSET_AMOUNT, 0, OFFSET_AMOUNT)),
VoxelShapes.union(WEDGE, WEDGE.offset(OFFSET_AMOUNT, 0, 0)),
WEDGE
@ -47,11 +48,15 @@ public class PieBlock extends Block implements Waterloggable {
}
private final ItemConvertible sliceItem;
private final ItemConvertible normalItem;
private final ItemConvertible stompedItem;
public PieBlock(Settings settings, ItemConvertible sliceItem) {
public PieBlock(Settings settings, ItemConvertible sliceItem, ItemConvertible normalItem, ItemConvertible stompedItem) {
super(settings);
setDefaultState(getDefaultState().with(STOMPED, false).with(WATERLOGGED, false));
this.sliceItem = sliceItem;
this.normalItem = normalItem;
this.stompedItem = stompedItem;
}
@Deprecated
@ -122,6 +127,11 @@ public class PieBlock extends Block implements Waterloggable {
}
}
@Override
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
return (state.get(STOMPED) ? stompedItem : normalItem).asItem().getDefaultStack();
}
@Override
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
if (state.get(STOMPED)) {
@ -179,7 +189,9 @@ public class PieBlock extends Block implements Waterloggable {
@Deprecated
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getDefaultState().with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);
return super.getDefaultState()
.with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER)
.with(STOMPED, ctx.getStack().isOf(UItems.APPLE_PIE_HOOF));
}
@Deprecated

View file

@ -7,9 +7,6 @@ import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
import com.minelittlepony.unicopia.server.world.UTreeGen;
import com.terraformersmc.terraform.boat.api.TerraformBoatType;
import com.terraformersmc.terraform.boat.api.TerraformBoatTypeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
@ -102,26 +99,30 @@ public interface UBlocks {
Block SOUR_APPLE = register("sour_apple", new FruitBlock(Settings.create().mapColor(MapColor.GREEN), Direction.DOWN, SOUR_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE));
Block SOUR_APPLE_SPROUT = register("sour_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SOUR_APPLE_SEEDS, () -> UTreeGen.SOUR_APPLE_TREE.sapling().map(Block::getDefaultState).get()));
Block APPLE_PIE = register("apple_pie", new PieBlock(Settings.create().solid().mapColor(MapColor.ORANGE).strength(0.5F).sounds(BlockSoundGroup.WET_GRASS).pistonBehavior(PistonBehavior.DESTROY), () -> UItems.APPLE_PIE_SLICE));
Block APPLE_PIE = register("apple_pie", new PieBlock(Settings.create().solid().mapColor(MapColor.ORANGE).strength(0.5F).sounds(BlockSoundGroup.WOOL).pistonBehavior(PistonBehavior.DESTROY),
() -> UItems.APPLE_PIE_SLICE,
() -> UItems.APPLE_PIE,
() -> UItems.APPLE_PIE_HOOF
));
SegmentedCropBlock OATS = register("oats", SegmentedCropBlock.create(11, 5, AbstractBlock.Settings.copy(Blocks.WHEAT), () -> UItems.OAT_SEEDS, null, () -> UBlocks.OATS_STEM));
SegmentedCropBlock OATS_STEM = register("oats_stem", OATS.createNext(5));
SegmentedCropBlock OATS_CROWN = register("oats_crown", OATS_STEM.createNext(5));
static <T extends Block> T register(String name, T item) {
private static <T extends Block> T register(String name, T item) {
return register(Unicopia.id(name), item);
}
static <T extends Block> T register(String name, T block, RegistryKey<ItemGroup> group) {
private static <T extends Block> T register(String name, T block, RegistryKey<ItemGroup> group) {
return register(Unicopia.id(name), block, group);
}
static <T extends Block> T register(Identifier id, T block, RegistryKey<ItemGroup> group) {
BlockItem.BLOCK_ITEMS.put(block, UItems.register(id, ItemGroupRegistry.register(new BlockItem(block, new Item.Settings()), group)));
ItemGroupRegistry.register(id, new BlockItem(block, new Item.Settings()), group);
return register(id, block);
}
static <T extends Block> T register(Identifier id, T block) {
private static <T extends Block> T register(Identifier id, T block) {
if (block instanceof TintedBlock) {
TintedBlock.REGISTRY.add(block);
}
@ -151,11 +152,5 @@ public interface UBlocks {
FlammableBlockRegistry.getDefaultInstance().add(BANANAS, 5, 20);
UBlockEntities.bootstrap();
Registry.register(TerraformBoatTypeRegistry.INSTANCE, Unicopia.id("palm"), new TerraformBoatType.Builder()
.planks(PALM_PLANKS.asItem())
.item(UItems.PALM_BOAT)
.build());
}
}

View file

@ -1,8 +1,5 @@
package com.minelittlepony.unicopia.item;
import java.util.ArrayList;
import java.util.List;
import com.minelittlepony.unicopia.*;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.block.UWoodTypes;
@ -12,6 +9,8 @@ import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
import com.minelittlepony.unicopia.item.group.UItemGroups;
import com.minelittlepony.unicopia.item.toxin.UFoodComponents;
import com.terraformersmc.terraform.boat.api.TerraformBoatType;
import com.terraformersmc.terraform.boat.api.TerraformBoatTypeRegistry;
import com.terraformersmc.terraform.boat.api.item.TerraformBoatItemHelper;
import net.minecraft.entity.vehicle.BoatEntity;
@ -21,16 +20,12 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.Registries;
public interface UItems {
List<Item> ITEMS = new ArrayList<>();
Item GREEN_APPLE = register("green_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
Item SWEET_APPLE = register("sweet_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
Item SOUR_APPLE = register("sour_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
@ -96,6 +91,7 @@ public interface UItems {
Item JUICE = register("juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.JUICE)), ItemGroups.FOOD_AND_DRINK);
Item BURNED_JUICE = register("burned_juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.BURNED_JUICE)), ItemGroups.FOOD_AND_DRINK);
Item APPLE_PIE = register("apple_pie", new BlockItem(UBlocks.APPLE_PIE, new Item.Settings().maxCount(1)), ItemGroups.FOOD_AND_DRINK);
Item APPLE_PIE_HOOF = register("apple_pie_hoof", new AliasedBlockItem(UBlocks.APPLE_PIE, new Item.Settings().maxCount(1)), ItemGroups.FOOD_AND_DRINK);
Item APPLE_PIE_SLICE = register("apple_pie_slice", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.PIE)), ItemGroups.FOOD_AND_DRINK);
Item LOVE_BOTTLE = register("love_bottle", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_BOTTLE).maxCount(1).recipeRemainder(Items.GLASS_BOTTLE)), ItemGroups.FOOD_AND_DRINK);
@ -157,21 +153,12 @@ public interface UItems {
Item BAT_BADGE = register(Race.BAT);
Item CHANGELING_BADGE = register(Race.CHANGELING);
static <T extends Item> T register(String name, T item, RegistryKey<ItemGroup> group) {
return ItemGroupRegistry.register(register(name, item), group);
private static <T extends Item> T register(String name, T item, RegistryKey<ItemGroup> group) {
return ItemGroupRegistry.register(Unicopia.id(name), item, group);
}
@Deprecated
static <T extends Item> T register(String name, T item) {
return register(Unicopia.id(name), item);
}
static <T extends Item> T register(Identifier id, T item) {
if (item instanceof BlockItem bi && bi.getBlock() == null) {
throw new NullPointerException("Registered block item did not have a block " + id);
}
ITEMS.add(item);
return Registry.register(Registries.ITEM, id, item);
private static <T extends Item> T register(String name, T item) {
return ItemGroupRegistry.register(Unicopia.id(name), item);
}
static MusicDiscItem register(String name, SoundEvent sound, int seconds) {
@ -221,5 +208,10 @@ public interface UItems {
UEnchantments.bootstrap();
URecipes.bootstrap();
UItemGroups.bootstrap();
Registry.register(TerraformBoatTypeRegistry.INSTANCE, Unicopia.id("palm"), new TerraformBoatType.Builder()
.planks(UBlocks.PALM_PLANKS.asItem())
.item(PALM_BOAT)
.build());
}
}

View file

@ -16,9 +16,11 @@ import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
public interface ItemGroupRegistry {
List<Item> ITEMS = new ArrayList<>();
Map<RegistryKey<ItemGroup>, Set<Item>> REGISTRY = new HashMap<>();
static List<ItemStack> getVariations(Item item) {
@ -33,6 +35,18 @@ public interface ItemGroupRegistry {
return item;
}
static <T extends Item> T register(Identifier id, T item, RegistryKey<ItemGroup> group) {
return register(register(id, item), group);
}
static <T extends Item> T register(Identifier id, T item) {
if (item instanceof BlockItem bi && bi.getBlock() == null) {
throw new NullPointerException("Registered block item did not have a block " + id);
}
ITEMS.add(item);
return Registry.register(Registries.ITEM, id, item);
}
static RegistryKey<ItemGroup> createDynamic(String name, Supplier<ItemStack> icon, Supplier<Stream<Item>> items) {
RegistryKey<ItemGroup> key = RegistryKey.of(RegistryKeys.ITEM_GROUP, Unicopia.id(name));
Registry.register(Registries.ITEM_GROUP, key.getValue(), FabricItemGroup.builder().entries((context, entries) -> {

View file

@ -13,7 +13,7 @@ import net.minecraft.registry.RegistryKey;
public interface UItemGroups {
RegistryKey<ItemGroup> ALL_ITEMS = ItemGroupRegistry.createDynamic("items", UItems.EMPTY_JAR::getDefaultStack, () -> {
return Stream.concat(Stream.of(Items.APPLE), UItems.ITEMS.stream()
return Stream.concat(Stream.of(Items.APPLE), ItemGroupRegistry.ITEMS.stream()
.filter(item -> !(item instanceof ChameleonItem) || ((ChameleonItem)item).isFullyDisguised()));
});
RegistryKey<ItemGroup> HORSE_FEED = ItemGroupRegistry.createDynamic("horsefeed", UItems.ZAP_APPLE::getDefaultStack, () -> {

View file

@ -103,6 +103,7 @@
"item.unicopia.green_apple_seeds": "Granny Smith Apple Seeds",
"item.unicopia.sweet_apple_seeds": "Sweet Apple Seeds",
"item.unicopia.sour_apple_seeds": "Sour Apple Seeds",
"item.unicopia.apple_pie_hoof": "Apple Pie with a Hoofprint",
"item.unicopia.apple_pie_slice": "Slice Of Apple Pie",
"item.unicopia.oats": "Oats",

View file

@ -3,8 +3,8 @@
"particle": "#top"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 8, 5, 8 ],
{ "from": [ 2, 0, 2 ],
"to": [ 8, 4, 8 ],
"faces": {
"up": { "uv": [ 1, 1, 8, 8 ], "texture": "#top" },
"down": { "uv": [ 1, 8, 8, 15 ], "texture": "#bottom" },

View file

@ -3,8 +3,8 @@
"particle": "#top"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 5, 8 ],
{ "from": [ 2, 0, 2 ],
"to": [ 14, 4, 8 ],
"faces": {
"up": { "uv": [ 1, 1, 15, 8 ], "texture": "#top" },
"down": { "uv": [ 1, 8, 15, 15 ], "texture": "#bottom" },
@ -15,7 +15,7 @@
}
},
{ "from": [ 8, 0, 8 ],
"to": [ 15, 5, 15 ],
"to": [ 14, 4, 14 ],
"faces": {
"up": { "uv": [ 8, 8, 15, 15 ], "texture": "#top" },
"down": { "uv": [ 8, 1, 15, 8 ], "texture": "#bottom" },

View file

@ -3,8 +3,8 @@
"particle": "#top"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 5, 15 ],
{ "from": [ 2, 0, 2 ],
"to": [ 14, 4, 14 ],
"faces": {
"up": { "uv": [ 1, 1, 15, 15 ], "texture": "#top" },
"down": { "uv": [ 1, 1, 15, 15 ], "texture": "#bottom" },

View file

@ -3,8 +3,8 @@
"particle": "#top"
},
"elements": [
{ "from": [ 1, 0, 1 ],
"to": [ 15, 5, 8 ],
{ "from": [ 2, 0, 2 ],
"to": [ 14, 4, 8 ],
"faces": {
"up": { "uv": [ 1, 1, 15, 8 ], "texture": "#top" },
"down": { "uv": [ 1, 8, 15, 15 ], "texture": "#bottom" },

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "unicopia:item/apple_pie_hoof"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

View file

@ -0,0 +1,9 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{ "item": "farmersdelight:apple_pie" }
],
"result": {
"item": "unicopia:apple_pie"
}
}

View file

@ -0,0 +1,9 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{ "item": "unicopia:apple_pie" }
],
"result": {
"item": "farmersdelight:apple_pie"
}
}