net.minecraft.world.DimensionType Java Examples

The following examples show how to use net.minecraft.world.DimensionType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OreGenerator.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
public void generateWorld(Random random, int chunkX, int chunkZ, World world, boolean newGen) {
    if (!newGen && !OregenConfig.RETROGEN) {
        return;
    }

    if (world.provider.getDimension() == DimensionType.OVERWORLD.getId()) {
        if (OregenConfig.GENERATE_OVERWORLD) {
            addOreSpawn(ModBlocks.blockFancyOre, (byte) OreType.ORE_OVERWORLD.ordinal(), Blocks.STONE, world, random, chunkX * 16, chunkZ * 16,
                    OregenConfig.MIN_VEIN_SIZE, OregenConfig.MAX_VEIN_SIZE, OregenConfig.CHANCES_TO_SPAWN, OregenConfig.MIN_Y, OregenConfig.MAX_Y);
        }
    } else if (world.provider.getDimension() == DimensionType.NETHER.getId()) {
        if (OregenConfig.GENERATE_NETHER) {
            addOreSpawn(ModBlocks.blockFancyOre, (byte) OreType.ORE_NETHER.ordinal(), Blocks.NETHERRACK, world, random, chunkX * 16, chunkZ * 16,
                    OregenConfig.MIN_VEIN_SIZE, OregenConfig.MAX_VEIN_SIZE, OregenConfig.CHANCES_TO_SPAWN, OregenConfig.MIN_Y, OregenConfig.MAX_Y);
        }
    } else if (world.provider.getDimension() == DimensionType.THE_END.getId()) {
        if (OregenConfig.GENERATE_END) {
            addOreSpawn(ModBlocks.blockFancyOre, (byte) OreType.ORE_END.ordinal(), Blocks.END_STONE, world, random, chunkX * 16, chunkZ * 16,
                    OregenConfig.MIN_VEIN_SIZE, OregenConfig.MAX_VEIN_SIZE, OregenConfig.CHANCES_TO_SPAWN, OregenConfig.MIN_Y, OregenConfig.MAX_Y);
        }
    }

    if (!newGen) {
        world.getChunk(chunkX, chunkZ).markDirty();
    }
}
 
Example #2
Source File: WorldGenAbandonedBase.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (ConfigHolder.abandonedBaseRarity == 0 ||
        world.getWorldType() == WorldType.FLAT ||
        world.provider.getDimensionType() != DimensionType.OVERWORLD ||
        !world.getWorldInfo().isMapFeaturesEnabled()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);

    if (random.nextInt(ConfigHolder.abandonedBaseRarity) == 0) {
        int variantNumber = random.nextInt(3);
        Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
        ResourceLocation templateId = new ResourceLocation(GTValues.MODID, "abandoned_base/abandoned_base_1_" + variantNumber);
        Template template = TemplateManager.getBuiltinTemplate(world, templateId);
        BlockPos originPos = template.getZeroPositionWithTransform(randomPos, Mirror.NONE, rotation);
        originPos = TemplateManager.calculateAverageGroundLevel(world, originPos, template.getSize());
        template.addBlocksToWorld(world, originPos, new PlacementSettings().setRotation(rotation));
    }
}
 
Example #3
Source File: BlockTofuPortal.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Called When an Entity Collided with the Block
 */

@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {

    if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss()) {
        MinecraftServer server = worldIn.getMinecraftServer();
        if (server != null && entityIn.timeUntilPortal <= 0) {
            PlayerList playerList = server.getPlayerList();
            int i = entityIn.dimension == DimensionType.OVERWORLD.getId() ?
                    TofuMain.TOFU_DIMENSION.getId() : DimensionType.OVERWORLD.getId();
            TofuTeleporter teleporter = new TofuTeleporter(server.getWorld(i));
            entityIn.timeUntilPortal = 100;

            if (entityIn instanceof EntityPlayerMP) {
                playerList.transferPlayerToDimension((EntityPlayerMP) entityIn, i, teleporter);
            } else {
                int origin = entityIn.dimension;
                entityIn.dimension = i;
                worldIn.removeEntityDangerously(entityIn);
                entityIn.isDead = false;
                playerList.transferEntityToWorld(entityIn, origin, server.getWorld(origin), server.getWorld(i),
                        teleporter);

            }


        } else
            entityIn.timeUntilPortal = Math.max(entityIn.getPortalCooldown(), 100);
    }

}
 
