本文整理汇总了Java中net.minecraftforge.event.terraingen.OreGenEvent类的典型用法代码示例。如果您正苦于以下问题:Java OreGenEvent类的具体用法?Java OreGenEvent怎么用?Java OreGenEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OreGenEvent类属于net.minecraftforge.event.terraingen包,在下文中一共展示了OreGenEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateOres
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void generateOres(OreGenEvent.Post event) {
if (event.getWorld().provider.getDimension() == 0) {
if (TF2weapons.generateCopper) {
generateOre(TF2weapons.blockCopperOre.getDefaultState(), 7, 9, 32, 80, event.getWorld(), event.getRand(), event.getPos());
generateOre(TF2weapons.blockCopperOre.getDefaultState(), 7, 1, 0, 32, event.getWorld(), event.getRand(), event.getPos());
}
if (TF2weapons.generateLead) {
generateOre(TF2weapons.blockLeadOre.getDefaultState(), 5, 7, 24, 74, event.getWorld(), event.getRand(), event.getPos());
generateOre(TF2weapons.blockLeadOre.getDefaultState(), 5, 1, 0, 24, event.getWorld(), event.getRand(), event.getPos());
}
if (TF2weapons.generateAustralium) {
generateOre(TF2weapons.blockAustraliumOre.getDefaultState(), 3, 4, 0, 24, event.getWorld(), event.getRand(), event.getPos());
}
}
}
示例2: oreGenMinable
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
/** Alters vanilla ore generation. */
@SubscribeEvent
public void oreGenMinable(OreGenEvent.GenerateMinable event) {
OreGenEvent.GenerateMinable.EventType type = event.getType();
// Cancel vanilla ores to be overriden
if (type == OreGenEvent.GenerateMinable.EventType.COAL ||
type == OreGenEvent.GenerateMinable.EventType.DIAMOND ||
type == OreGenEvent.GenerateMinable.EventType.EMERALD ||
type == OreGenEvent.GenerateMinable.EventType.GOLD ||
type == OreGenEvent.GenerateMinable.EventType.IRON ||
type == OreGenEvent.GenerateMinable.EventType.LAPIS ||
type == OreGenEvent.GenerateMinable.EventType.REDSTONE) {
event.setResult(Event.Result.DENY);
}
}
示例3: genDisabler
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void genDisabler(OreGenEvent.GenerateMinable event)
{
EventType type = event.type;
if (type == EventType.COAL || type == EventType.DIAMOND || type == EventType.GOLD || type == EventType.IRON
|| type == EventType.LAPIS || type == EventType.QUARTZ || type == EventType.REDSTONE || type == EventType.EMERALD)
{
if(ConfigOptions.disableVanillaOres)
{
event.setResult(Result.DENY);
}
}
else if (type == EventType.ANDESITE || type == EventType.DIORITE || type == EventType.GRANITE || type == EventType.GRAVEL || type == EventType.DIRT)
{
if(ConfigOptions.disableVanillaOthers)
{
event.setResult(Result.DENY);
}
}
}
示例4: onOreGenMinable
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOreGenMinable(OreGenEvent.GenerateMinable event)
{
Configs configs = Configs.get(event.getWorld());
EventType type = event.getType();
// Disable custom ores, if a mod happens to fire the event
if (type == EventType.CUSTOM)
{
if (configs.minableIsDisabled(type))
{
event.setResult(Event.Result.DENY);
}
}
// Disable ALL vanilla generation, including dirt and gravel pockets.
else if (configs.minablesDisableAllVanillaGeneration())
{
event.setResult(Event.Result.DENY);
}
// Disable individual types
else if (configs.minableIsDisabled(type))
{
event.setResult(Event.Result.DENY);
}
}
示例5: onOreGeneration
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOreGeneration(OreGenEvent.GenerateMinable event)
{
if(ConfigValues.SPAWN_WORLD_CRATER)
{
if(event.getWorld().provider.getDimension() == 0)
{
int x = event.getPos().getX();
int z = event.getPos().getZ();
if(Math.sqrt((x*x) + (z*z)) < 378)
{
event.setResult(Event.Result.DENY);
}
}
}
}
示例6: onWorldGen
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onWorldGen(OreGenEvent.GenerateMinable event) {
if(event.world.provider instanceof WorldProviderPlanet &&
DimensionManager.getInstance().getDimensionProperties(event.world.provider.dimensionId).getOreGenProperties(event.world) != null) {
switch(event.type) {
case COAL:
case DIAMOND:
case GOLD:
case IRON:
case LAPIS:
case QUARTZ:
case REDSTONE:
case CUSTOM:
event.setResult(Result.DENY);
break;
default:
event.setResult(Result.DEFAULT);
}
}
}
示例7: generateOres
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
/**
* Generates ores in the current chunk
*/
protected void generateOres()
{
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT))
this.genStandardOre3(20, this.dark_dirtGen, 0, 256);
if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, chunk_X, chunk_Z, GRAVEL))
this.genStandardOre3(10, this.dark_gravelGen, 0, 256);
if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, chunk_X, chunk_Z, COAL))
this.genStandardOre3(20, this.dark_coalGen, 0, 128);
if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, chunk_X, chunk_Z, IRON))
this.genStandardOre3(20, this.dark_ironGen, 0, 64);
if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, chunk_X, chunk_Z, GOLD))
this.genStandardOre3(2, this.dark_goldGen, 0, 32);
if (TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, chunk_X, chunk_Z, DIAMOND))
this.genStandardOre3(1, this.dark_diamondGen, 0, 16);
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
示例8: generate
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
random.setSeed(random.nextLong() ^ hash);
random.nextInt();
final float r = random.nextFloat();
for(float f = frequency; f > r; f -= 1 ){
int x = (chunkX << 4) + random.nextInt(16);
int y = random.nextInt(maxY - minY) + minY;
int z = (chunkZ << 4) + random.nextInt(16);
// System.out.println("Generating deposite of "+ore.getUnlocalizedName()+" at ("+x+","+y+","+z+")");
BlockPos pos = new BlockPos(x,y,z);
OreGenEvent oreEvent = new OreGenEvent(world,random,pos);
net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(oreEvent);
if(oreEvent.getResult() == Event.Result.DENY) {
// canceled by other mod
continue;
}
oreGen.generate(world, random, pos);
}
}
示例9: onOreGenPost
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOreGenPost(OreGenEvent.Post event) {
if (!event.getPos().equals(this.pos)) {
this.pos = event.getPos();
generatorSulfurOre.generate(event.getWorld(), event.getRand(), event.getPos());
}
}
示例10: generate
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
if (TerrainGen.generateOre(worldIn, rand, this, position, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
for (int i = 0; i < 18; ++i) {
int posX = position.getX() + rand.nextInt(16);
int posY = 10 + rand.nextInt(60);
int posZ = position.getZ() + rand.nextInt(16);
BlockPos blockPos = new BlockPos(posX, posY, posZ);
sulfurOreGenerator.generate(worldIn, rand, blockPos);
}
}
return true;
}
示例11: noDirt
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void noDirt(final OreGenEvent.GenerateMinable event) {
if (event.world.provider.dimensionId == ExtraUtils.underdarkDimID) {
switch (event.type) {
case DIRT:
case GRAVEL: {
event.setResult(Event.Result.DENY);
break;
}
}
}
}
示例12: onOreGen
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@SubscribeEvent
public void onOreGen(OreGenEvent.GenerateMinable e)
{
if (e.getType().equals(OreGenEvent.GenerateMinable.EventType.IRON)
|| e.getType().equals(OreGenEvent.GenerateMinable.EventType.GOLD)
|| e.getType().equals(OreGenEvent.GenerateMinable.EventType.REDSTONE))
e.setResult(Event.Result.DENY);
}
示例13: OreGeneratorSetting
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
public OreGeneratorSetting(int size, int count, int minH, int maxH, OreGenEvent.GenerateMinable.EventType type) {
this.size = size;
this.count = count;
this.minH = minH;
this.maxH = maxH;
this.dH = maxH - minH;
this.type = type;
}
示例14: Configs
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
private Configs(File configFile, boolean isMaster)
{
this.disabledMinables = new HashMap<OreGenEvent.GenerateMinable.EventType, Boolean>();
this.disabledDecorations = new HashMap<DecorateBiomeEvent.Decorate.EventType, Boolean>();
this.disabledPopulations = new HashMap<PopulateChunkEvent.Populate.EventType, Boolean>();
this.loadConfigs(configFile, isMaster);
}
示例15: generate
import net.minecraftforge.event.terraingen.OreGenEvent; //导入依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
OreGenEvent event = new OreGenEvent.GenerateMinable(world, random, this, chunkX, chunkZ, EventType.CUSTOM);
MinecraftForge.ORE_GEN_BUS.post(event);
if(event.getResult() != Result.DENY) {
if(Configuration.generateCopper) {
generate(world, MaterialRegistry.getMaterialFromName("Copper"), Configuration.copperPerChunk, Configuration.copperClumpSize, chunkX, chunkZ, random);
}
if(Configuration.generateTin) {
generate(world, MaterialRegistry.getMaterialFromName("Tin"), Configuration.tinPerChunk, Configuration.tinClumpSize, chunkX, chunkZ, random);
}
if(Configuration.generateRutile) {
generate(world, MaterialRegistry.getMaterialFromName("Rutile"), Configuration.rutilePerChunk, Configuration.rutileClumpSize, chunkX, chunkZ, random);
}
if(Configuration.generateAluminum) {
generate(world, MaterialRegistry.getMaterialFromName("Aluminum"), Configuration.aluminumPerChunk, Configuration.aluminumClumpSize, chunkX, chunkZ, random);
}
if(Configuration.generateDilithium) {
int dilithiumChance = Configuration.dilithiumPerChunk;
if(world.provider instanceof WorldProviderPlanet) {
dilithiumChance = DimensionProperties.AtmosphereTypes.getAtmosphereTypeFromValue(DimensionManager.getInstance().getDimensionProperties(world.provider.dimensionId).getAtmosphereDensity()) == DimensionProperties.AtmosphereTypes.NONE ? Configuration.dilithiumPerChunkMoon : Configuration.dilithiumPerChunk;;
}
for(int i = 0; i < dilithiumChance; i++) {
int coordX = 16*chunkX + random.nextInt(16);
int coordY = random.nextInt(64);
int coordZ = 16*chunkZ + random.nextInt(16);
new WorldGenMinable(MaterialRegistry.getMaterialFromName("Dilithium").getBlock(), MaterialRegistry.getMaterialFromName("Dilithium").getMeta(), Configuration.dilithiumClumpSize, Blocks.stone).generate(world, random, coordX, coordY, coordZ);
}
}
}
}