Added oats, fancy imported oats, and oatmeal

This commit is contained in:
Sollace 2022-09-28 22:43:45 +02:00
parent 1b6ca1ad46
commit 9a614313b8
67 changed files with 765 additions and 24 deletions

BIN
oats_guide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -17,6 +17,8 @@ public interface UCriteria {
CustomEventCriterion.Trigger SCREECH_TWENTY_MOBS = CUSTOM_EVENT.createTrigger("screech_twenty_mobs"); CustomEventCriterion.Trigger SCREECH_TWENTY_MOBS = CUSTOM_EVENT.createTrigger("screech_twenty_mobs");
CustomEventCriterion.Trigger SHED_FEATHER = CUSTOM_EVENT.createTrigger("shed_feather"); CustomEventCriterion.Trigger SHED_FEATHER = CUSTOM_EVENT.createTrigger("shed_feather");
CustomEventCriterion.Trigger THROW_MUFFIN = CUSTOM_EVENT.createTrigger("throw_muffin"); CustomEventCriterion.Trigger THROW_MUFFIN = CUSTOM_EVENT.createTrigger("throw_muffin");
CustomEventCriterion.Trigger SEND_OATS = CUSTOM_EVENT.createTrigger("send_oats");
CustomEventCriterion.Trigger RECEIVE_OATS = CUSTOM_EVENT.createTrigger("receive_oats");
private static <T extends Criterion<?>> T register(T obj) { private static <T extends Criterion<?>> T register(T obj) {
return MixinCriteria.register(obj); return MixinCriteria.register(obj);

View file

@ -0,0 +1,63 @@
package com.minelittlepony.unicopia.block;
import java.util.Arrays;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
public interface SegmentedBlock {
double[] STAGE_SIZES = new double[] {3.2, 6.4, 9.6, 12.8, 16};
VoxelShape[] STAGE_SHAPES = Arrays.stream(STAGE_SIZES).mapToObj(height -> {
return Block.createCuboidShape(0, 0, 0, 16, height, 16);
}).toArray(VoxelShape[]::new);
static VoxelShape getShape(int age) {
if (age < 0 || age >= STAGE_SHAPES.length) {
return VoxelShapes.fullCube();
}
return STAGE_SHAPES[age];
}
static double getHeight(int age) {
if (age < 0 || age >= STAGE_SHAPES.length) {
return 16;
}
return STAGE_SIZES[age];
}
static VoxelShape[] computeShapes(int maxHeight) {
VoxelShape[] shapes = new VoxelShape[STAGE_SIZES.length * maxHeight];
for (int i = 0; i < maxHeight; i++) {
for (int j = 0; j < STAGE_SIZES.length; j++) {
shapes[j + (i * STAGE_SIZES.length)] = Block.createCuboidShape(0, 0, 0, 16, STAGE_SIZES[j] + (i * 16), 16);
}
}
return shapes;
}
boolean isBase(BlockState state);
boolean isNext(BlockState state);
default BlockPos getTip(BlockView world, BlockPos startingPos) {
while (isNext(world.getBlockState(startingPos.up())) && !world.isOutOfHeightLimit(startingPos)) {
startingPos = startingPos.up();
}
return startingPos;
}
default BlockPos getRoot(BlockView world, BlockPos startingPos) {
while (isBase(world.getBlockState(startingPos.down())) && !world.isOutOfHeightLimit(startingPos)) {
startingPos = startingPos.down();
}
return startingPos;
}
}

View file

@ -0,0 +1,170 @@
package com.minelittlepony.unicopia.block;
import java.util.function.Supplier;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.*;
import net.minecraft.item.ItemConvertible;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.*;
public class SegmentedCropBlock extends CropBlock implements SegmentedBlock {
private final ItemConvertible seeds;
@Nullable
private final Supplier<SegmentedCropBlock> prevSegmentSupplier;
@Nullable
private Supplier<SegmentedCropBlock> nextSegmentSupplier;
private final int progressionAge;
public static SegmentedCropBlock create(final int maxAge, int progressionAge, Block.Settings settings,
ItemConvertible seeds,
@Nullable Supplier<SegmentedCropBlock> prevSegmentSupplier,
@Nullable Supplier<SegmentedCropBlock> nextSegmentSupplier) {
final IntProperty age = IntProperty.of("age", 0, maxAge);
return new SegmentedCropBlock(progressionAge, settings, seeds, prevSegmentSupplier, nextSegmentSupplier) {
@Override
public IntProperty getAgeProperty() {
return age;
}
@Override
public int getMaxAge() {
return maxAge;
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(age);
}
};
}
protected SegmentedCropBlock(int progressionAge, Block.Settings settings,
ItemConvertible seeds,
@Nullable Supplier<SegmentedCropBlock> prevSegmentSupplier,
@Nullable Supplier<SegmentedCropBlock> nextSegmentSupplier) {
super(settings);
this.seeds = seeds;
this.prevSegmentSupplier = prevSegmentSupplier;
this.nextSegmentSupplier = nextSegmentSupplier;
this.progressionAge = progressionAge;
}
public SegmentedCropBlock createNext(int progressionAge) {
SegmentedCropBlock next = create(getMaxAge() - this.progressionAge, progressionAge, Settings.copy(this), seeds, () -> this, null);
nextSegmentSupplier = () -> next;
return next;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
BlockPos tip = getTip(world, pos);
BlockPos root = getRoot(world, pos);
int height = (tip.getY() - root.getY());
BlockState tipState = world.getBlockState(tip);
double tipHeight = SegmentedBlock.getHeight(((SegmentedCropBlock)tipState.getBlock()).getAge(tipState));
double offset = (root.getY() - pos.getY()) * 16;
return Block.createCuboidShape(0, offset, 0, 16, height * 16 + tipHeight + offset, 16);
}
@Override
public ItemConvertible getSeedsItem() {
return seeds;
}
@Override
protected boolean canPlantOnTop(BlockState state, BlockView view, BlockPos pos) {
return (state.getBlock() instanceof SegmentedCropBlock o && o.canSupportBlock(this, state, view, pos)) || super.canPlantOnTop(state, view, pos);
}
protected boolean canSupportBlock(Block other, BlockState state, BlockView view, BlockPos pos) {
return (nextSegmentSupplier != null && nextSegmentSupplier.get() == other);
}
@Override
public void applyGrowth(World world, BlockPos pos, BlockState state) {
super.applyGrowth(world, pos, state);
propagateGrowth(world, pos, state);
}
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
super.randomTick(state, world, pos, random);
propagateGrowth(world, pos, state);
}
private void propagateGrowth(World world, BlockPos pos, BlockState state) {
int oldAge = getAge(state);
state = world.getBlockState(pos);
int ageChange = getAge(state) - oldAge;
if (ageChange <= 0) {
return;
}
onGrown(world, pos, state, ageChange);
BlockPos root = getRoot(world, pos);
BlockPos tip = getTip(world, pos);
for (BlockPos p : BlockPos.iterate(root, tip)) {
if (p.getY() == pos.getY()) {
continue;
}
BlockState s = world.getBlockState(p);
if (s.getBlock() instanceof SegmentedCropBlock segment) {
int segAge = Math.min(segment.getAge(s) + ageChange, segment.getMaxAge());
world.setBlockState(p, s.with(segment.getAgeProperty(), segAge));
segment.onGrown(world, p, s, ageChange);
}
}
}
private void onGrown(World world, BlockPos pos, BlockState state, int ageChange) {
if (nextSegmentSupplier != null && getAge(state) >= progressionAge && world.isAir(pos.up())) {
SegmentedCropBlock nxt = nextSegmentSupplier.get();
world.setBlockState(pos.up(), nxt.withAge(Math.min(ageChange, nxt.getMaxAge())), Block.NOTIFY_LISTENERS);
}
}
@Override
public boolean hasRandomTicks(BlockState state) {
return super.hasRandomTicks(state) || nextSegmentSupplier != null;
}
@Override
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
return super.isFertilizable(world, pos, state, isClient) || (nextSegmentSupplier != null && isNext(world.getBlockState(pos.up())));
}
@Override
protected int getGrowthAmount(World world) {
return super.getGrowthAmount(world) / 2;
}
@Override
public boolean isBase(BlockState state) {
return state.getBlock() == this || (prevSegmentSupplier != null && prevSegmentSupplier.get().isBase(state));
}
@Override
public boolean isNext(BlockState state) {
return state.getBlock() == this || (nextSegmentSupplier != null && nextSegmentSupplier.get().isNext(state));
}
}

View file

@ -66,6 +66,10 @@ public interface UBlocks {
Block SOUR_APPLE = register("sour_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, SOUR_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE)); Block SOUR_APPLE = register("sour_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), 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 SOUR_APPLE_SPROUT = register("sour_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SOUR_APPLE_SEEDS, () -> UTreeGen.SOUR_APPLE_TREE.sapling().map(Block::getDefaultState).get()));
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) { static <T extends Block> T register(String name, T item) {
return register(Unicopia.id(name), item); return register(Unicopia.id(name), item);
} }
@ -83,7 +87,7 @@ public interface UBlocks {
if (block instanceof TintedBlock) { if (block instanceof TintedBlock) {
TintedBlock.REGISTRY.add(block); TintedBlock.REGISTRY.add(block);
} }
if (block instanceof SaplingBlock || block instanceof SproutBlock || block instanceof FruitBlock) { if (block instanceof SaplingBlock || block instanceof SproutBlock || block instanceof FruitBlock || block instanceof CropBlock) {
TRANSLUCENT_BLOCKS.add(block); TRANSLUCENT_BLOCKS.add(block);
} }
return Registry.register(Registry.BLOCK, id, block); return Registry.register(Registry.BLOCK, id, block);

View file

@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.block.data;
import java.util.*; import java.util.*;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.item.UItems;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*; import net.minecraft.nbt.*;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -79,6 +81,15 @@ public class DragonBreathStore extends PersistentState {
} }
public void put(String recipient, ItemStack payload) { public void put(String recipient, ItemStack payload) {
if (payload.getItem() == UItems.OATS) {
ItemStack oats = UItems.IMPORTED_OATS.getDefaultStack();
oats.setNbt(payload.getNbt());
oats.setCount(payload.getCount());
put(recipient, oats);
return;
}
synchronized (locker) { synchronized (locker) {
doPurge(); doPurge();
if (peekEntries(recipient).stream().noneMatch(i -> { if (peekEntries(recipient).stream().noneMatch(i -> {

View file

@ -70,8 +70,6 @@ public class GlassesFeatureRenderer<E extends LivingEntity> implements Accessory
public void setAngles(LivingEntity entity, BipedEntityModel<?> biped) { public void setAngles(LivingEntity entity, BipedEntityModel<?> biped) {
root.getChild(EntityModelPartNames.HEAD).copyTransform(biped.head); root.getChild(EntityModelPartNames.HEAD).copyTransform(biped.head);
root.getChild(EntityModelPartNames.HAT).copyTransform(biped.hat); root.getChild(EntityModelPartNames.HAT).copyTransform(biped.hat);
root.getChild(EntityModelPartNames.HAT).resetTransform();
} }
@Override @Override

View file

@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.ability.magic.SpellContainer;
import com.minelittlepony.unicopia.ability.magic.SpellPredicate; import com.minelittlepony.unicopia.ability.magic.SpellPredicate;
import com.minelittlepony.unicopia.ability.magic.SpellContainer.Operation; import com.minelittlepony.unicopia.ability.magic.SpellContainer.Operation;
import com.minelittlepony.unicopia.ability.magic.spell.Situation; import com.minelittlepony.unicopia.ability.magic.spell.Situation;
import com.minelittlepony.unicopia.advancement.UCriteria;
import com.minelittlepony.unicopia.block.data.DragonBreathStore; import com.minelittlepony.unicopia.block.data.DragonBreathStore;
import com.minelittlepony.unicopia.item.GlassesItem; import com.minelittlepony.unicopia.item.GlassesItem;
import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.item.UItems;
@ -143,6 +144,10 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
item.setPosition(randomPos); item.setPosition(randomPos);
item.world.spawnEntity(item); item.world.spawnEntity(item);
entity.world.playSoundFromEntity(null, entity, SoundEvents.ITEM_FIRECHARGE_USE, entity.getSoundCategory(), 1, 1); entity.world.playSoundFromEntity(null, entity, SoundEvents.ITEM_FIRECHARGE_USE, entity.getSoundCategory(), 1, 1);
if (stack.payload().getItem() == UItems.OATS && entity instanceof PlayerEntity player) {
UCriteria.RECEIVE_OATS.trigger(player);
}
}); });
} }
} }

View file

@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.item;
import java.util.UUID; import java.util.UUID;
import com.minelittlepony.unicopia.advancement.UCriteria;
import com.minelittlepony.unicopia.block.data.DragonBreathStore; import com.minelittlepony.unicopia.block.data.DragonBreathStore;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -29,6 +30,9 @@ public class DragonBreathScrollItem extends Item {
stack.split(1); stack.split(1);
if (!world.isClient) { if (!world.isClient) {
if (payload.getItem() == UItems.OATS) {
UCriteria.SEND_OATS.trigger(player);
}
DragonBreathStore.get(world).put(stack.getName().getString(), payload.split(1)); DragonBreathStore.get(world).put(stack.getName().getString(), payload.split(1));
} }
player.playSound(SoundEvents.ITEM_FIRECHARGE_USE, 1, 1); player.playSound(SoundEvents.ITEM_FIRECHARGE_USE, 1, 1);

View file

@ -0,0 +1,21 @@
package com.minelittlepony.unicopia.item;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.StewItem;
import net.minecraft.world.World;
public class OatmealItem extends StewItem {
public OatmealItem(Settings settings) {
super(settings);
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (!world.isClient) {
user.clearStatusEffects();
}
return super.finishUsing(stack, world, user);
}
}

View file

@ -9,8 +9,6 @@ import com.minelittlepony.unicopia.entity.UEntities;
import com.minelittlepony.unicopia.item.enchantment.UEnchantments; import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
import com.minelittlepony.unicopia.item.toxin.UFoodComponents; import com.minelittlepony.unicopia.item.toxin.UFoodComponents;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.item.Item.Settings; import net.minecraft.item.Item.Settings;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
@ -29,14 +27,7 @@ public interface UItems {
Item SOUR_APPLE = register("sour_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE)))); Item SOUR_APPLE = register("sour_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE))));
ZapAppleItem ZAP_APPLE = register("zap_apple", AppleItem.registerTickCallback(new ZapAppleItem(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.ZAP_APPLE)))); ZapAppleItem ZAP_APPLE = register("zap_apple", AppleItem.registerTickCallback(new ZapAppleItem(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.ZAP_APPLE))));
Item ZAP_BULB = register("zap_bulb", new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder() Item ZAP_BULB = register("zap_bulb", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.ZAP_BULB)));
.hunger(-2)
.saturationModifier(-0.8f)
.alwaysEdible()
.statusEffect(new StatusEffectInstance(StatusEffects.POISON, 100, 0), 0.6F)
.statusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100, 0), 0.6F)
.statusEffect(new StatusEffectInstance(StatusEffects.BAD_OMEN, 100, 0), 0.6F)
.build())));
Item ROTTEN_APPLE = register("rotten_apple", new RottenAppleItem(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE))); Item ROTTEN_APPLE = register("rotten_apple", new RottenAppleItem(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE)));
Item COOKED_ZAP_APPLE = register("cooked_zap_apple", new Item(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE))); Item COOKED_ZAP_APPLE = register("cooked_zap_apple", new Item(new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.APPLE)));
@ -68,6 +59,11 @@ public interface UItems {
Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS))); Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS))); Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
Item OAT_SEEDS = register("oat_seeds", new AliasedBlockItem(UBlocks.OATS, new Item.Settings().group(ItemGroup.MATERIALS)));
Item OATS = register("oats", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.OATS)));
Item IMPORTED_OATS = register("imported_oats", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.IMPORTED_OATS)));
Item OATMEAL = register("oatmeal", new OatmealItem(new Item.Settings().recipeRemainder(Items.BOWL).maxCount(1).group(ItemGroup.FOOD).food(UFoodComponents.OATMEAL)));
Item DAFFODIL_DAISY_SANDWICH = register("daffodil_daisy_sandwich", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.DAFODIL_DAISY_SANDWICH))); Item DAFFODIL_DAISY_SANDWICH = register("daffodil_daisy_sandwich", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.DAFODIL_DAISY_SANDWICH)));
Item HAY_BURGER = register("hay_burger", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(1).food(UFoodComponents.HAY_BURGER))); Item HAY_BURGER = register("hay_burger", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(1).food(UFoodComponents.HAY_BURGER)));
Item HAY_FRIES = register("hay_fries", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(16).food(UFoodComponents.HAY_FRIES))); Item HAY_FRIES = register("hay_fries", new Item(new Item.Settings().group(ItemGroup.FOOD).maxCount(16).food(UFoodComponents.HAY_FRIES)));