Example #4
Source File: YUNoMakeGoodMap.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@EventHandler
public void load(FMLInitializationEvent event)
{
    FMLLog.log(Level.INFO, "YUNoMakeGoodMap Initalized");
    worldType = new VoidWorldType();

    DimensionManager.unregisterDimension(-1);
    DimensionManager.unregisterDimension(0);
    DimensionManager.unregisterDimension(1);
    DimensionManager.registerDimension(-1, DimensionType.register("Nether", "_nether", -1, WorldProviderHellVoid.class, false));
    DimensionManager.registerDimension(0,  DimensionType.register("Overworld", "", 0, WorldProviderSurfaceVoid.class, true));
    DimensionManager.registerDimension(1,  DimensionType.register("The End", "_end", 1, WorldProviderEndVoid.class, false));
}
 
Example #5
Source File: TargetData.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String getDimensionName(boolean useFallback)
{
    try
    {
        return DimensionType.getById(this.dimension).getName();
    }
    catch (Exception e)
    {
        EnderUtilities.logger.trace("Failed to get DimensionType by id (" + this.dimension + ")");
    }

    return useFallback ? "DIM: " + this.dimension : "";
}
 
Example #6
Source File: ItemPortalScaler.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Vec3d getDestinationPosition(ItemStack stack, EntityPlayer player, int destDimension)
{
    ItemStack cardStack = this.getSelectedModuleStack(stack, ModuleType.TYPE_MEMORY_CARD_MISC);
    NBTTagCompound moduleNbt = cardStack.getTagCompound();
    NBTTagCompound tag = moduleNbt.getCompoundTag("PortalScaler");
    byte scaleX = tag.getByte("scaleX");
    byte scaleY = tag.getByte("scaleY");
    byte scaleZ = tag.getByte("scaleZ");

    // Don't divide by zero on accident!!
    if (scaleX == 0) { scaleX = 8; }
    if (scaleY == 0) { scaleY = 1; }
    if (scaleZ == 0) { scaleZ = 8; }

    double dScaleX = scaleX;
    double dScaleY = scaleY;
    double dScaleZ = scaleZ;

    if (scaleX < 0) { dScaleX = -1.0d / (double)scaleX; }
    if (scaleY < 0) { dScaleY = -1.0d / (double)scaleY; }
    if (scaleZ < 0) { dScaleZ = -1.0d / (double)scaleZ; }

    // Going from the Overworld to the Nether
    if (destDimension == DimensionType.NETHER.getId())
    {
        dScaleX = 1.0d / dScaleX;
        dScaleY = 1.0d / dScaleY;
        dScaleZ = 1.0d / dScaleZ;
    }

    World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(destDimension);
    return PositionUtils.getScaledClampedPosition(player.getPositionVector(), world, dScaleX, dScaleY, dScaleZ, 32);
}
 
Example #7
Source File: DimensionProperty.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public String helpText() {
  final StringBuilder builder = new StringBuilder("{");
  Iterator<DimensionType> it = dimensions.iterator();
  while (it.hasNext()) {
    String name = it.next().getName();
    builder.append(name);
    if (it.hasNext()) {
      builder.append(", ");
    }
  }
  builder.append("}");
  return builder.toString();
}
 
Example #8
Source File: DimensionProperty.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public void deserialize(JsonReader reader) throws IOException {
  reader.beginArray();
  while (reader.hasNext() && reader.peek().equals(JsonToken.STRING)) {
    String dim = reader.nextString();
    for (DimensionType type : DimensionType.values()) {
      if (Objects.equals(type.getName(), dim)) {
        add(type);
        break;
      }
    }
  }
}
 
Example #9
Source File: DimensionProperty.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public void serialize(JsonWriter writer) throws IOException {
  writer.beginArray();
  for (DimensionType dimension : dimensions) {
    writer.value(dimension.getName());
  }
  writer.endArray();
}
 
