net.minecraftforge.common.DimensionManager Java Examples

The following examples show how to use net.minecraftforge.common.DimensionManager. 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: WorldConverter.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@Override
public World convert(String worldName) throws TypeConversionException {
    World[] worlds = DimensionManager.getWorlds();

    Optional<World> matchingWorld = Arrays.stream(worlds)
        .filter(world -> world.provider.getDimensionType().getName().equals(worldName))
        .findFirst();

    return matchingWorld.orElseThrow(() -> {
        String validWorlds = Arrays.stream(worlds)
            .map(world -> world.provider.getDimensionType().getName())
            .collect(Collectors.joining(", "));

        return new TypeConversionException(
            String.format("Invalid world name! Available options: %s", validWorlds));
    });
}
 
Example #2
Source File: TicketMap.java    From MyTown2 with The Unlicense 6 votes vote down vote up
@Override
public ForgeChunkManager.Ticket get(Object key) {
    if (key instanceof Integer) {
        if (super.get(key) == null) {
            World world = DimensionManager.getWorld((Integer) key);
            if (world == null) {
                return null;
            }

            ForgeChunkManager.Ticket ticket = ForgeChunkManager.requestTicket(MyTown.instance, world, ForgeChunkManager.Type.NORMAL);
            ticket.getModData().setString("townName", town.getName());
            ticket.getModData().setTag("chunkCoords", new NBTTagList());
            put((Integer) key, ticket);
            return ticket;
        } else {
            return super.get(key);
        }
    }
    return null;
}
 
Example #3
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) {
    if (config == null && DimensionManager.getWorld(0) != null) {
        config = DimensionManager.getWorld(0).spigotConfig;
    } else {
        return true;
    }

    return ((entity.activationType == 3 && config.miscActivationRange == 0)
            || (entity.activationType == 2 && config.animalActivationRange == 0)
            || (entity.activationType == 1 && config.monsterActivationRange == 0)
            || entity instanceof EntityPlayer
            || entity instanceof EntityThrowable
            || entity instanceof MultiPartEntityPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityFallingBlock
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.CREATURE, false))
            && !entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !entity.isCreatureType(EnumCreatureType.MONSTER, false)
            && !entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false)
    );
}
 
Example #4
Source File: CraftServer.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
@Override
public File getWorldContainer() {
    // Cauldron start - return the proper container
    if (DimensionManager.getWorld(0) != null) {
        return ((SaveHandler) DimensionManager.getWorld(0).getSaveHandler()).getWorldDirectory();
    }
    // Cauldron end
    if (this.getServer().anvilFile != null) {
        return this.getServer().anvilFile;
    }

    if (container == null) {
        container = new File(configuration.getString("settings.world-container", "."));
    }

    return container;
}
 
Example #5
Source File: ProxyWorldManager.java    From LookingGlass with GNU General Public License v3.0 6 votes vote down vote up
public static WorldView createWorldView(int dimid, ChunkCoordinates spawn, int width, int height) {
	if (ModConfigs.disabled) return null;
	if (!DimensionManager.isDimensionRegistered(dimid)) return null;

	WorldClient proxyworld = ProxyWorldManager.getProxyworld(dimid);
	if (proxyworld == null) return null;

	Collection<WorldView> worldviews = worldviewsets.get(dimid);
	if (worldviews == null) return null;

	WorldView view = new WorldView(proxyworld, spawn, width, height);

	// Initialize the view rendering system
	Minecraft mc = Minecraft.getMinecraft();
	EntityLivingBase backup = mc.renderViewEntity;
	mc.renderViewEntity = view.camera;
	view.getRenderGlobal().setWorldAndLoadRenderers(proxyworld);
	mc.renderViewEntity = backup;

	// Inform the server of the new view
	LookingGlassPacketManager.bus.sendToServer(PacketCreateView.createPacket(view));
	worldviews.add(view);
	return view;
}
 
