Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author

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);
}

  • Author

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

  • Author

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();
    	
    }

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.