Example #10
Source File: GTWorldGen.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	Biome biomegenbase = world.getBiome(new BlockPos(chunkX * 16 + 16, 128, chunkZ * 16 + 16));
	// Any Biome
	GTOreGenerator.generateBasicVein(GTBlocks.oreIridium, GTConfig.generation.iridiumGenerate, GTConfig.generation.iridiumSize, GTConfig.generation.iridiumWeight, 0, 128, Blocks.STONE, world, random, chunkX, chunkZ);
	// Jungle Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.JUNGLE)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSheldonite, GTConfig.generation.sheldoniteGenerate, GTConfig.generation.sheldoniteSize, GTConfig.generation.sheldoniteWeight, 10, 30, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Hot Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.HOT)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreRuby, GTConfig.generation.rubyGenerate, GTConfig.generation.rubySize, GTConfig.generation.rubyWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Ocean Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.OCEAN) || BiomeDictionary.hasType(biomegenbase, Type.BEACH)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSapphire, GTConfig.generation.sapphireGenerate, GTConfig.generation.sapphireSize, GTConfig.generation.sapphireWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Forest or Plains Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.FOREST)
			|| (BiomeDictionary.hasType(biomegenbase, Type.PLAINS))) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreBauxite, GTConfig.generation.bauxiteGenerate, GTConfig.generation.bauxiteSize, GTConfig.generation.bauxiteWeight, 50, 120, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	if (world.provider.getDimensionType().equals(DimensionType.OVERWORLD)) {
		for (Block block : GTBedrockOreHandler.getBedrockOreMap().keySet()) {
			if (GTBedrockOreHandler.shouldGTCHandleGeneration(block)) {
				GTOreGenerator.generateBedrockVein(block, world, random, chunkX, chunkZ);
			}
		}
	}
}
 
Example #11
Source File: TofuMain.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit(event);

    logger = event.getModLog();

    TofuEntityRegister.entitySpawn();

    TofuCompat.preInit();

    GameRegistry.registerWorldGenerator(new TofuOreGenerator(), 0);

    MapGenStructureIO.registerStructure(MapGenTofuVillage.Start.class,"TofuVillage");
    StructureTofuVillagePieces.registerVillagePieces();
    MapGenStructureIO.registerStructure(StructureTofuMineshaftStart.class,"TofuMineshaft");
    StructureTofuMineshaftPieces.registerStructurePieces();
    MapGenStructureIO.registerStructure(MapGenTofuCastle.Start.class, "TofuCastle");
    TofuCastlePiece.registerTofuCastlePiece();

    NetworkRegistry.INSTANCE.registerGuiHandler(this, new TofuGuiHandler());


    zunda = new DamageSource("zunda") {
        @Override
        public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn) {
            String s = "death.attack.zunda";
            String s1 = s + ".player";

            return new TextComponentString(entityLivingBaseIn.getDisplayName().getFormattedText() + " ").appendSibling(new TextComponentTranslation(s1, new Object[]{entityLivingBaseIn.getDisplayName()}));
        }
    }.setDamageIsAbsolute();

    TOFU_DIMENSION = DimensionType.register("Tofu World", "_tofu", TofuConfig.dimensionID, WorldProviderTofu.class, false);
    DimensionManager.registerDimension(TofuConfig.dimensionID, TOFU_DIMENSION);

    TofuVillages.register();
}
 
Example #12
Source File: WorldProviderUnderWorld.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
public DimensionType getDimensionType() {
	return Wizardry.underWorld;
}
 
Example #13
Source File: WorldProviderTofu.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public DimensionType getDimensionType() {
    return TofuMain.TOFU_DIMENSION;
}
 
Example #14
Source File: ItemPortalScaler.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Vec3d getNormalDestinationPosition(EntityPlayer player, int destDimension)
{
    double scale = destDimension == DimensionType.OVERWORLD.getId() ? 8d : 1d / 8d;
    return PositionUtils.getScaledClampedPosition(player.getPositionVector(), null, scale, 1d, scale, 32);
}
 
Example #15
Source File: WorldProviderSurface.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DimensionType getDimensionType() {
	return DimensionTFC.SURFACE;
}
 
Example #16
Source File: WorldProviderPaths.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public DimensionType getDimensionType() 
{
	return DimensionTFC.PATHS;
}
 
