Skip to content

Commit

Permalink
add custom dimension with own portal, add new custom structures (Vlad…
Browse files Browse the repository at this point in the history
…ik House, Storage Platform), add new dependency into build.gradle (CustomPortalAPI) and refactor mythril staff throw item
  • Loading branch information
Vladyslav Potapenko committed Dec 28, 2022
1 parent c587a4e commit 1ff722b
Show file tree
Hide file tree
Showing 23 changed files with 369 additions and 11 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ group = project.maven_group

repositories {
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
maven { url 'https://maven.kyrptonaught.dev' }
}

dependencies {
Expand All @@ -28,6 +29,9 @@ dependencies {

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modImplementation 'software.bernie.geckolib:geckolib-fabric-1.18:3.0.35'

modImplementation 'net.kyrptonaught:customportalapi:0.0.1-beta52-1.18'
include 'net.kyrptonaught:customportalapi:0.0.1-beta52-1.18'
}

processResources {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/me/nylestroke/nylemod/NylemodExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import me.nylestroke.nylemod.util.ModLootTableModifiers;
import me.nylestroke.nylemod.util.ModRegistries;
import me.nylestroke.nylemod.villager.ModVillagers;
import me.nylestroke.nylemod.world.dimension.ModDimensions;
import me.nylestroke.nylemod.world.feature.ModConfiguredFeatures;
import me.nylestroke.nylemod.world.gen.ModWorldGen;
import me.nylestroke.nylemod.world.structure.ModStructures;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.bernie.geckolib3.GeckoLib;

public class NylemodExample implements ModInitializer {
public static final String MOD_ID = "nylemod";
Expand Down Expand Up @@ -49,9 +51,12 @@ public void onInitialize() {
ModParticles.registerParticles();
ModEnchantments.registerModEnchantments();

ModVillagers.setupPOIs();
GeckoLib.initialize();

ModVillagers.setupPOIs();
ModStructures.registerStructureFeatures();

ModDimensions.registerDimensions();

}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package me.nylestroke.nylemod.item.custom;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.StackReference;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.ClickType;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import software.bernie.example.entity.RocketProjectile;

public class MythrilStaffItem extends Item {

Expand All @@ -15,17 +18,23 @@ public MythrilStaffItem(Settings settings) {
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {

player.getItemCooldownManager().set(this, 8);

if (!world.isClient()) {
RocketProjectile arrowEntity = new RocketProjectile(world, player);
arrowEntity.setVelocity(player, player.getPitch(), player.getYaw(), 0.0F,
1.0F * 3.0F, 1.0F);

arrowEntity.setDamage(2.5);
arrowEntity.age = 35;
arrowEntity.hasNoGravity();

double posX = user.prevX;
double posY = user.prevY;
double posZ = user.prevZ;
world.spawnEntity(arrowEntity);

world.createExplosion(user, posX, posY, posZ, 1f, Explosion.DestructionType.DESTROY);
}

return super.use(world, user, hand);
return super.use(world, player, hand);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package me.nylestroke.nylemod.world.dimension;

import me.nylestroke.nylemod.NylemodExample;
import me.nylestroke.nylemod.block.ModBlocks;
import me.nylestroke.nylemod.fluid.ModFluids;
import net.kyrptonaught.customportalapi.api.CustomPortalBuilder;
import net.minecraft.block.Blocks;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;

public class ModDimensions {

public static final RegistryKey<World> LAGUNA_DIMENSION_KEY = RegistryKey.of(Registry.WORLD_KEY,
new Identifier(NylemodExample.MOD_ID, "laguna"));

public static final RegistryKey<DimensionType> LAGUNA_TYPE_KEY = RegistryKey.of(Registry.DIMENSION_TYPE_KEY,
LAGUNA_DIMENSION_KEY.getValue());

public static void registerDimensions() {
NylemodExample.LOGGER.debug("Registering ModDimensions for: " + NylemodExample.MOD_ID);

CustomPortalBuilder.beginPortal()
.frameBlock(ModBlocks.MYTHRIL_BLOCK)
.destDimID(LAGUNA_DIMENSION_KEY.getValue())
.tintColor(240, 160, 60)
.lightWithFluid(ModFluids.HONEY_STILL)
.onlyLightInOverworld()
.registerPortal();
}

}
12 changes: 12 additions & 0 deletions src/main/resources/data/nylemod/dimension/laguna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "nylemod:laguna",
"generator": {
"type": "minecraft:noise",
"seed": -485105919,
"settings": "minecraft:overworld",
"biome_source": {
"type": "minecraft:fixed",
"biome": "minecraft:plains"
}
}
}
16 changes: 16 additions & 0 deletions src/main/resources/data/nylemod/dimension_type/laguna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ultrawarm": false,
"natural": true,
"piglin_safe": false,
"respawn_anchor_works": false,
"bed_works": false,
"has_raids": true,
"has_skylight": true,
"has_ceiling": false,
"coordinate_scale": 1,
"ambient_light": 0,
"logical_height": 256,
"infiniburn": "#minecraft:infiniburn_overworld",
"min_y": 0,
"height": 256
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"replace": false,

"_comment": " This biome tag can specify the biome directly. Or specify another biome tag by starting with # ",
"values": [
"#minecraft:is_jungle",
"#minecraft:is_forest",
"#minecraft:is_taiga",
"minecraft:desert",
"minecraft:plains",
"minecraft:snowy_plains",
"minecraft:sunflower_plains",
"minecraft:savanna",
"minecraft:savanna_plateau",
"minecraft:windswept_savanna"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"replace": false,

"_comment": " This biome tag can specify the biome directly. Or specify another biome tag by starting with # ",
"values": [
"#minecraft:is_jungle",
"#minecraft:is_forest",
"#minecraft:is_taiga",
"minecraft:desert",
"minecraft:plains",
"minecraft:snowy_plains",
"minecraft:sunflower_plains",
"minecraft:savanna",
"minecraft:savanna_plateau",
"minecraft:windswept_savanna"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// The base structure class to use for the behavior of the structure. (Like extra terrain checks and such)
"type": "minecraft:village",

"config": {
// the path to the template pool json file to use
"start_pool": "nylemod:storage_platform/start_pool",

// This is how many pieces away from the starting piece a piece of the structure can spawn
// Think of it like the length of the branch of the structure
"size": 2
},

// The biome tag to use for what biomes that this structure can spawn in"
"biomes": "#nylemod:has_structure/storage_platform",

// If true, land will be add around the bottom of the structure. (Based on the starting piece's y value)
"adapt_noise": true,

// What mobs can spawn over time in the structure.
// Make sure you add the mob to the right category (monster, creature, etc)
"spawn_overrides": {
"monster": {
"bounding_box": "piece",
"spawns": []
},
"creature": {
"bounding_box": "piece",
"spawns": [
{
"type": "minecraft:parrot",
"weight": 1,
"minCount": 1,
"maxCount": 4
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// The base structure class to use for the behavior of the structure. (Like extra terrain checks and such)
"type": "minecraft:village",

"config": {
// the path to the template pool json file to use
"start_pool": "nylemod:vladik_house/start_pool",

// This is how many pieces away from the starting piece a piece of the structure can spawn
// Think of it like the length of the branch of the structure
"size": 2
},

// The biome tag to use for what biomes that this structure can spawn in"
"biomes": "#nylemod:has_structure/vladik_house",

// If true, land will be add around the bottom of the structure. (Based on the starting piece's y value)
"adapt_noise": true,

// What mobs can spawn over time in the structure.
// Make sure you add the mob to the right category (monster, creature, etc)
"spawn_overrides": {
"monster": {
"bounding_box": "piece",
"spawns": []
},
"creature": {
"bounding_box": "piece",
"spawns": [
{
"type": "minecraft:parrot",
"weight": 1,
"minCount": 1,
"maxCount": 4
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// What structures to pick to try and spawn if a spot passes the placement check.
// If two or more structures in this list can spawn in a biome at a spot, a random one based on weight is chosen to spawn
"structures": [
{
"structure": "nylemod:storage_platform",
"weight": 1
}
],
"placement": {
// Make sure this is unique and does not match any other structure set's salt
"salt": 728402846,

// The average distance apart in chunks for spawn attempts
"spacing": 21,

// Minimum distance apart in chunks for spawn attempts
// MUST ALWAYS BE SMALLER THAN spacing ABOVE
"separation": 9,

// The kind of placement to use. The other kind is ring based like strongholds use.
"type": "minecraft:random_spread"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// What structures to pick to try and spawn if a spot passes the placement check.
// If two or more structures in this list can spawn in a biome at a spot, a random one based on weight is chosen to spawn
"structures": [
{
"structure": "nylemod:vladik_house",
"weight": 1
}
],
"placement": {
// Make sure this is unique and does not match any other structure set's salt
"salt": 355441213,

// The average distance apart in chunks for spawn attempts
"spacing": 19,

// Minimum distance apart in chunks for spawn attempts
// MUST ALWAYS BE SMALLER THAN spacing ABOVE
"separation": 7,

// The kind of placement to use. The other kind is ring based like strongholds use.
"type": "minecraft:random_spread"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// More info on template pools can be found here: https://minecraft.gamepedia.com/Custom_world_generation#JSON_format_8
// Yes, worldgen json files can have comments. Minecraft does "lenient" parsing of these json files.

"name": "nylemod_structures:run_down_house/side_pool",
"name": "nylemod:run_down_house/side_pool",
"fallback": "minecraft:empty",
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Yes, worldgen json files can have comments. Minecraft does "lenient" parsing of these json files.

// This is the name of the template pool itself. I tend to just put the file path and file name here with modid.
"name": "nylemod_structures:run_down_house/start_pool",
"name": "nylemod:run_down_house/start_pool",

// The template pool to refer to if the entries in 'elements' fails to generate.
"fallback": "minecraft:empty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// More info on template pools can be found here: https://minecraft.gamepedia.com/Custom_world_generation#JSON_format_8

// This is the name of the template pool itself. I tend to just put the file path and file name here with modid.
"name": "nylemod_structures:sky_fan",
"name": "nylemod:sky_fan",

// The template pool to refer to if the entries in 'elements' fails to generate.
"fallback": "minecraft:empty",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// More info on template pools can be found here: https://minecraft.gamepedia.com/Custom_world_generation#JSON_format_8
// Yes, worldgen json files can have comments. Minecraft does "lenient" parsing of these json files.

"name": "nylemod:storage_platform/side_pool",
"fallback": "minecraft:empty",
"elements": [
{
"weight": 1,
"element": {
"location": "nylemod:diamond_storage_platform",
"processors": "minecraft:empty",
"projection": "rigid",
"element_type": "minecraft:single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "nylemod:emerald_storage_platform",
"processors": "minecraft:empty",
"projection": "rigid",
"element_type": "minecraft:single_pool_element"
}
},
{
"weight": 1,
"element": {
"location": "nylemod:mythril_storage_platform",
"processors": "minecraft:empty",
"projection": "rigid",
"element_type": "minecraft:single_pool_element"
}
}
]
}
Loading

0 comments on commit 1ff722b

Please sign in to comment.