Example #6
Source File: GTTileTesseractSlave.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	this.handleEnergy();
	if (world.getTotalWorldTime() % 20 == 0 && this.targetPos != null) {
		WorldServer targetWorld = DimensionManager.getWorld(this.targetDim);
		if (targetWorld == null) {
			setTarget(null);
			return;
		}
		TileEntity destination = targetWorld.getTileEntity(this.targetPos);
		if (destination instanceof GTTileTesseractMaster && ((GTTileTesseractMaster) destination).getActive()) {
			setTarget((GTTileTesseractMaster) destination);
			return;
		}
		setTarget(null);
	}
}
 
Example #7
Source File: DimensionDumper.java    From NEI-Integration with MIT License 6 votes vote down vote up
@Override
public Iterable<String[]> dump(int mode) {
    List<String[]> list = new LinkedList<String[]>();
    
    List<Integer> ids = new ArrayList<Integer>();
    ids.addAll(Arrays.asList(DimensionManager.getStaticDimensionIDs()));
    Collections.sort(ids);
    
    for (int id : ids) {
        int providerId = DimensionManager.getProviderType(id);
        Map<Integer, Class> providers = ReflectionHelper.getPrivateValue(DimensionManager.class, null, "providers");
        Class providerClass = providers.get(providerId);
        list.add(new String[] { String.valueOf(id), String.valueOf(providerId), providerClass.getName() });
    }
    
    return list;
}
 
Example #8
Source File: CommonProxy.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void initalize() {
    NetworkRegistry.INSTANCE.registerGuiHandler(Gadomancy.instance, this);

    MinecraftForge.EVENT_BUS.register(EVENT_HANDLER_GOLEM);
    FMLCommonHandler.instance().bus().register(new EventHandlerNetwork());
    EventHandlerWorld worldEventHandler = new EventHandlerWorld();
    MinecraftForge.EVENT_BUS.register(worldEventHandler);
    FMLCommonHandler.instance().bus().register(worldEventHandler);
    MinecraftForge.EVENT_BUS.register(new EventHandlerEntity());

    RegisteredEnchantments.init();
    RegisteredRecipes.init();

    SyncDataHolder.initialize();
    ModSubstitutions.init();

    RegisteredEntities.init();

    DimensionManager.registerProviderType(ModConfig.dimOuterId, WorldProviderTCEldrich.class, true);
    DimensionManager.registerDimension(ModConfig.dimOuterId, ModConfig.dimOuterId);
}
 
Example #9
Source File: MissionResourceCollection.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public MissionResourceCollection(long duration, EntityRocket entity, LinkedList<IInfrastructure> infrastructureCoords) {
	super();
	missionPersistantNBT = new NBTTagCompound();
	entity.writeMissionPersistantNBT(missionPersistantNBT);
	
	satelliteProperties.setId(zmaster587.advancedRocketry.dimension.DimensionManager.getInstance().getNextSatelliteId());

	startWorldTime = DimensionManager.getWorld(0).getTotalWorldTime();
	this.duration = duration;
	this.launchDimension = entity.world.provider.getDimension();
	rocketStorage = entity.storage;
	rocketStats = entity.stats;
	x = entity.posX;
	y = entity.posY;
	z = entity.posZ;
	worldId = entity.world.provider.getDimension();

	this.infrastructureCoords = new LinkedList<HashedBlockPosition>();

	for(IInfrastructure tile : infrastructureCoords)
		this.infrastructureCoords.add(new HashedBlockPosition(((TileEntity)tile).getPos()));
}
 
Example #10
Source File: RailNetworkManager.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
/**
 * The initial nodes used to build out the network from.
 * Signals, Station Markers, rail links. Only used when force rebuilding the network.
 * @return
 */
private Set<MCPos> getStartNodes(){
    Set<MCPos> nodes = new HashSet<>();
    for(World world : DimensionManager.getWorlds()) {
        for(TileEntity te : world.loadedTileEntityList) {
            if(te instanceof TileEntityBase) { //Any Signals TE for testing purposes
                nodes.add(new MCPos(world, te.getPos()));
                for(EnumFacing facing : EnumFacing.VALUES) {
                    BlockPos pos = te.getPos().offset(facing);
                    nodes.add(new MCPos(world, pos));
                }
            }
        }
    }
    return nodes;
}
 
