For all of these, you'll need:
- Java SE Development Kit 8: Link to OpenJDK Download
- Git: Official Download Link Most Linux and MacOS systems have Git installed by default.
Prerequesites:
- IntelliJ IDEA: Download Link
- Clone this repository using Git:
git clone https://github.com/nekomaster1000/Infernal-Expansion
- Open IntelliJ and select 'open'
- Navigate to the cloned repository and select 'build.gradle'
- Open it as a project.
- You will have to build the project, might take a while.
- Once you have opened it in IntelliJ, open the terminal. This can be found on the bottom left, and once you click it a small terminal should pop up.
Here, type
gradlew genIntellijRuns
or./gradlew genIntellijRuns
if you're on Linux or MacOS. Wait for it to complete. - Navigate to the file named InfernalExpansion.java in IntelliJ and double click it to open it.
- Select the button named 'Edit Configurations' in the top right. you should be taken to a page with two options on the left - Application and Templates; Select 'Application', and from the options that appear select 'Run Client'.
- Return to the project and click the green arrow in the top left, IntelliJ will now compile and run the project.
Prerequesites:
- Eclipse IDE: Download Link
- Open Eclipse
- Navigate to File > Import
- Choose Git > Projects from Git > Clone URI
- Under Location, paste
https://github.com/infernalexp/Infernal-Expansion.git
in URI - Click next, and skip branch selection
- Choose a directory where the project files will be stored, click next
- Choose Import as general project, click next and finish.
- Open a terminal in your cloned directory and run
gradlew genEclipseRuns
or./gradlew genEclipseRuns
if you're on Linux or MacOS. Wait for it to complete. - Select the project, click 'Run' at the top, and select 'runClient'. Eclipse will now compile and run the project.
This project uses the Google Java Style Guide: View Here
In short, when writing if, for and while statements and such, we use:
// This is preferred
if (statement) {
someCode();
double x = player.getPos().getX();
} else if (anotherStatement) {
someOtherCode();
double z = player.getPos().getZ();
} else {
throw new NullPointerException();
}
// Do not do this (I'm looking at you, Hellion)
if(statement) {
someCode();
}
else{
someOtherCode();
}
This is example code
If possible, we encourage line breaks.
Some other things to note:
- We use 4 spaces instead of 2 for indentation, overrides 4.2.
- 4.1 Brace styling.
- 4.6.1 Vertical whitespace.
- 4.8.7 Order of modifiers.
- 5.2 Identifier naming.
- 7 Javadoc. This is very short
-
Place your texture in main/resources/assets/infernaldiv/textures/entity
-
Create a new java class in org.infernalstudios.infernalexp.entities called
MobNameEntity
. ReplaceMobName
with your mob name. This is boilerplate code that would normally be in every mob.public class MobNameEntity extends CreatureEntity { protected MobNameEntity(EntityType<? extends CreatureEntity> type, World worldIn) { super(type, worldIn); } public static AttributeModifierMap.MutableAttribute setCustomAttributes() { return MobEntity.func_233666_p_() .createMutableAttribute(Attributes.MAX_HEALTH, 10.0D) .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.25D); } @Override protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new WaterAvoidingRandomWalkingGoal(this, 0.25d)); } @Override protected int getExperiencePoints(PlayerEntity player) { return 1 + this.world.rand.nextInt(4); } @Override protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_PIG_AMBIENT; } @Override protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_PIG_DEATH; } @Override protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.ENTITY_PIG_HURT; } @Override protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(SoundEvents.ENTITY_PIG_STEP, 0.15F, 1.0F); } }
-
In
org.infernalstudios.infernalexp.client.entity.model
, copy and paste your generated class from blockbench. -
Right click on the file, select 'refactor' and then 'rename', and change it to have the same name as what blockbench gave it.
-
Change the initial class creation line in your model class to: The following is boilerplate code that should be edited accordingly.
public class MobNameModel<T extends MobNameEntity> extends EntityModel<T>
-
Fix any errors you recieve
-
Refactor it again, changing it to
MobNameModel
, replacingMobName
with the same as in step 2. -
Fix any import errors.
-
In the render function, if you have an error in your class, replace
matrixStack
,buffer
,packedLight
andpackedOverlay
to haveIn
at the end of them. Do the same for any usages of those parameters.
-
The following steps contain boilerplate code that should be edited accordingly:
Replace any
mob name
according to the syntax/case.mob name
refers to stuff likeMobNameEntity
,MOB_NAME
,mob_name
, etc, and should be renamed to something likeGlowsquitoEntity
,BASALT_GIANT
andvoline
, respectively.
-
In
org.infernalstudios.infernalexp.init.ModEntityTypes
, add a new entity. This should be done in the format:public static final RegistryObject<EntityType<MobNameEntity>> MOB_NAME = ENTITY_TYPES.register("mob_name", () -> EntityType.Builder.create(MobNameEntity::new, EntityClassification.CREATURE) .size(0.5f, 0.5f) .build(new ResourceLocation(InfernalExpansion.MOD_ID, "mob_name").toString()));
-
In
org.infernalstudios.infernalexp.client.entity.render
, make a new class, namedMobNameRenderer
, renamed accordingly.public class MobNameRenderer extends MobRenderer<MobNameEntity, MobNameModel<MobNameEntity>> { protected static final ResourceLocation TEXTURE = new ResourceLocation(InfernalExpansion.MOD_ID, "textures/entity/mob_name.png"); public MobNameRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn, new MobNameModel<>(), 0.7f); } @Override public ResourceLocation getEntityTexture(MobNameEntity entity) { return TEXTURE; } }
-
In
InfernalExpansion
, add a new line underdeferredworkqueue.runLater
:GlobalEntityTypeAttributes.put(ModEntityType.MOB_NAME.get(), MobNameEntity.setCustomAttributes().create());
-
In
org.infernalstudios.infernalexp.util.ClientEventBusSubscriber
, add a new line inonClientSetup()
:RenderingRegistry.registerEntityRenderingHandler(ModEntityType.MOB_NAME.get(), MobNameRenderer::new);
-
In
ModEntityPlacement
, add a new line inspawnPlacement()
:EntitySpawnPlacementRegistry.register(ModEntityType.MOB_NAME.get(), EntitySpawnPlacementRegistry.PlacementType.[placement-type], Heightmap.Type.[heightmap-type], MobEntity::canSpawnOn);
[placement-type] is the possible locations for your mob to spawn:
ON_GROUND
IN_WATER
IN_LAVA
NO_RESTRICTIONS
[heightmap-type] is the type of heightmap to use when checking for possible spawn locations:
MOTION_BLOCKING
: The highest block that blocks motion or contains a fluid.MOTION_BLOCKING_NO_LEAVES
: The highest block that blocks motion or contains a fluid and is not in theminecraft:leaves
tag.OCEAN_FLOOR
: The highest non-air block, solid block.OCEAN_FLOOR_WG
: The highest block that is neither air nor contains a fluid, for worldgen.WORLD_SURFACE
: The highest non-air block.WORLD_SURFACE_WG
: The highest non-air block, for worldgen.