Jump to content

Recommended Posts

Posted

Hello All, I'm building a huge RPG mod.(and finally updated it to 1.10.2)

but i'm currently stuck at the part where i need to create NetherBiomes.

 

Overworld biomes are relatively easy to add. but i have no idea how to begin with the netherbiomes.

 

I want some parts of the nether(biomes) to generate my custom block instead of netherrack. with some flowers and  trees.

 

can someone give me some intructions on what classes i need to create to create biomes in the nether?

 

 

my Mod: Extended RPG [W.I.P]

Posted

This topic has come up within the last year, so a Google search should show you the earlier discussion(s) to get you started.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Hello All, I'm building a huge RPG mod.(and finally updated it to 1.10.2) but i'm currently stuck at the part where i need to create NetherBiomes.

 

Overworld biomes are relatively easy to add. but i have no idea how to begin with the netherbiomes.

 

I want some parts of the nether(biomes) to generate my custom block instead of netherrack. with some flowers and  trees.

 

can someone give me some intructions on what classes i need to create to create biomes in the nether?

 

I am working on a Nether Biome mod. Take a look: https://github.com/LogicTechCorp/NetherEx. Please do not copy-paste.

Posted

ok, got it to work. the only problem i have with this. is that the biomes are way to small. sometimes its like 1 or 2 chunks big per biome. where can i change that so they got the size of a overworld Biome?

 

is this bug because of (if you travel through the nether like 100 meters and you build a portal again to go through the overworld. and al the meters you traveled wil be multiplied by 7.( so you have moved 700 meters away).) and the biome uses this type of calculation too. or is there something wrong with my code?

 

i unregistered and registered the nether so I can add my own worldProvider. something LogicTechCorp also did in his code. and I have copied(and changed a little bit) the vanilla GenLayer/Providers Stuff.

everything is working( except a little bit lag in the nether and the XXS biomes

my Mod: Extended RPG [W.I.P]

Posted

ok, got it to work. the only problem i have with this. is that the biomes are way to small. sometimes its like 1 or 2 chunks big per biome. where can i change that so they got the size of a overworld Biome?

 

is this bug because of (if you travel through the nether like 100 meters and you build a portal again to go through the overworld. and al the meters you traveled wil be multiplied by 7.( so you have moved 700 meters away).) and the biome uses this type of calculation too. or is there something wrong with my code?

 

i unregistered and registered the nether so I can add my own worldProvider. something LogicTechCorp also did in his code. and I have copied(and changed a little bit) the vanilla GenLayer/Providers Stuff.

everything is working( except a little bit lag in the nether and the XXS biomes

 

Post your current ChunkProvider code. I had a similar issue with really small biomes, in my project a few weeks ago that I managed to fix. Need to see all of your biomesForGeneration setters, to see if you are facing the same issue that I had.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

Solved. thanks. i used a wrong setter for BiomeForGeneration. :P

 

only thing what i need to do is to generate trees and tall grass in the nether.

 

my Mod: Extended RPG [W.I.P]

Posted

Solved. thanks. i used a wrong setter for BiomeForGeneration. :P

 

only thing what i need to do is to generate trees and tall grass in the nether.

 

 

Well, as I mentioned in a previous post just today, I have an IWorldGenerator that places various trees for me, in a custom WorldType, WorldProvider, ChunkProvider etc. The actual dimension is heavily similar to the Nether, literally just stone instead of netherrack and so forth. You can find the link to said IWorldGenerator, in said thread.

 

As for the grass: How much of the grass do you want to spawn? If you want it to spawn quite a bit, but not take too much resources, I'd recommend you bake it directly into your chunkprovider.

In my own chunkprovider, I have a pseudo-dirt block that changes itself to grass|dirt|snow|sand|sandstone depending on biome and what is above it; this lets me easily add in 5 different blocks, at the world-generation cost of almost nothing.

ChunkProviders work directly with blockstates, whereas most custom worldgen 1) get block, 2) check block, 3) either stop or change block. This is heavy on performance.

You can see my voodoo-block here.

Take note on the snow-placing especially, as it checks if the blockpos above is suitable for another type of block, like you want for your grass.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

I already created A BiomeDecorater where I Spawned Trees and tall grass in the overworld

and this worked for 1.8.9 but I don't know if this still works in 1.10.2 because i havend found my own Biome yet.

 

