Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
All features updated
  • Loading branch information
Nyancatpig committed May 7, 2022
1 parent 238fb4c commit 55fdcd8
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 25 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: "org.spongepowered.mixin"

version = '1.18.2-0.10'
version = '1.18.2-0.10.1'
group = 'com.ncpbails.culturaldelights' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'culturaldelights'

Expand Down Expand Up @@ -189,6 +189,7 @@ dependencies {
implementation fg.deobf("curse.maven:farmersdelight-398521:3765351")
runtimeOnly fg.deobf("curse.maven:appleskin-248787:3686482")


// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
Expand All @@ -208,7 +209,7 @@ jar {
attributes([
"Specification-Title" : "culturaldelights",
"Specification-Vendor" : "ncpbails",
"Specification-Version" : "1", // We are version 1 of ourselves
"Specification-Version" : "0.10.1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "ncpbails",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.animal.Chicken;
import net.minecraft.world.entity.animal.Parrot;
import net.minecraft.world.entity.animal.Pig;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ComposterBlock;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CompoundIngredient;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;


import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Collectors;

// The value here should match an entry in the META-INF/mods.toml file
Expand Down Expand Up @@ -70,9 +79,63 @@ private void clientSetup(final FMLClientSetupEvent event) {

private void setup(final FMLCommonSetupEvent event)
{
event.enqueueWork(() -> {
registerCompostables();
//registerAnimalFeeds();
});

// some preinit code
LOGGER.info("HELLO FROM PREINIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());

}
}

public static void registerCompostables() {
// 30% chance
ComposterBlock.COMPOSTABLES.put(ModItems.CUCUMBER_SEEDS.get(), 0.3F);
ComposterBlock.COMPOSTABLES.put(ModItems.CORN_KERNELS.get(), 0.3F);
ComposterBlock.COMPOSTABLES.put(ModItems.EGGPLANT_SEEDS.get(), 0.3F);
ComposterBlock.COMPOSTABLES.put(ModItems.WHITE_EGGPLANT_SEEDS.get(), 0.3F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.AVOCADO_PIT.get(), 0.3F);

// 50% chance
ComposterBlock.COMPOSTABLES.put(ModItems.CUT_CUCUMBER.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.CUT_AVOCADO.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.CUT_EGGPLANT.get(), 0.65F);

// 65% chance
ComposterBlock.COMPOSTABLES.put(ModItems.AVOCADO.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.CUCUMBER.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.CORN_COB.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.EGGPLANT.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModItems.WHITE_EGGPLANT.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.WILD_CUCUMBERS.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.WILD_CORN.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.WILD_EGGPLANTS.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.AVOCADO_LEAVES.get(), 0.65F);
ComposterBlock.COMPOSTABLES.put(ModBlocks.AVOCADO_SAPLING.get(), 0.65F);

// 85% chance
ComposterBlock.COMPOSTABLES.put(ModItems.POPCORN.get(), 0.85F);

// 100% chance
ComposterBlock.COMPOSTABLES.put(ModBlocks.AVOCADO_BUNDLE.get(), 0.65F);
}

//public static void registerAnimalFeeds() {
// Ingredient newChickenFood = Ingredient.of(ModItems.CUCUMBER_SEEDS.get(), ModItems.CORN_KERNELS.get(),
// ModItems.EGGPLANT_SEEDS.get(), ModItems.WHITE_EGGPLANT_SEEDS.get());
// Chicken.FOOD_ITEMS = new CompoundIngredient(Arrays.asList(Chicken.FOOD_ITEMS, newChickenFood))
// {
// };

// Ingredient newPigFood = Ingredient.of(ModItems.CUCUMBER.get(), ModItems.EGGPLANT.get(),
// ModItems.WHITE_EGGPLANT.get(), ModItems.CORN_COB.get());
// Pig.FOOD_ITEMS = new CompoundIngredient(Arrays.asList(Pig.FOOD_ITEMS, newPigFood))
// {
// };

// Collections.addAll(Parrot.TAME_FOOD, ModItems.CUCUMBER_SEEDS.get(), ModItems.CORN_KERNELS.get(),
// ModItems.EGGPLANT_SEEDS.get(), ModItems.WHITE_EGGPLANT_SEEDS.get());
//}
}
27 changes: 15 additions & 12 deletions src/main/java/com/ncpbails/culturaldelights/block/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.ncpbails.culturaldelights.world.feature.tree.AvocadoTreeGrower;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.RecipeType;
Expand All @@ -24,6 +25,7 @@
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.Nullable;
import vectorwing.farmersdelight.FarmersDelight;
import vectorwing.farmersdelight.common.block.WildCropBlock;

import java.util.function.Supplier;

Expand All @@ -35,19 +37,19 @@ public class ModBlocks {

public static final RegistryObject<Block> BAMBOO_MAT = registerBlock("bamboo_mat",
() -> new BambooMatBlock(BlockBehaviour.Properties.copy(vectorwing.farmersdelight.common.registry.ModBlocks.CUTTING_BOARD.get())
.noOcclusion()), FarmersDelight.CREATIVE_TAB, true, 0);
.noOcclusion()), FarmersDelight.CREATIVE_TAB, true, 200);

public static final RegistryObject<Block> WILD_CUCUMBERS = registerBlock("wild_cucumbers",
() -> new Block(BlockBehaviour.Properties.copy(vectorwing.farmersdelight.common.registry.ModBlocks.WILD_BEETROOTS.get())
.noOcclusion()), FarmersDelight.CREATIVE_TAB, false, 0);
public static final RegistryObject<Block> WILD_CUCUMBERS = registerBlock("wild_cucumbers",
() -> new WildCropBlock(MobEffects.FIRE_RESISTANCE, 6, BlockBehaviour.Properties.copy(Blocks.TALL_GRASS), false),
FarmersDelight.CREATIVE_TAB, false, 0);

public static final RegistryObject<Block> WILD_CORN = registerBlock("wild_corn",
() -> new Block(BlockBehaviour.Properties.copy(vectorwing.farmersdelight.common.registry.ModBlocks.WILD_BEETROOTS.get())
.noOcclusion()), FarmersDelight.CREATIVE_TAB, false, 0);
() -> new WildCropBlock(MobEffects.HUNGER, 6, BlockBehaviour.Properties.copy(Blocks.TALL_GRASS), false),
FarmersDelight.CREATIVE_TAB, false, 0);

public static final RegistryObject<Block> WILD_EGGPLANTS = registerBlock("wild_eggplants",
() -> new Block(BlockBehaviour.Properties.copy(vectorwing.farmersdelight.common.registry.ModBlocks.WILD_BEETROOTS.get())
.noOcclusion()), FarmersDelight.CREATIVE_TAB, false, 0);
() -> new WildCropBlock(MobEffects.DAMAGE_BOOST, 6, BlockBehaviour.Properties.copy(Blocks.TALL_GRASS), false),
FarmersDelight.CREATIVE_TAB, false, 0);

public static final RegistryObject<Block> AVOCADO_LOG = registerBlock("avocado_log",
() -> new RotatedPillarBlock(BlockBehaviour.Properties.copy(Blocks.JUNGLE_LOG)) {
Expand All @@ -57,7 +59,7 @@ public class ModBlocks {
@Nullable @Override public BlockState getToolModifiedState(BlockState state, Level world, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction){
if(stack.getItem() instanceof AxeItem) { return Blocks.JUNGLE_LOG.defaultBlockState().setValue(AXIS, state.getValue(AXIS)); }
return super.getToolModifiedState(state, world, pos, player, stack, toolAction); }
}, FarmersDelight.CREATIVE_TAB, true, 0);
}, FarmersDelight.CREATIVE_TAB, true, 300);

