Search in sources :

Example 6 with VillageCollection

use of net.minecraft.village.VillageCollection in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class WorldServerMulti method init.

public World init() {
    this.mapStorage = this.delegate.getMapStorage();
    this.worldScoreboard = this.delegate.getScoreboard();
    this.lootTable = this.delegate.getLootTableManager();
    this.field_191951_C = this.delegate.func_191952_z();
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.getOrLoadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    return this;
}
Also used : VillageCollection(net.minecraft.village.VillageCollection)

Example 7 with VillageCollection

use of net.minecraft.village.VillageCollection in project WizClient-1.8.9-Version by WizClient.

the class WorldServer method init.

public World init() {
    this.mapStorage = new MapStorage(this.saveHandler);
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.loadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    this.worldScoreboard = new ServerScoreboard(this.mcServer);
    ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard");
    if (scoreboardsavedata == null) {
        scoreboardsavedata = new ScoreboardSaveData();
        this.mapStorage.setData("scoreboard", scoreboardsavedata);
    }
    scoreboardsavedata.setScoreboard(this.worldScoreboard);
    ((ServerScoreboard) this.worldScoreboard).func_96547_a(scoreboardsavedata);
    this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ());
    this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock());
    this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone());
    this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance());
    this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime());
    if (this.worldInfo.getBorderLerpTime() > 0L) {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime());
    } else {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
    }
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) MapStorage(net.minecraft.world.storage.MapStorage)

Example 8 with VillageCollection

use of net.minecraft.village.VillageCollection in project WizClient-1.8.9-Version by WizClient.

the class WorldServerMulti method init.

public World init() {
    this.mapStorage = this.delegate.getMapStorage();
    this.worldScoreboard = this.delegate.getScoreboard();
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.loadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    return this;
}
Also used : VillageCollection(net.minecraft.village.VillageCollection)

Example 9 with VillageCollection

use of net.minecraft.village.VillageCollection in project DynamicSurroundings by OreCruncher.

the class EnvironmentService method tickEvent.

@SubscribeEvent
public void tickEvent(@Nonnull final TickEvent.PlayerTickEvent event) {
    if (event.phase == Phase.END && event.side == Side.SERVER) {
        final EntityPlayer player = event.player;
        final VillageCollection villageCollection = player.getEntityWorld().getVillageCollection();
        boolean inVillage = false;
        if (villageCollection != null) {
            final List<Village> villages = villageCollection.getVillageList();
            if (villages != null && villages.size() > 0) {
                final BlockPos pos = player.getPosition();
                for (final Village v : villages) if (v.isBlockPosWithinSqVillageRadius(pos)) {
                    inVillage = true;
                    break;
                }
            }
        }
        final PacketEnvironment packet = new PacketEnvironment(inVillage);
        Network.sendToPlayer((EntityPlayerMP) player, packet);
    }
}
Also used : Village(net.minecraft.village.Village) PacketEnvironment(org.blockartistry.DynSurround.network.PacketEnvironment) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) VillageCollection(net.minecraft.village.VillageCollection) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 10 with VillageCollection

use of net.minecraft.village.VillageCollection in project Galacticraft by micdoodle8.

the class WorldProviderSpace method saveTime.

/**
 * Save this world's custom time (from timeCurrentOffset) into this world's villages.dat :)
 */
private void saveTime() {
    try {
        VillageCollection vc = this.world.villageCollection;
        tickCounter.setAccessible(true);
        tickCounter.setInt(vc, (int) (this.getWorldTime()));
        vc.markDirty();
    } catch (Exception ignore) {
    }
}
Also used : VillageCollection(net.minecraft.village.VillageCollection)

Aggregations

VillageCollection (net.minecraft.village.VillageCollection)16 ScoreboardSaveData (net.minecraft.scoreboard.ScoreboardSaveData)6 ServerScoreboard (net.minecraft.scoreboard.ServerScoreboard)6 MapStorage (net.minecraft.world.storage.MapStorage)5 AdvancementManager (net.minecraft.advancements.AdvancementManager)3 FunctionManager (net.minecraft.advancements.FunctionManager)3 LootTableManager (net.minecraft.world.storage.loot.LootTableManager)3 File (java.io.File)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 BlockPos (net.minecraft.util.math.BlockPos)2 Village (net.minecraft.village.Village)2 WorldSavedDataCallableSave (net.minecraft.world.storage.WorldSavedDataCallableSave)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 PacketEnvironment (org.blockartistry.DynSurround.network.PacketEnvironment)1 PacketEnvironment (org.orecruncher.dsurround.network.PacketEnvironment)1