I placed coins on the W button to let me flew 50 Km with a print that says ("Biome is here at" + pos.getX() + "x/ " + pos.getZ() + "z") when it is generated and i know this works because i tested it with the netherBiomes if it would work.

 

take a look at my BiomeDecorator here

 

public class MarkDecorator extends BiomeDecorator {

public MarkDecorator(Biome biome) {

    }
    
    public void decorate(World world, Random random, Biome base, BlockPos pos)
    {
    if (this.decorating)
    {
	    throw new RuntimeException("Already decorating!!");
    }
    else
    { 
    	this.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory(world.getWorldInfo().getGeneratorOptions()).build();
	    this.chunkPos = pos;
	    this.genDecorations(base, world, random);
	    this.decorating = false;
            
    }
    }

    protected void genDecorations(Biome base, World world, Random random)
    {
    	System.out.println("Decorating one of the biomes at : " + this.chunkPos.getX() + " / " + this.chunkPos.getZ());
    	
    	net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(world, random, chunkPos));
    if(base == MarkBiome.Biome_1_Enriched || base == MarkBiome.Biome_2_NetherDesert || base == MarkBiome.Biome_2_BlueNetherDesert)
    { 
        if(net.minecraftforge.event.terraingen.TerrainGen.decorate(world, random, chunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS))
            for (int i3 = 0; i3 < this.grassPerChunk; ++i3)
            {
            	int j7 = random.nextInt(16) + 8;
                int i11 = random.nextInt(16) + 8;
                int k14 = world.getHeight(this.chunkPos.add(j7, 0, i11)).getY() * 2;

                if (k14 > 0)
                {
                
                	int l17 = random.nextInt(k14);
                	if(base == MarkBiome.Biome_1_Enriched){
                    ((BiomeGenEnriched)base).getRandomWorldGenForGrass(random).generate(world, random, chunkPos.add(j7, l17, i11));
                	}
                	else if(base == MarkBiome.Biome_2_NetherDesert){
                    ((BiomeNetherD)base).getRandomWorldGenForGrass(random).generate(world, random, chunkPos.add(j7, l17, i11));
                    }
                	else if(base == MarkBiome.Biome_2_BlueNetherDesert){
                	((BiomeNetherBD)base).getRandomWorldGenForGrass(random).generate(world, random, chunkPos.add(j7, l17, i11));
                	}
                }
            }
        int k1 = this.treesPerChunk;

        if (random.nextInt(10) == 0)
        {
            ++k1;
        }

        if(net.minecraftforge.event.terraingen.TerrainGen.decorate(world, random, chunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)){
        for (int j2 = 0; j2 < k1; ++j2)
        {
            int k6 = random.nextInt(16) + 8;
            int l = random.nextInt(16) + 8;
            WorldGenAbstractTree worldgenabstracttree = base.genBigTreeChance(random);
            worldgenabstracttree.setDecorationDefaults();
            BlockPos blockpos = world.getHeight(chunkPos.add(k6, 0, l));

            if (worldgenabstracttree.generate(world, random, blockpos))
            {
                worldgenabstracttree.generateSaplings(world, random, blockpos);
            }
        }
    }}
    
    if(base == MarkBiome.Biome_1_Enriched)
    {
if(net.minecraftforge.event.terraingen.TerrainGen.decorate(world, random, chunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)){
        	
            for (int j3 = 0; j3 < 1; ++j3)
            {
                int k7 = random.nextInt(16) + 8;
                int j11 = random.nextInt(16) + 8;
                int l14 = world.getHeight(chunkPos.add(k7, 0, j11)).getY() * 2;

                if (l14 > 0)
                {
                	
                    int i18 = random.nextInt(l14);
                    (new WorldGenMarkCrystalBush()).generate(world, random, chunkPos.add(k7, i18, j11));
                }
            }
    }
        
    }
    }
}

 

and my BiomeGenBase Class