public static final RegistryObject<Block> AVOCADO_WOOD = registerBlock("avocado_wood",
() -> new RotatedPillarBlock(BlockBehaviour.Properties.copy(Blocks.JUNGLE_WOOD)) {
Expand All @@ -67,17 +69,18 @@ public class ModBlocks {
@Nullable @Override public BlockState getToolModifiedState(BlockState state, Level world, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction){
if(stack.getItem() instanceof AxeItem) { return Blocks.JUNGLE_WOOD.defaultBlockState().setValue(AXIS, state.getValue(AXIS)); }
return super.getToolModifiedState(state, world, pos, player, stack, toolAction); }
}, FarmersDelight.CREATIVE_TAB, true, 0);
}, FarmersDelight.CREATIVE_TAB, true, 300);

public static final RegistryObject<Block> AVOCADO_LEAVES = registerBlock("avocado_leaves",
() -> new LeavesBlock(BlockBehaviour.Properties.copy(Blocks.JUNGLE_LEAVES)) {
@Override public boolean isFlammable(BlockState state, BlockGetter world, BlockPos pos, Direction face) { return true; }
@Override public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { return 60; }
@Override public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { return 30; }
}, FarmersDelight.CREATIVE_TAB, true, 0);
}, FarmersDelight.CREATIVE_TAB, false, 0);