Example #17
Source File: ProviderDummy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public DimensionType getDimensionType() {
	return DimensionType.NETHER;
}
 
Example #18
Source File: WorldProviderPlanet.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public DimensionType getDimensionType() {
	return DimensionManager.PlanetDimensionType;
}
 
Example #19
Source File: WorldProviderTorikki.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
public DimensionType getDimensionType() {
	return Wizardry.torikki;
}
 
Example #20
Source File: GTEventCheckSpawn.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onSpawn(CheckSpawn event) {
	if (event.getResult() == Event.Result.ALLOW) {
		return;
	}
	if (event.getEntityLiving().isCreatureType(EnumCreatureType.MONSTER, false)) {
		Entity entity = event.getEntity();
		BlockPos spawn = entity.getEntityWorld().getSpawnPoint();
		// This is the code for the safe spawn zone
		if (GTConfig.general.preventMobSpawnsCloseToSpawn
				&& entity.getEntityWorld().provider.getDimensionType().equals(DimensionType.OVERWORLD)
				&& entity.getPosition().distanceSq(spawn.getX(), spawn.getY(), spawn.getZ()) <= 128 * 128) {
			event.setResult(Event.Result.DENY);
		}
		// this is code for zombies spawning with pickaxes
		if (GTConfig.general.caveZombiesSpawnWithPickaxe && entity instanceof EntityZombie && event.getY() <= 50.0F
				&& event.getWorld().rand.nextInt(2) == 0) {
			EntityZombie zombie = (EntityZombie) entity;
			ItemStack tool = getRandomPickaxe(event.getWorld().rand);
			int damage = event.getWorld().rand.nextInt(tool.getMaxDamage() + 1);
			tool.damageItem(GTHelperMath.clip(damage, 1, tool.getMaxDamage() - 1), zombie);
			zombie.setHeldItem(EnumHand.MAIN_HAND, tool);
		}
		// This is the code for the mob repellator
		for (int[] rep : mobReps) {
			World world = event.getEntity().getEntityWorld();
			if (rep[3] == world.provider.getDimension()) {
				TileEntity tile = world.getTileEntity(new BlockPos(rep[0], rep[1], rep[2]));
				if (tile instanceof GTTileMobRepeller) {
					int r = ((GTTileMobRepeller) tile).range;
					double dx = rep[0] + 0.5F - event.getEntity().posX;
					double dy = rep[1] + 0.5F - event.getEntity().posY;
					double dz = rep[2] + 0.5F - event.getEntity().posZ;
					if ((dx * dx + dz * dz + dy * dy) <= Math.pow(r, 2)) {
						event.setResult(Event.Result.DENY);
					}
				}
			}
		}
	}
}
 