public class MarkBiome extends Biome {

public MarkBiome(BiomeProperties properties) {
	super(properties);
	this.theBiomeDecorator = new MarkDecorator(this);
}
public static void init(){
	initBiome();
	regBiome();

}
private static Set<BiomeManager.BiomeEntry> NetherEntries = Sets.newHashSet();
public static Biome Biome_1_Enriched;
public static Biome Biome_2_Nether;
public static Biome Biome_2_NetherDesert;
public static Biome Biome_2_BlueNether;
public static Biome Biome_2_BlueNetherDesert;

;



public static void initBiome(){

	DimensionManager.unregisterDimension(-1);
	DimensionType nether = DimensionType.register("Nether", "_nether", -1, NetherWorldProvider.class, false);
    DimensionManager.registerDimension(-1, nether);

	Biome_1_Enriched = new BiomeGenEnriched((new Biome.BiomeProperties("Enriched")).setBaseBiome("Enriched").setTemperature(1.2F).setRainfall(0.9F).setWaterColor(2653061));
	Biome_2_Nether = new BiomeNether((new Biome.BiomeProperties("Nether")).setRainDisabled());
	Biome_2_NetherDesert = new BiomeNetherD((new Biome.BiomeProperties("NetherDesert")).setRainDisabled());
	Biome_2_BlueNether = new BiomeCryst((new Biome.BiomeProperties("Cryst")).setRainDisabled());
	Biome_2_BlueNetherDesert = new BiomeCrystD((new Biome.BiomeProperties("CrystDesert")).setRainDisabled());



}
public static void regBiome(){
	BiomeDictionary.registerBiomeType(Biome_1_Enriched, Type.MAGICAL);
	BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(Biome_1_Enriched, 10));
	BiomeManager.addSpawnBiome(Biome_1_Enriched);

	AddNetherBiome(Biome_2_Nether, 45, 180, "Nether");
	AddNetherBiome(Biome_2_NetherDesert, 25, 181, "NetherDesert");
	AddNetherBiome(Biome_2_BlueNether, 17, 182, "BlueNether");
	AddNetherBiome(Biome_2_BlueNetherDesert, 13, 183, "BlueNetherDesert");
}

	public static void AddNetherBiome(Biome biome, int Weight, int ID, String Name)
	{
		Biome.registerBiome(ID, Name, biome);
		NetherEntries.add(new BiomeEntry(biome, Weight));
	}

	public static ImmutableList<BiomeManager.BiomeEntry> getBiomeEntries()
    {
        return ImmutableList.copyOf(NetherEntries);
    }

}	

 

the NetherBiomes were Registered with Biome.registerBiome because I needed a int ID to generate the biomes in the nether.

my Mod: Extended RPG [W.I.P]

Posted

Bump...

 

I even cant find the surface biomes... flew 50km again without succes, have seen every minecraft biome. and 80% of the biomes i Saw was Taiga btw.

 

What's wrong with my code (previous post for where I register the biomes, and my mainclass:

 

@EventHandler
public void init(FMLInitializationEvent Event){

...
        ClientProxy.registerRenderers();
        MarkBiome.init();

}

what is wrong with it am I so unlucky or...?

 

and got another problem, with My custom mob not rendering correctly(it's a white box now)

it worked in 1.8.9

 

Clientproxy:

  public static void registerRenderers(){
    	RenderingRegistry.registerEntityRenderingHandler(EntitySalaCommon.class, RenderSalaCommon::new);
    	RenderingRegistry.registerEntityRenderingHandler(EntitySalaDesert.class, RenderSalaDesert::new);
}

 

and here is the render class:

@SideOnly(Side.CLIENT)
public class RenderSalaCommon extends RenderLiving {

public static final ResourceLocation Texture_SalaCommon = new ResourceLocation(ReferenceStrings.MODID + ":textures/entity/salacommon.png");

public RenderSalaCommon(RenderManager rendermanagerIn) {
	super(rendermanagerIn, new ModelSalamander(), 0.5f);

}

protected ResourceLocation getEntityTexture1(EntitySalaCommon entity) {

	return Texture_SalaCommon;
}

@Override
protected ResourceLocation getEntityTexture(Entity entity) {

	return this.getEntityTexture1((EntitySalaCommon)entity);
}

}

 

this code fully worked in 1.8.9 until I updated the mod to 1.10.2

 

my Mod: Extended RPG [W.I.P]

  • 2 weeks later...
Posted

okay, found an alternative solution to generate my grass and trees in the nether

simply just add some code to my worldGenerator Class

 

checking what biome it is with:

 

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	switch (world.provider.getDimension()) {
case 0: //the surface dimension
...
break;
case -1: // the nether dimension
...
if(world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 0, chunkZ * 16)) == the biome i want) 
{
//then here the "this.RunGenerator(parameters);"
}

my Mod: Extended RPG [W.I.P]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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