public static final RegistryObject<Block> AVOCADO_SAPLING = registerBlock("avocado_sapling",
() -> new SaplingBlock(new AvocadoTreeGrower(), BlockBehaviour.Properties.copy(Blocks.OAK_SAPLING)), FarmersDelight.CREATIVE_TAB, true, 0);
() -> new SaplingBlock(new AvocadoTreeGrower(), BlockBehaviour.Properties.copy(Blocks.OAK_SAPLING)),
FarmersDelight.CREATIVE_TAB, true, 100);

public static final RegistryObject<Block> CUCUMBERS = registerBlockWithoutBlockItem("cucumbers",
() -> new CucumbersBlock(BlockBehaviour.Properties.copy(Blocks.WHEAT).noOcclusion()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
import com.ncpbails.culturaldelights.block.entity.ModBlockEntities;
import com.ncpbails.culturaldelights.item.ModItems;
import com.ncpbails.culturaldelights.recipe.BambooMatRecipe;
import com.ncpbails.culturaldelights.recipe.ModRecipes;
import com.ncpbails.culturaldelights.screen.BambooMatMenu;
import com.ncpbails.culturaldelights.util.ModTags;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
Expand All @@ -31,6 +35,7 @@
import net.minecraftforge.items.ItemStackHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import vectorwing.farmersdelight.common.block.entity.CookingPotBlockEntity;

import javax.annotation.Nonnull;
import java.util.Optional;
Expand Down Expand Up @@ -170,6 +175,7 @@ private static void craftItem(BambooMatBlockEntity entity) {
.getRecipeFor(BambooMatRecipe.Type.INSTANCE, inventory, level);

if(match.isPresent()) {
giveBowls(entity);
entity.itemHandler.extractItem(0,1, false);
entity.itemHandler.extractItem(1,1, false);
entity.itemHandler.extractItem(2,1, false);
Expand All @@ -183,6 +189,21 @@ private static void craftItem(BambooMatBlockEntity entity) {
}
}

private static void giveBowls(BambooMatBlockEntity entity) {
SimpleContainer inventory = new SimpleContainer(entity.itemHandler.getSlots());
Optional<BambooMatRecipe> match = entity.level.getRecipeManager()
.getRecipeFor(BambooMatRecipe.Type.INSTANCE, inventory, entity.level);
for (int i = 0; i < entity.itemHandler.getSlots(); i++) {

if((entity.itemHandler.getStackInSlot(i)).is(ModTags.Items.BOWL_FOODS)) {
if(!entity.level.isClientSide()) {
ItemEntity entityToSpawn = new ItemEntity((Level) entity.level, entity.worldPosition.getX(), entity.worldPosition.getY(), entity.worldPosition.getZ(), new ItemStack(Items.BOWL));
entity.level.addFreshEntity(entityToSpawn);
}
}
}
}

private void resetProgress() {
this.progress = 0;
}
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/com/ncpbails/culturaldelights/event/ModEvents.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.ncpbails.culturaldelights.event;

import com.ncpbails.culturaldelights.CulturalDelights;
import com.ncpbails.culturaldelights.item.ModItems;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.trading.MerchantOffer;
import net.minecraftforge.event.village.VillagerTradesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.List;

@Mod.EventBusSubscriber(modid = CulturalDelights.MOD_ID)
public class ModEvents {

@SubscribeEvent
public static void addCustomTrades(VillagerTradesEvent event) {

if(event.getType() == VillagerProfession.FARMER) {
Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades();
ItemStack stack = new ItemStack(Items.EMERALD, 1);
int villagerLevel = 1;

trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer(
new ItemStack(ModItems.CUCUMBER.get(), 22),
stack,10,2,0.02F));
//max uses pXp price multiplier

trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer(
new ItemStack(ModItems.EGGPLANT.get(), 15),
stack,10,2,0.02F));
//max uses pXp price multiplier

trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer(
new ItemStack(ModItems.WHITE_EGGPLANT.get(), 20),
stack,10,2,0.02F));
//max uses pXp price multiplier

trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer(
new ItemStack(ModItems.CORN_COB.get(), 15),
stack,10,2,0.02F));
//max uses pXp price multiplier

trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer(
new ItemStack(ModItems.AVOCADO.get(), 20),
stack,10,2,0.02F));
//max uses pXp price multiplier
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ public class ModWorldEvents {
public static void biomeLoadingEvent(final BiomeLoadingEvent event) {
ModTreeGeneration.generateTrees(event);
ModWildCropGeneration.generateFlowers(event);
//ModPlantGeneration.generatePlants(event);
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public class ModPlacedFeatures {
ModConfiguredFeatures.AVOCADO_SPAWN, VegetationPlacements.treePlacement(PlacementUtils.countExtra(1, 0.1f, 1)));

public static final Holder<PlacedFeature> WILD_CORN_PLACED = PlacementUtils.register("wild_corn_placed",
ModConfiguredFeatures.WILD_CORN, RarityFilter.onAverageOnceEvery(16),
ModConfiguredFeatures.WILD_CORN, RarityFilter.onAverageOnceEvery(25),
InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());

public static final Holder<PlacedFeature> WILD_EGGPLANTS_PLACED = PlacementUtils.register("wild_eggplants_placed",
ModConfiguredFeatures.WILD_EGGPLANTS, RarityFilter.onAverageOnceEvery(16),
ModConfiguredFeatures.WILD_EGGPLANTS, RarityFilter.onAverageOnceEvery(25),
InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());

public static final Holder<PlacedFeature> WILD_CUCUMBERS_PLACED = PlacementUtils.register("wild_cucumbers_placed",
ModConfiguredFeatures.WILD_CUCUMBERS, RarityFilter.onAverageOnceEvery(16),
ModConfiguredFeatures.WILD_CUCUMBERS, RarityFilter.onAverageOnceEvery(25),
InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public static void generateFlowers(final BiomeLoadingEvent event) {
base.add(ModPlacedFeatures.WILD_CORN_PLACED);
}

if(types.contains(BiomeDictionary.Type.SWAMP)) {
else if(types.contains(BiomeDictionary.Type.SWAMP)) {
List<Holder<PlacedFeature>> base =
event.getGeneration().getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION);

base.add(ModPlacedFeatures.WILD_EGGPLANTS_PLACED);
base.add(ModPlacedFeatures.WILD_CUCUMBERS_PLACED);
}

if(types.contains(BiomeDictionary.Type.JUNGLE)) {
else if(types.contains(BiomeDictionary.Type.JUNGLE)) {
List<Holder<PlacedFeature>> base =
event.getGeneration().getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION);

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public-f net.minecraft.world.entity.animal.Chicken p_28271_ # FOOD_ITEMS
public-f net.minecraft.world.entity.animal.Pig f_29458_ # FOOD_ITEMS
public-f net.minecraft.world.entity.animal.Parrot f_29357_ # TAME_FOOD

0 comments on commit 55fdcd8

Please sign in to comment.