View file

@ -1,20 +1,22 @@
package com.minelittlepony.unicopia.item.toxin; package com.minelittlepony.unicopia.item.toxin;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.FoodComponent; import net.minecraft.item.FoodComponent;
public interface UFoodComponents { public interface UFoodComponents {
FoodComponent OATS = builder(1, 0.7F).build();
FoodComponent BAD_TOMATO = builder(3, 14).build(); FoodComponent IMPORTED_OATS = builder(3, 1.3F).build();
FoodComponent TOMATO = builder(4, 13).build(); FoodComponent OATMEAL = builder(0, 1.3F)
FoodComponent GOOD_TOMATO = builder(6, 14).build(); .statusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 1200, 1), 1)
.statusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 1200, 1), 0.3F)
FoodComponent ALFALFA_SEEDS = builder(1, 4).build(); .statusEffect(new StatusEffectInstance(StatusEffects.SPEED, 1200, 1), 0.2F)
FoodComponent ALFALFA_LEAVES = builder(1, 3).build(); .build();
FoodComponent DAFODIL_DAISY_SANDWICH = builder(3, 2).build(); FoodComponent DAFODIL_DAISY_SANDWICH = builder(3, 2).build();
FoodComponent HAY_BURGER = builder(3, 4).build(); FoodComponent HAY_BURGER = builder(7, 1.4F).build();
FoodComponent HAY_FRIES = builder(1, 5).build(); FoodComponent HAY_FRIES = builder(4, 2).build();
FoodComponent SALAD = builder(4, 2).build(); FoodComponent SALAD = builder(3, 1).build();
FoodComponent CIDER = builder(4, 2).alwaysEdible().build(); FoodComponent CIDER = builder(2, 1.7F).alwaysEdible().build();
FoodComponent JUICE = builder(2, 2).alwaysEdible().build(); FoodComponent JUICE = builder(2, 2).alwaysEdible().build();
FoodComponent BURNED_JUICE = builder(3, 1).build(); FoodComponent BURNED_JUICE = builder(3, 1).build();
@ -26,6 +28,12 @@ public interface UFoodComponents {
FoodComponent SUGAR = builder(20, -2).build(); FoodComponent SUGAR = builder(20, -2).build();
FoodComponent ZAP_APPLE = builder(4, 0.3F).alwaysEdible().snack().build(); FoodComponent ZAP_APPLE = builder(4, 0.3F).alwaysEdible().snack().build();
FoodComponent ZAP_BULB = builder(-2, -0.8f)
.alwaysEdible()
.statusEffect(new StatusEffectInstance(StatusEffects.POISON, 100, 0), 0.6F)
.statusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100, 0), 0.6F)
.statusEffect(new StatusEffectInstance(StatusEffects.BAD_OMEN, 100, 0), 0.6F)
.build();
static FoodComponent.Builder builder(int hunger, float saturation) { static FoodComponent.Builder builder(int hunger, float saturation) {
return new FoodComponent.Builder() return new FoodComponent.Builder()

View file

@ -0,0 +1,16 @@
{
"variants": {
"age=0": { "model": "unicopia:block/oats_stage0" },
"age=1": { "model": "unicopia:block/oats_stage1" },
"age=2": { "model": "unicopia:block/oats_stage2" },
"age=3": { "model": "unicopia:block/oats_stage3" },
"age=4": { "model": "unicopia:block/oats_stage4" },
"age=5": { "model": "unicopia:block/oats_stage5_lower" },
"age=6": { "model": "unicopia:block/oats_stage6_lower" },
"age=7": { "model": "unicopia:block/oats_stage7_lower" },
"age=8": { "model": "unicopia:block/oats_stage8_lower" },
"age=9": { "model": "unicopia:block/oats_stage9_lower" },
"age=10": { "model": "unicopia:block/oats_stage9_lower" },
"age=11": { "model": "unicopia:block/oats_stage9_lower" }
}
}

View file

@ -0,0 +1,6 @@
{
"variants": {
"age=0": { "model": "unicopia:block/oats_stage10_upper" },
"age=1": { "model": "unicopia:block/oats_stage11_upper" }
}
}

View file

@ -0,0 +1,11 @@
{
"variants": {
"age=0": { "model": "unicopia:block/oats_stage5_upper" },
"age=1": { "model": "unicopia:block/oats_stage6_upper" },
"age=2": { "model": "unicopia:block/oats_stage7_upper" },
"age=3": { "model": "unicopia:block/oats_stage8_upper" },
"age=4": { "model": "unicopia:block/oats_stage9_upper" },
"age=5": { "model": "unicopia:block/oats_stage10_lower" },
"age=6": { "model": "unicopia:block/oats_stage9_lower" }
}
}

View file

@ -62,7 +62,12 @@
"item.unicopia.rock_stew": "Rock Stew", "item.unicopia.rock_stew": "Rock Stew",
"item.unicopia.green_apple_seeds": "Granny Smith Apple Seeds", "item.unicopia.green_apple_seeds": "Granny Smith Apple Seeds",
"item.unicopia.sweet_apple_seeds": "Sweet Apple Seeds", "item.unicopia.sweet_apple_seeds": "Sweet Apple Seeds",
"item.unicopia.sour_apple_seeds": "Sour Apple Seeds",
"item.unicopia.oats": "Oats",
"item.unicopia.imported_oats": "Fancy Imported Oats",
"item.unicopia.oatmeal": "Oatmeal",
"item.unicopia.oat_seeds": "Oat Seeds",
"item.unicopia.daffodil_daisy_sandwich": "Daffodil Daisy Sandwich", "item.unicopia.daffodil_daisy_sandwich": "Daffodil Daisy Sandwich",
"item.unicopia.hay_burger": "Hay Burger", "item.unicopia.hay_burger": "Hay Burger",
"item.unicopia.hay_fries": "Hay Fries", "item.unicopia.hay_fries": "Hay Fries",
@ -108,6 +113,11 @@
"block.unicopia.sweet_apple_leaves": "Sweet Apple Leaves", "block.unicopia.sweet_apple_leaves": "Sweet Apple Leaves",
"block.unicopia.sweet_apple_sapling": "Sweet Apple Sapling", "block.unicopia.sweet_apple_sapling": "Sweet Apple Sapling",
"block.unicopia.sweet_apple_sprout": "Sweet Apple Sprout", "block.unicopia.sweet_apple_sprout": "Sweet Apple Sprout",
"block.unicopia.sour_apple_leaves": "Sour Apple Leaves",
"block.unicopia.sour_apple_sapling": "Sour Apple Sapling",
"block.unicopia.sour_apple_sprout": "Sour Apple Sprout",
"block.unicopia.oats": "Oats",
"entity.unicopia.butterfly": "Butterfly", "entity.unicopia.butterfly": "Butterfly",
"entity.unicopia.twittermite": "Twittermite", "entity.unicopia.twittermite": "Twittermite",

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage0"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage1"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage10_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage10_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage11_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage11_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage2"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage3"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage4"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage5_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage5_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage6_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage6_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage7_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage7_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage8_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage8_upper"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage9_lower"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/crop",
"textures": {
"crop": "unicopia:block/oats_stage9_upper"
}
}

View file

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

View file

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

View file

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

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,30 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"unicopia:oatmeal"
]
},
"criteria": {
"has_ingredients": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{ "tag": "unicopia:oats" }
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "unicopia:oatmeal"
}
}
},
"requirements": [
[
"has_ingredients",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,68 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "unicopia:oats",
"condition": "minecraft:block_state_property",
"properties": {
"age": "11"
}
}
],
"name": "unicopia:oats"
},
{
"type": "minecraft:item",
"name": "unicopia:oat_seeds"
}
]
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:oats",
"condition": "minecraft:block_state_property",
"properties": {
"age": "11"
}
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:oat_seeds"
}
],
"rolls": 1.0
}
]
}