Example #21
Source File: CommonProxy.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void preInit(FMLPreInitializationEvent event) {
		directory = new File(event.getModConfigurationDirectory(), Wizardry.MODID);
		if (!directory.exists()) if (!directory.mkdirs())
			Wizardry.LOGGER.fatal("    > SOMETHING WENT WRONG! Could not create config folder!!");

		new SpellData.DefaultKeys();

		ManifestUpgrader maniUpgrader = ManifestHandler.INSTANCE.startUpgrade(directory);
		maniUpgrader.changeCategoryName("modules", "wizmodules");
		maniUpgrader.finalizeUpgrade();

		ManifestHandler.INSTANCE.loadNewInternalManifest("wizmodules", "fluid_recipes", "fire_recipes");
		ManifestHandler.INSTANCE.loadExternalManifest(directory);
		ManifestHandler.INSTANCE.processComparisons(directory, "wizmodules", "fluid_recipes", "fire_recipes");

		new ModTab();
		ModBlocks.init();
		ModItems.init();
		ModSounds.init();
		ModPotions.init();
		ModEntities.init();
		ModCapabilities.preInit();

		NetworkRegistry.INSTANCE.registerGuiHandler(Wizardry.instance, new GuiHandler());

		Wizardry.underWorld = DimensionType.register("underworld", "_dim", ConfigValues.underworldID, WorldProviderUnderWorld.class, false);
//		Wizardry.torikki = DimensionType.register("torikki", "_dim", ConfigValues.torikkiID, WorldProviderTorikki.class, false);
		DimensionManager.registerDimension(ConfigValues.underworldID, Wizardry.underWorld);
//		DimensionManager.registerDimension(ConfigValues.torikkiID, Wizardry.torikki);

		MinecraftForge.EVENT_BUS.register(ArenaManager.INSTANCE);
		MinecraftForge.EVENT_BUS.register(new WorldProviderUnderWorld());
		MinecraftForge.EVENT_BUS.register(new EventHandler());
		MinecraftForge.EVENT_BUS.register(new AchievementEvents());
		MinecraftForge.EVENT_BUS.register(new ModuleEffectTimeSlow());
		MinecraftForge.EVENT_BUS.register(new ModuleEffectLeap());
		MinecraftForge.EVENT_BUS.register(ModBiomes.BIOME_UNDERWORLD);
//		MinecraftForge.EVENT_BUS.register(ModBiomes.BIOME_TORIKKI);
//		MinecraftForge.EVENT_BUS.register(ModBiomes.BIOME_TORIKKISEA);
		MinecraftForge.EVENT_BUS.register(this);

		WizardryWorldCapability.init();
		WizardryChunkCapability.init();

		PacketHandler.register(PacketSendSpellToBook.class, Side.SERVER);
		PacketHandler.register(PacketRenderSpell.class, Side.CLIENT);
		PacketHandler.register(PacketExplode.class, Side.CLIENT);
		PacketHandler.register(PacketFreezePlayer.class, Side.CLIENT);
		PacketHandler.register(PacketRenderLightningBolt.class, Side.CLIENT);
		PacketHandler.register(PacketSyncCooldown.class, Side.CLIENT);
		PacketHandler.register(PacketDevilDustFizzle.class, Side.CLIENT);


		PageTypes.INSTANCE.registerPageProvider("wizardry_structure", PageWizardryStructure::new);
		ItemBook.BOOK = new Book("book");

		Wizardry.LOGGER.info("Initializing fairy task plugins...");
		for (final WizardryPlugin plugin : ServiceLoader.load(WizardryPlugin.class)) {
			Wizardry.LOGGER.info("Initializing plugin {}", plugin.getClass().getName());
			plugin.onInit(context);
		}
		Wizardry.LOGGER.info("Initialization complete!");
	}
 
Example #22
Source File: SpaceWorldProvider.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public DimensionType getDimensionType() {
	return Space.SPACE;
}
 
Example #23
Source File: StorageWorldProvider.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
   public DimensionType getDimensionType() {
return StorageDimReg.storageDimensionType;
   }
 
Example #24
Source File: StorageDimReg.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static void registerDimensionTypes() {
	storageDimensionType = DimensionType.register(CommunityGlobals.MOD_ID, "_storage", 984637,
			StorageWorldProvider.class, true);
}
 
Example #25
Source File: DimensionProperty.java    From ForgeHax with MIT License 4 votes vote down vote up
private boolean remove(DimensionType type) {
  return type != null && dimensions.remove(type);
}
 
Example #26
Source File: DimensionProperty.java    From ForgeHax with MIT License 4 votes vote down vote up
private boolean add(DimensionType type) {
  return type != null && dimensions.add(type);
}
 
