Jump to content

[1.7.10] remove orespawning


EmperorZelos

Recommended Posts

I am interested in making my own orespawner algorithm and I am curious how to delete or inhibit the inherent orespawning algorithm that minecrafts has

 

how would I go about doing that? I know I can just afterward replace all ore with cobblestone and start from scratch but that seems like an aweful lot of work for the computer.

 

Best regards

Link to comment
Share on other sites

Okey, I am trying this, I don't even get the message ive implemented so it doesn't reach the event, what am I doing wrong on it?

@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(OreGenEvent.GenerateMinable event)
{

	System.out.println("deny the ore damn it");
	event.setResult(Result.DENY);
}

Link to comment
Share on other sites

Yes, I put this event in my event handler that has been registered already and I know this because this is how it looks

 

package aerosteam.events;

import java.util.Random;

import aerosteam.AeroSteam;
import aerosteam.RandomFunctions;
import aerosteam.blocks.BlocksGases;
import aerosteam.gases.Gases;
import aerosteam.gases.gasDirection;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors;
import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.terraingen.OreGenEvent;
import net.minecraftforge.event.world.BlockEvent;
import cpw.mods.fml.common.eventhandler.Event.HasResult;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class EventASHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(FogColors event)
{
	if (event.entity instanceof EntityPlayer){
		Block block = event.block;
		//System.out.println("Is Player-" + x + "," + y + "," + z);
		if (block instanceof Gases){
			Gases gas = (Gases) block;
			//System.out.println("red: " + gas.red);
		    event.red = gas.red;
		    event.blue = gas.blue;
		    event.green = gas.green;
		}
	}
}

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(FogDensity event)
{
	//System.out.println("Fogged");
	if (event.entity instanceof EntityPlayer){
		Block block = event.block;
		//System.out.println("Is Player-" + x + "," + y + "," + z);
		if (block instanceof Gases){
			Gases gas = (Gases) block;
		    event.density = gas.fogdensity;
		}else event.density = (float) 0.0F;
	}else event.density = (float) 0.0F;
    event.setCanceled(true); // must be canceled to affect the fog density 
}
@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(LivingJumpEvent event)
{
    // DEBUG
    if (event.entity instanceof EntityPlayer)
    {
        EntityPlayer player=(EntityPlayer) event.entity;
        player.motionY += 0;
    }
        
}
@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(BlockEvent.BreakEvent event)
{
    if (event.block == Blocks.coal_ore || event.block == Blocks.coal_block){
		for (gasDirection check: gasDirection.VALID_DIRECTIONS){
			if (event.world.getBlock(event.x+check.offsetX, event.y+check.offsetY, event.z+check.offsetZ) == Blocks.air){
				//System.out.println("found free");
				if (RandomFunctions.BoolRndInt(3,1,7)){
					//System.out.println("random is good");
					event.world.setBlock(event.x+check.offsetX, event.y+check.offsetY, event.z+check.offsetZ,BlocksGases.coalDust);
				}					
			}
		}
    	
    }
        
}
@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(OreGenEvent.Pre event)
{

	System.out.println("Pre working");
	event.setResult(Result.DENY);
}

@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(OreGenEvent.GenerateMinable event)
{

	System.out.println("deny the ore damn it");
	event.setResult(Result.DENY);
}
@SubscribeEvent(priority=EventPriority.HIGHEST, receiveCanceled=true)
public void onEvent(TickEvent.WorldTickEvent event)
{
	//Include random meteors and natural disasters here

}


}

 

and BlockEvent.BreakEvent fires off without a problem generating the coaldust like I want it to

Link to comment
Share on other sites

this is where it is registered too

  @EventHandler
    public void preInit(FMLInitializationEvent event)
    {
    	BlocksAS.Init();
    	BlocksPipes.Init();
    	BlocksGases.Init();
    	ItemsAS.Init();
    	FMLCommonHandler.instance().bus().register(new AnvilSmithingHandler());
        MinecraftForge.EVENT_BUS.register(new EventASHandler());
    	FMLCommonHandler.instance().bus().register(new EventASHandler());
    	//ItemsAS.Init();

    	//stuff
    	NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

    	BiomesAS.init();
    	
    	RecipeRemover.removeRecipe();
    	CraftingRecipes.addRecipes();
    	//Steam stuff
    	
    	//Entity
    	EntityHandler.registerDayMob(MobThief.class, "Thief");
    	
    	
        //RenderingRegistry.registerBlockHandler(RenderBlockGases.instance);
    	//achievementStoneAge=new Achievement()
    	
    	
    	//GameRegistry.registerFuelHandler(new FuelHandler());
    	//Generate world
    	GameRegistry.registerWorldGenerator(eventWorldGen, 0);
    	
    	//Renders
    	neoProxy.registerRenderThings();
    	
    }

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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