-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- moved RenderSetup - reworked Common Events - reworked Common Setup - changed standard Configuration - changed default values of MinecraftConfig - reworked ModBlocks - easier ModItems - cleaned up WildCropBlock - reworked WildCropConfig - reworked WildCropFeature - reworked WildCropGeneration - reworked Main Class - bumped version
- Loading branch information
1 parent
2afafb8
commit 2f0ec6b
Showing
33 changed files
with
298 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. | ||
# This is required to provide enough memory for the Minecraft decompilation process. | ||
org.gradle.jvmargs=-Xmx3G | ||
org.gradle.daemon=false | ||
org.gradle.daemon=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
18 changes: 18 additions & 0 deletions
18
src/main/java/wks/wolfkidsounds/wildplants/ClientSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package wks.wolfkidsounds.wildplants; | ||
|
||
import net.minecraft.client.renderer.ItemBlockRenderTypes; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; | ||
import wks.wolfkidsounds.wildplants.block.ModBlocks; | ||
import wks.wolfkidsounds.wildplants.config.Configuration; | ||
|
||
public class ClientSetup { | ||
public static void init(final FMLClientSetupEvent event) { | ||
if (Configuration.ENABLE_MINECRAFT.get()) { | ||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.MINECRAFT_WILD_WHEAT.get(), RenderType.cutout()); | ||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.MINECRAFT_WILD_CARROTS.get(), RenderType.cutout()); | ||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.MINECRAFT_WILD_POTATOES.get(), RenderType.cutout()); | ||
ItemBlockRenderTypes.setRenderLayer(ModBlocks.MINECRAFT_WILD_BEETROOTS.get(), RenderType.cutout()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 25 additions & 7 deletions
32
src/main/java/wks/wolfkidsounds/wildplants/Wildplants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,56 @@ | ||
package wks.wolfkidsounds.wildplants; | ||
|
||
import net.minecraft.world.item.CreativeModeTab; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.eventbus.api.IEventBus; | ||
import net.minecraftforge.fml.ModLoadingContext; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import wks.wolfkidsounds.wildplants.block.ModBlocks; | ||
import wks.wolfkidsounds.wildplants.config.Configuration; | ||
import wks.wolfkidsounds.wildplants.config.features.MinecraftConfig; | ||
import wks.wolfkidsounds.wildplants.config.MinecraftConfig; | ||
import wks.wolfkidsounds.wildplants.item.ModItems; | ||
import wks.wolfkidsounds.wildplants.registry.ModBiomeFeatures; | ||
import wks.wolfkidsounds.wildplants.registry.ModBlocks; | ||
import wks.wolfkidsounds.wildplants.registry.ModItems; | ||
import wks.wolfkidsounds.wildplants.registry.ModPlacementModifiers; | ||
import wks.wolfkidsounds.wildplants.world.RenderSetup; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
@Mod(Wildplants.MOD_ID) | ||
public class Wildplants { | ||
public static final String MOD_ID = "wildplants"; | ||
public static final Logger LOGGER = LogManager.getLogger(); | ||
public static final CreativeModeTab CREATIVE_MODE_TAB = new CreativeModeTab("wildplants_creative_tab") { | ||
@Nonnull | ||
@Override | ||
public ItemStack makeIcon() { | ||
return new ItemStack(Blocks.GRASS); | ||
} | ||
}; | ||
|
||
public Wildplants() { | ||
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); | ||
|
||
modEventBus.addListener(CommonSetup::init); | ||
modEventBus.addListener(RenderSetup::init); | ||
modEventBus.addListener(ClientSetup::init); | ||
LOGGER.debug("register-eventbus"); | ||
|
||
//Configurations | ||
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, Configuration.SPEC, "wildplants/wildplants-common.toml"); | ||
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.CLIENT, MinecraftConfig.SPEC, "wildplants/mods/minecraft.toml"); | ||
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, MinecraftConfig.SPEC, "wildplants/mods/minecraft.toml"); | ||
LOGGER.debug("register-config"); | ||
|
||
ModItems.ITEMS.register(modEventBus); | ||
//Registry | ||
ModBlocks.BLOCKS.register(modEventBus); | ||
ModItems.ITEMS.register(modEventBus); | ||
ModBiomeFeatures.FEATURES.register(modEventBus); | ||
ModPlacementModifiers.PLACEMENT_MODIFIERS.register(modEventBus); | ||
LOGGER.debug("register-ModObjects"); | ||
|
||
MinecraftForge.EVENT_BUS.register(this); | ||
LOGGER.debug("register-eventbus"); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/wks/wolfkidsounds/wildplants/block/ModBlocks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package wks.wolfkidsounds.wildplants.block; | ||
|
||
import net.minecraft.world.effect.MobEffects; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraftforge.eventbus.api.IEventBus; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
import wks.wolfkidsounds.wildplants.Wildplants; | ||
import wks.wolfkidsounds.wildplants.config.Configuration; | ||
import wks.wolfkidsounds.wildplants.item.ModItems; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class ModBlocks { | ||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Wildplants.MOD_ID); | ||
|
||
//MINECRAFT | ||
public static final RegistryObject<Block> MINECRAFT_WILD_WHEAT = registerMinecraftBlock("minecraft_wild_wheat", () -> new WildCropBlock(MobEffects.GLOWING, 1, Block.Properties.copy(Blocks.TALL_GRASS))); | ||
public static final RegistryObject<Block> MINECRAFT_WILD_CARROTS = registerMinecraftBlock("minecraft_wild_carrots", () -> new WildCropBlock(MobEffects.GLOWING, 1, Block.Properties.copy(Blocks.TALL_GRASS))); | ||
public static final RegistryObject<Block> MINECRAFT_WILD_POTATOES = registerMinecraftBlock("minecraft_wild_potatoes", () -> new WildCropBlock(MobEffects.GLOWING, 1, Block.Properties.copy(Blocks.TALL_GRASS))); | ||
public static final RegistryObject<Block> MINECRAFT_WILD_BEETROOTS = registerMinecraftBlock("minecraft_wild_beetroots", () -> new WildCropBlock(MobEffects.GLOWING, 1, Block.Properties.copy(Blocks.TALL_GRASS))); | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
private static <T extends Block> RegistryObject<T> registerMinecraftBlock(String name, Supplier<T> block) { | ||
RegistryObject<T> toReturn = BLOCKS.register(name, block); | ||
if (Configuration.ENABLE_MINECRAFT.get()) { | ||
registerBlockItem(name, toReturn); | ||
Wildplants.LOGGER.debug("register-blocks-minecraft"); | ||
} | ||
return toReturn; | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
|
||
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) { | ||
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties().tab(Wildplants.CREATIVE_MODE_TAB))); | ||
Wildplants.LOGGER.debug("register-block-ttems"); | ||
} | ||
|
||
public static void register(IEventBus eventBus) { | ||
BLOCKS.register(eventBus); | ||
Wildplants.LOGGER.debug("register-modblocks-moditems"); | ||
} | ||
} |
21 changes: 2 additions & 19 deletions
21
src/main/java/wks/wolfkidsounds/wildplants/block/WildCropBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,12 @@ | ||
package wks.wolfkidsounds.wildplants.block; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.effect.MobEffect; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.FlowerBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import wks.wolfkidsounds.wildplants.Wildplants; | ||
|
||
public class WildCropBlock extends FlowerBlock { | ||
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); | ||
|
||
public WildCropBlock(MobEffect suspiciousStewEffect, int effectDuration, Properties properties) { | ||
super(suspiciousStewEffect, effectDuration, properties); | ||
} | ||
|
||
@Override | ||
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { | ||
return SHAPE; | ||
} | ||
|
||
@Override | ||
protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { | ||
return state.is(BlockTags.DIRT) || state.is(BlockTags.SAND); | ||
Wildplants.LOGGER.debug("configure-cropblock"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.