Example #27
Source File: OreGenerator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
public void generateWorld(Random random, int chunkX, int chunkZ, World world, boolean newGen) {
    if (!newGen && !EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.RETROGEN) {
        return;
    }

    if (world.provider.getDimension() == DimensionType.OVERWORLD.getId()) {

        if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_OVERWORLD) {

            validBiomes = new ArrayList<Biome>();

            validBiomes.add(Biomes.BEACH);
            validBiomes.add(Biomes.OCEAN);
            validBiomes.add(Biomes.DEEP_OCEAN);
            validBiomes.add(Biomes.FROZEN_OCEAN);
            validBiomes.add(Biomes.RIVER);
            validBiomes.add(Biomes.FROZEN_RIVER);
            validBiomes.add(Biomes.SWAMPLAND);

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_DIRT) {
                addOreSpawn(ModBlocks.polluteddirt, (byte) 0, Blocks.DIRT, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.DIRT_BIOME_RESTRICTION);
            }

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_SAND) {
                addOreSpawn(ModBlocks.pollutedsand, (byte) 0, Blocks.SAND, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.SAND_BIOME_RESTRICTION);
            }

            if (EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GENERATE_GRAVEL) {
                addOreSpawn(ModBlocks.pollutedgravel, (byte) 0, Blocks.GRAVEL, world, random, chunkX * 16, chunkZ * 16,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MIN_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MAX_VEIN_SIZE,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_CHANCES_TO_SPAWN,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MIN_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_MAX_Y,
                        EmergingTechnologyConfig.POLYMERS_MODULE.WORLDGEN.GRAVEL_BIOME_RESTRICTION);
            }
        }
    }

    if (!newGen) {
        world.getChunkFromChunkCoords(chunkX, chunkZ).markDirty();
    }
}
 
Example #28
Source File: GTEventPopulateChunk.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
	public void onEvent(PopulateChunkEvent.Post event) {
		if (!event.getWorld().provider.getDimensionType().equals(DimensionType.OVERWORLD)) {
			return;
		}
		if (GTConfig.general.replaceOceanGravelWithSand) {
			Chunk chunk = event.getWorld().getChunkFromChunkCoords(event.getChunkX(), event.getChunkZ());
			for (int x = 0; x < 16; ++x) {
				for (int z = 0; z < 16; ++z) {
					Biome biomegenbase = event.getWorld().getBiome(new BlockPos(chunk.x * 16 + x, 128, chunk.z * 16
							+ z));
					if (BiomeDictionary.hasType(biomegenbase, Type.OCEAN)
							|| BiomeDictionary.hasType(biomegenbase, Type.BEACH)) {
						for (int y = 30; y < 60; ++y) {
							if (chunk.getBlockState(x, y, z).getBlock() == BLOCK_GRAVEL) {
								chunk.setBlockState(new BlockPos(x, y, z), BLOCK_SAND.getDefaultState());
							}
						}
					}
				}
			}
			chunk.markDirty();
		}
//		if (GTConfig.general.redSandInForestsAndPlains) {
//			Chunk chunk = event.getWorld().getChunkFromChunkCoords(event.getChunkX(), event.getChunkZ());
//			for (int x = 0; x < 16; ++x) {
//				for (int z = 0; z < 16; ++z) {
//					Biome biomegenbase = event.getWorld().getBiome(new BlockPos(chunk.x * 16 + x, 128, chunk.z * 16
//							+ z));
//					if (BiomeDictionary.hasType(biomegenbase, Type.FOREST)
//							|| BiomeDictionary.hasType(biomegenbase, Type.PLAINS)) {
//						for (int y = 30; y < 80; ++y) {
//							if (chunk.getBlockState(x, y, z).getBlock() == BLOCK_SAND) {
//								chunk.setBlockState(new BlockPos(x, y, z), BLOCKSTATE_RED_SAND);
//							}
//						}
//					}
//				}
//			}
//			chunk.markDirty();
//		}
	}
 
Example #29
Source File: BlockTofuPortal.java    From TofuCraftReload with MIT License 2 votes vote down vote up
@SuppressWarnings("unused")
private boolean changeDim(EntityPlayer playerIn) {

    MinecraftServer server = playerIn.world.getMinecraftServer();

    if (server != null) {

        PlayerList playerList = server.getPlayerList();

        int i = playerIn.dimension == DimensionType.OVERWORLD.getId() ? TofuMain.TOFU_DIMENSION.getId() :

                DimensionType.OVERWORLD.getId();


        Teleporter teleporter = new TofuTeleporter(server.getWorld(i));


        if (playerIn instanceof EntityPlayerMP) {

            playerList.transferPlayerToDimension((EntityPlayerMP) playerIn, i, teleporter);

        } else {

            int origin = playerIn.dimension;

            playerIn.dimension = i;

            playerIn.world.removeEntityDangerously(playerIn);

            playerIn.isDead = false;

            playerList.transferEntityToWorld(playerIn, origin, server.getWorld(origin), server.getWorld(i),

                    teleporter);

        }

    }

    return true;

}