View file

@ -0,0 +1,68 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "unicopia:oats_crown",
"condition": "minecraft:block_state_property",
"properties": {
"age": "1"
}
}
],
"name": "unicopia:oats"
},
{
"type": "minecraft:item",
"name": "unicopia:oat_seeds"
}
]
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:oats_crown",
"condition": "minecraft:block_state_property",
"properties": {
"age": "1"
}
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:oat_seeds"
}
],
"rolls": 1.0
}
]
}

View file

@ -0,0 +1,64 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:explosion_decay"
}
],
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"block": "unicopia:oats_stem",
"condition": "minecraft:block_state_property",
"properties": {
"age": "6"
}
}
],
"name": "unicopia:oats"
}
]
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"block": "unicopia:oats_stem",
"condition": "minecraft:block_state_property",
"properties": {
"age": "6"
}
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"function": "minecraft:apply_bonus",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "unicopia:oat_seeds"
}
],
"rolls": 1.0
}
]
}

View file

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{ "item": "unicopia:oats" },
{ "item": "unicopia:oats" },
{ "item": "unicopia:oats" },
{ "item": "minecraft:milk_bucket" },
{ "item": "minecraft:bowl" }
],
"result": { "item": "unicopia:oatmeal" }
}

View file

@ -0,0 +1,37 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"bonus_rolls": 0,
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.05, 0.052222223, 0.055, 0.066666665, 0.1
]
}
],
"functions": [
{
"function": "minecraft:set_count",
"count": {
"min": 1.0,
"max": 2.0,
"type": "minecraft:uniform"
}
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "unicopia:oat_seeds"
}
]
}
]
}