Example #11
Source File: SpaceObjectManager.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
/**
 * Changes the orbiting body of the space object
 * @param station
 * @param dimId
 * @param timeDelta time in ticks to fully make the jump
 */
public void moveStationToBody(ISpaceObject station, int dimId, int timeDelta) {
	//Remove station from the planet it's in orbit around before moving it!
	if(station.getOrbitingPlanetId() != WARPDIMID && spaceStationOrbitMap.get(station.getOrbitingPlanetId()) != null) {
		spaceStationOrbitMap.get(station.getOrbitingPlanetId()).remove(station);
	}

	if(spaceStationOrbitMap.get(WARPDIMID) == null)
		spaceStationOrbitMap.put(WARPDIMID,new LinkedList<ISpaceObject>());

	if(!spaceStationOrbitMap.get(WARPDIMID).contains(station))
		spaceStationOrbitMap.get(WARPDIMID).add(station);
	station.setOrbitingBody(WARPDIMID);

	//if(FMLCommonHandler.instance().getSide().isServer()) {
		PacketHandler.sendToAll(new PacketStationUpdate(station, PacketStationUpdate.Type.ORBIT_UPDATE));
	//}
	AdvancedRocketry.proxy.fireFogBurst(station);


	((DimensionProperties)station.getProperties()).setAtmosphereDensityDirect(0);
	nextStationTransitionTick = (int)(Configuration.travelTimeMultiplier*timeDelta) + DimensionManager.getWorld(Configuration.spaceDimId).getTotalWorldTime();
	station.beginTransition(nextStationTransitionTick);
	
}
 
Example #12
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public World getImpWorld() {
    if (nmsWorld != null || getWorldName() == null) {
        return nmsWorld;
    }
    String[] split = getWorldName().split(";");
    int id = Integer.parseInt(split[split.length - 1]);
    nmsWorld = DimensionManager.getWorld(id);
    return nmsWorld;
}
 
Example #13
Source File: PacketCreateView.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handle(ByteBuf data, EntityPlayer player) {
	if (ModConfigs.disabled) return;
	int dim = data.readInt();
	int xPos = data.readInt();
	int yPos = data.readInt();
	int zPos = data.readInt();
	byte renderDistance = data.readByte();

	if (!DimensionManager.isDimensionRegistered(dim)) return;
	WorldServer world = MinecraftServer.getServer().worldServerForDimension(dim);
	if (world == null) return;
	int x;
	int y;
	int z;
	if (yPos < 0) {
		ChunkCoordinates c = world.getSpawnPoint();
		x = c.posX >> 4;
		y = c.posY >> 4;
		z = c.posZ >> 4;
	} else {
		x = xPos;
		y = yPos;
		z = zPos;
	}
	if (renderDistance > ModConfigs.renderDistance) renderDistance = ModConfigs.renderDistance;
	ChunkFinderManager.instance.addFinder(new ChunkFinder(new ChunkCoordinates(x, y, z), dim, world.getChunkProvider(), player, renderDistance));
	//TODO: Add to tracking list.  Send time/data updates at intervals. Keep in mind to catch player disconnects when tracking clients.
	//Register ChunkFinder, and support change of finder location.
	//TODO: This is a repeat of the handling of PacketRequestWorldInfo
	net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ClientWorldInfoEvent(dim, (EntityPlayerMP) player));
	LookingGlassPacketManager.bus.sendTo(PacketWorldInfo.createPacket(dim), (EntityPlayerMP) player);
}
 
Example #14
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public World getImpWorld() {
    if (nmsWorld != null || getWorldName() == null) {
        return nmsWorld;
    }
    String[] split = getWorldName().split(";");
    int id = Integer.parseInt(split[split.length - 1]);
    return nmsWorld = DimensionManager.getWorld(id);
}
 
