Jump to content

Gotlyfe

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Gotlyfe

  1. I think you really missed the point of this topic. Not trying to be a tutorial, that's why this isn't in the user-submitted-tutorials. It was a description of what I did and the places I went to, to figure out how to get the basics of a mod set up. Thanks, I'll re-work my code straight away.
  2. What did I have here that was copyrighted material? Explained, thx.
  3. Started with Moving on from there Going to create some entities! -new Package goat with class Entity_Goat -new Startup Classes StartupDedicatedServer, StartupClientOnly, StartupCommon -each with their respective public static void preInit<classname>() { } public static void init<classname>() { } public static void postInit<classname>() { } Going to base a most of this code on EntitySheep -Entity_Goat is going to extend EntityAnimal -create constructor with World input parameter and setSize of Entity_Goat public Entity_Goat(World worldIn) { super(worldIn); this.setSize(1.2F, 1.7F); } -give Entity_Goat ability to createChild which we can use to pass variable from parent to child later on @Override public Entity_Goat createChild(EntityAgeable ageable) { Entity_Goat entitygoat1 = new Entity_Goat(this.world); return entitygoat1; } -give Entity_Goat attributes, an initialization function and an on first spawn function protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(14.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D); } protected void entityInit() { super.entityInit(); } @Nullable public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); return livingdata; } -set up register functions for entity in main mod class public static int startEntityID; public static int i; public static void registerModEntity(Class<? extends Entity> entityClass, String name) { EntityRegistry.registerModEntity(new ResourceLocation("class:resources"), entityClass, name, ++startEntityID, Ascension.instance, 80, 3, false); //Unsure about new ResourceLocation("class:resources") -Gotlyfe logger.info("Registering mod entity " + name + " with ID = " + startEntityID); } public static void registerModEntityEgg(Class<? extends Entity> entityClass, String name, int primary, int secondary) { registerModEntity(entityClass, name); if (i == 0) { registerSpawnEgg(name, primary, secondary); ++i; } } public static void registerSpawnEgg(String name, int primary, int secondary) { } public static int getUniqueEntityId() { do { startEntityID++; } while (EntityList.getClassFromID(startEntityID) != null); //EntityList.getStringFromID() No longer exists but .getClassFromID() functions similarly in this case - Gotlyfe return startEntityID; }
  4. Continuing from I am going to be following the same format of editing the post and describing my actions to create this mod to add new plants. To be specific, I am going to be adding new blocks, items, sounds and recipes. Updates: -Adding first plant block (Bamboo) -Create new Package and Class named accordingly (plants.bamboo) (BlockBamboo.java) -Make BlockBamboo extend Block and implement IPlantable import net.minecraft.block.Block; public class BlockBamboo extends Block implements net.minecraftforge.common.IPlantable{ } This requires us to add a constructor giving the Material for the block protected BlockBamboo() { super(Material.PLANTS); } which requires import net.minecraft.block.material.Material -Need Imports for next steps import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -Define an age property before constructor inside class to determine growth public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); -Initialize the age to 0 inside of our constructor this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); -IPlantable requires us to implement EnumPlantType getPlantType() and IBlockState getPlant() Both of which are just asking for more metadata about the plant @Override public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { return net.minecraftforge.common.EnumPlantType.Beach; } @Override public IBlockState getPlant(IBlockAccess world, BlockPos pos) { return getDefaultState(); } -A quick thing to do is set creative tab import net.minecraft.creativetab.CreativeTabs; and in the constructor for our block this.setCreativeTab(CreativeTabs.DECORATIONS); -Need Random Ticks for Growth, Add inside constructor this.setTickRandomly(true); -Then we need an UpdateTick function to tell it to grow -Which was pulled from the BlockCactus.class with only the maximum height, max age and neighborChanged edited -Variable Model -Pulling directly from BlockWall.class --Taking breather to work on another mod
  5. Today I'm going to start modding. Wish me luck! --Gotlyfe-- I will be editing this post and providing sources for the reasoning behind my actions in the spoilers. Updates: -Downloaded and installed Java version of Minecraft from https://minecraft.net/download/ -Downloaded and installed Minecraft forge(recommended version 1.12.2 - 14.23.3.2655) from https://files.minecraftforge.net/ -Ran once to test it was working properly -Removed all versions of Java from my computer -Installed Java 8u171 from Oracle 8u171 Download -Downloaded Forge source distribution(mdk) from http://files.minecraftforge.net/ (same version as installed earlier) -Extracted zip file into empty folder -Copied build.gradle gradlew.bat gradlew and the gradle folder to a new folder for project -Installed Eclipse from https://www.eclipse.org/downloads/ -Opened Command Prompt as administrator -Navigated to project Folder -ran gradlew -Dorg.gradle.jvmargs=-Xmx3000m setupDecompWorkspace eclipse to set up workspace, set up for eclipse and make sure it had enough RAM to complete -Completed in 11 mins 23 seconds -Opened Eclipse and set workspace one level above project folder -Added Project to package explorer by Import > General > Existing Projects into Workspace > Select Root Directory -Altered Mod Information, changing build name, "maven coordinates", and version number under build.gradle -Created new source folder for java, package inside source folder, project class inside package -Created new source folder for resources -Creating mcmod.info file in resources and fill with metadata about mod -Adding parts one by one to project class from ExampleMod.java -Adding @Mod(modid = ClassName.MODID, name = ClassName.NAME, version = ClassName.VERSION) above public class ClassName which requires import net.minecraftforge.fml.common.Mod; -Adding public static final strings to project class definition for previously used metadata in @Mod -Adding private static Logger logger; into class which requires import org.apache.logging.log4j.Logger; -Creating initialization event functions @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } which requires import net.minecraftforge.fml.common.Mod.EventHandler; to handle events at all and import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; to handle these specific events. -Created build by using the cmd in the project folder directory to run gradlew build -Copied the output file ([archivesBaseName]-[version].jar from build/libs into .minecraft\mods Success! -- Will start a new thread specific to the kind of mod I am going to make it into. This seems to be a good general starting mod thread in my opinion.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.