Example #15
Source File: NEIServerConfig.java    From NotEnoughItems with MIT License 5 votes vote down vote up
private static void saveWorld(int dim) {
    try {
        File file = new File(getSaveDir(DimensionManager.getWorld(dim)), "world.dat");
        NEIServerUtils.writeNBT(dimTags.get(dim), file);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #16
Source File: MissionResourceCollection.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void tickEntity() {
	if(getProgress(DimensionManager.getWorld(getDimensionId())) >= 1 && !DimensionManager.getWorld(0).isRemote) {
		setDead();
		onMissionComplete();
	}
}
 
Example #17
Source File: SpaceObjectBase.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Sets the orbiting planet for the space object but does NOT register it with the planet
 * @param id
 */
@Override
public void setOrbitingBody(int id) {
	if(id == this.getOrbitingPlanetId())
		return;

	properties.setParentPlanet(zmaster587.advancedRocketry.dimension.DimensionManager.getInstance().getDimensionProperties(id), false);
}
 
Example #18
Source File: SpaceObject.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public SpaceObject() {
	properties = (DimensionProperties) zmaster587.advancedRocketry.dimension.DimensionManager.defaultSpaceDimensionProperties.clone();
	spawnLocations = new LinkedList<StationLandingLocation>();
	warpCoreLocation = new LinkedList<HashedBlockPosition>(); 
	dockingPoints = new HashMap<HashedBlockPosition, String>();
	transitionEta = -1;
	destinationDimId = 0;
	created = false;
	knownPlanetList = new HashSet<Integer>();
	angularVelocity = new double[3];
	rotation = new double[3];
}
 
Example #19
Source File: SpaceObject.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Sets the orbiting planet for the space object but does NOT register it with the planet
 * @param id
 */
@Override
public void setOrbitingBody(int id) {
	if(id == this.getOrbitingPlanetId())
		return;

	properties.setParentPlanet(zmaster587.advancedRocketry.dimension.DimensionManager.getInstance().getDimensionProperties(id), false);
	if(id != SpaceObjectManager.WARPDIMID)
		destinationDimId = id;
}
 
Example #20
Source File: PlayerChunkViewerManager.java    From ChickenChunks with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void updateChunkChangeMap()
{
    for(WorldServer world : DimensionManager.getWorlds())
    {
        HashSet<ChunkCoordIntPair> allChunks = new HashSet<ChunkCoordIntPair>();
        ArrayList<Chunk> loadedChunkCopy = new ArrayList<Chunk>(world.theChunkProviderServer.loadedChunks);
        for(Chunk chunk : loadedChunkCopy)
            allChunks.add(chunk.getChunkCoordIntPair());
        
        lastLoadedChunkMap.put(CommonUtils.getDimension(world), allChunks);
    }
}
 
Example #21
Source File: PacketBusFluidExport.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void read(ByteArrayDataInput in) throws ProtocolException
{
	world = DimensionManager.getWorld(in.readInt());
	x = in.readInt();
	y = in.readInt();
	z = in.readInt();
	playername = in.readUTF();
	action = in.readInt();
}
 
Example #22
Source File: TileSpaceLaser.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Checks to see if the situation for firing the laser exists... and changes the state accordingly
 */
public void checkCanRun() {
	//Laser requires lense, redstone power, not be jammed, and be in orbit and energy to function
	if(world.isBlockIndirectlyGettingPowered(getPos()) == 0 || !isAllowedToRun()) {
		if(laserSat.isAlive()) {
			laserSat.deactivateLaser();
		}

		setRunning(false);
	} else if(!laserSat.isAlive() && !finished && !laserSat.getJammed() && world.isBlockIndirectlyGettingPowered(getPos()) > 0 && canMachineSeeEarth()) {

		//Laser will be on at this point
		int orbitDimId = ((WorldProviderSpace)this.world.provider).getDimensionProperties(getPos()).getParentPlanet();
		if(orbitDimId == SpaceObjectManager.WARPDIMID)
			return;
		WorldServer orbitWorld = DimensionManager.getWorld(orbitDimId);

		if(orbitWorld == null) {
			DimensionManager.initDimension(orbitDimId);
			orbitWorld = DimensionManager.getWorld(orbitDimId);
			if(orbitWorld == null)
				return;
		}


		if(ticket == null) {
			ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.world, Type.NORMAL);
			if(ticket != null)
				ForgeChunkManager.forceChunk(ticket, new ChunkPos(getPos().getX() / 16 - (getPos().getX() < 0 ? 1 : 0), getPos().getZ() / 16 - (getPos().getZ() < 0 ? 1 : 0)));
		}

		setRunning(laserSat.activateLaser(orbitWorld, laserX, laserZ));
	}

	if(!this.world.isRemote)
		PacketHandler.sendToNearby(new PacketMachine(this, (byte)12), 128, pos, this.world.provider.getDimension());
}
 
Example #23
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public String getWorldName(net.minecraft.world.World w) {
    Integer[] ids = DimensionManager.getIDs();
    WorldServer[] worlds = DimensionManager.getWorlds();
    for (int i = 0; i < ids.length; i++) {
        if (worlds[i] == w) {
            return w.getWorldInfo().getWorldName() + ";" + ids[i];
        }
    }
    return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimensionId();
}
 
Example #24
Source File: ActivationRange.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
 
Example #25
Source File: CraftServer.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean unloadWorld(World world, boolean save) {
    if (world == null) {
        return false;
    }

    net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle();

    if (!(console.worlds.contains(handle))) {
        return false;
    }

    if (handle.playerEntities.size() > 0) {
        return false;
    }

    WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
    pluginManager.callEvent(e);

    if (e.isCancelled()) {
        return false;
    }

    if (save) {
        try {
            handle.saveAllChunks(true, null);
            handle.flush();
            WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
            getPluginManager().callEvent(event);
        } catch (net.minecraft.world.MinecraftException ex) {
            getLogger().log(Level.SEVERE, null, ex);
            FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it.");
        }
    }
    MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world
    worlds.remove(world.getName().toLowerCase());
    DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager
    return true;
}
 
Example #26
Source File: PacketMEBattery.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@Override
public void read(ByteArrayDataInput in) throws ProtocolException
{
	world = DimensionManager.getWorld(in.readInt());
	x = in.readInt();
	y = in.readInt();
	z = in.readInt();
	playername = in.readUTF();
}
 
Example #27
Source File: ProxyWorldManager.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
public static synchronized WorldClient getProxyworld(int dimid) {
	if (ModConfigs.disabled) return null;
	WorldClient proxyworld = proxyworlds.get(dimid);
	if (proxyworld == null) {
		if (!DimensionManager.isDimensionRegistered(dimid)) return null;
		// We really don't want to be doing this during a render cycle
		if (Minecraft.getMinecraft().thePlayer instanceof EntityCamera) return null; //TODO: This check probably needs to be altered
		WorldClient theWorld = Minecraft.getMinecraft().theWorld;
		if (theWorld != null && theWorld.provider.dimensionId == dimid) proxyworld = theWorld;
		if (proxyworld == null) proxyworld = new ProxyWorld(dimid);
		proxyworlds.put(dimid, proxyworld);
		worldviewsets.put(dimid, Collections.newSetFromMap(new WeakHashMap<WorldView, Boolean>()));
	}
	return proxyworld;
}
 
Example #28
Source File: NEIServerConfig.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void load(World world) {
    if (ServerUtils.mc() != server) {
        LogHelper.debug("Loading NEI Server");
        server = ServerUtils.mc();
        saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI");

        dimTags.clear();
        loadConfig();
        loadBannedItems();
    }
    loadWorld(world);
}
 
Example #29
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 #30
Source File: PacketRequestWorldInfo.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handle(ByteBuf data, EntityPlayer player) {
	if (ModConfigs.disabled) return;
	int dim = data.readInt();

	if (!DimensionManager.isDimensionRegistered(dim)) return;
	net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ClientWorldInfoEvent(dim, (EntityPlayerMP) player));
	LookingGlassPacketManager.bus.sendTo(PacketWorldInfo.createPacket(dim), (EntityPlayerMP) player);
}