本文整理汇总了Java中net.minecraft.client.multiplayer.WorldClient类的典型用法代码示例。如果您正苦于以下问题:Java WorldClient类的具体用法?Java WorldClient怎么用?Java WorldClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldClient类属于net.minecraft.client.multiplayer包,在下文中一共展示了WorldClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
@Override
public IMessage onMessage(MessageGlassJarUpdateStats message, MessageContext ctx) {
ItemStack stack = message.stack;
BlockPos pos = message.pos;
WorldClient world = Minecraft.getMinecraft().world;
if (world.isBlockLoaded(pos) &&
world.getBlockState(pos).getBlock().hasTileEntity(world.getBlockState(pos))) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileFaerieHome) {
IItemHandler handler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
if (handler != null) {
handler.insertItem(0, stack, false);
}
}
}
return null;
}
示例2: getMethodTransformers
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
@Override
public MethodTransformer[] getMethodTransformers() {
MethodTransformer loadWorldTransformer = new MethodTransformer() {
public String getMethodName() {return CoreLoader.isObfuscated ? "a" : "loadWorld";}
public String getDescName() {return "(L" + (CoreLoader.isObfuscated ? "bnq" : Type.getInternalName(WorldClient.class)) + ";Ljava/lang/String;)V";}
public void transform(ClassNode classNode, MethodNode method, boolean obfuscated) {
CLTLog.info("Found method: " + method.name + " " + method.desc);
CLTLog.info("begining at start of method " + getMethodName());
//TransformerUtil.onWorldLoad(WorldClient worldClientIn)
InsnList toInsert = new InsnList();
toInsert.add(new VarInsnNode(ALOAD, 1)); //worldClientIn
toInsert.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(TransformerUtil.class),
"onWorldLoad", "(L" + Type.getInternalName(WorldClient.class) + ";)V", false));
method.instructions.insertBefore(method.instructions.getFirst(), toInsert);
}
};
return new MethodTransformer[] {loadWorldTransformer};
}
示例3: handleJoinGame
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(S01PacketJoinGame packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例4: onDisconnect
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
*/
public void onDisconnect(IChatComponent reason)
{
this.gameController.loadWorld((WorldClient)null);
if (this.guiScreenServer != null)
{
if (this.guiScreenServer instanceof GuiScreenRealmsProxy)
{
this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy());
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason));
}
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason));
}
}
示例5: handleRespawn
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public void handleRespawn(S07PacketRespawn packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension)
{
this.doneLoadingTerrain = false;
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.clientWorldController.setWorldScoreboard(scoreboard);
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimensionID();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
}
this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
this.gameController.playerController.setGameType(packetIn.getGameType());
}
示例6: setWorldAndLoadRenderers
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* set null to clear
*/
public void setWorldAndLoadRenderers(WorldClient worldClientIn)
{
if (this.theWorld != null)
{
this.theWorld.removeWorldAccess(this);
}
this.frustumUpdatePosX = Double.MIN_VALUE;
this.frustumUpdatePosY = Double.MIN_VALUE;
this.frustumUpdatePosZ = Double.MIN_VALUE;
this.frustumUpdatePosChunkX = Integer.MIN_VALUE;
this.frustumUpdatePosChunkY = Integer.MIN_VALUE;
this.frustumUpdatePosChunkZ = Integer.MIN_VALUE;
this.renderManager.set(worldClientIn);
this.theWorld = worldClientIn;
if (worldClientIn != null)
{
worldClientIn.addWorldAccess(this);
this.loadRenderers();
}
}
示例7: freeMemory
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public void freeMemory()
{
try
{
memoryReserve = new byte[0];
this.renderGlobal.deleteAllDisplayLists();
}
catch (Throwable var3)
{
;
}
try
{
System.gc();
this.loadWorld((WorldClient)null);
}
catch (Throwable var2)
{
;
}
System.gc();
}
示例8: getWorldFogColor
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public static Vec3 getWorldFogColor(Vec3 p_getWorldFogColor_0_, WorldClient p_getWorldFogColor_1_, Entity p_getWorldFogColor_2_, float p_getWorldFogColor_3_)
{
int i = p_getWorldFogColor_1_.provider.getDimensionId();
switch (i)
{
case -1:
p_getWorldFogColor_0_ = getFogColorNether(p_getWorldFogColor_0_);
break;
case 0:
Minecraft minecraft = Minecraft.getMinecraft();
p_getWorldFogColor_0_ = getFogColor(p_getWorldFogColor_0_, minecraft.theWorld, p_getWorldFogColor_2_.posX, p_getWorldFogColor_2_.posY + 1.0D, p_getWorldFogColor_2_.posZ);
break;
case 1:
p_getWorldFogColor_0_ = getFogColorEnd(p_getWorldFogColor_0_);
}
return p_getWorldFogColor_0_;
}
示例9: getWorldSkyColor
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public static Vec3 getWorldSkyColor(Vec3 p_getWorldSkyColor_0_, WorldClient p_getWorldSkyColor_1_, Entity p_getWorldSkyColor_2_, float p_getWorldSkyColor_3_)
{
int i = p_getWorldSkyColor_1_.provider.getDimensionId();
switch (i)
{
case 0:
Minecraft minecraft = Minecraft.getMinecraft();
p_getWorldSkyColor_0_ = getSkyColor(p_getWorldSkyColor_0_, minecraft.theWorld, p_getWorldSkyColor_2_.posX, p_getWorldSkyColor_2_.posY + 1.0D, p_getWorldSkyColor_2_.posZ);
break;
case 1:
p_getWorldSkyColor_0_ = getSkyColorEnd(p_getWorldSkyColor_0_);
}
return p_getWorldSkyColor_0_;
}
示例10: handleJoinGame
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* Registers some server properties
* (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(S01PacketJoinGame packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this,
new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(),
packetIn.getWorldType()),
packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand",
(new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例11: onDisconnect
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the
* reason for termination
*/
public void onDisconnect(IChatComponent reason) {
this.gameController.loadWorld((WorldClient) null);
if (this.guiScreenServer != null) {
if (this.guiScreenServer instanceof GuiScreenRealmsProxy) {
this.gameController.displayGuiScreen(
(new DisconnectedRealmsScreen(((GuiScreenRealmsProxy) this.guiScreenServer).func_154321_a(),
"disconnect.lost", reason)).getProxy());
} else {
this.gameController
.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason));
}
} else {
this.gameController.displayGuiScreen(
new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason));
}
}
示例12: handleRespawn
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public void handleRespawn(S07PacketRespawn packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) {
this.doneLoadingTerrain = false;
Scoreboard scoreboard = this.clientWorldController.getScoreboard();
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false,
this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()),
packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.clientWorldController.setWorldScoreboard(scoreboard);
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimensionID();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
}
this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID());
this.gameController.playerController.setGameType(packetIn.getGameType());
}
示例13: shutdownMinecraftApplet
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
/**
* Shuts down the minecraft applet by stopping the resource downloads, and
* clearing up GL stuff; called when the application (or web page) is exited.
*/
public void shutdownMinecraftApplet() {
try {
this.stream.shutdownStream();
logger.info("Stopping!");
Client.getClient().onDisable();
try {
this.loadWorld((WorldClient) null);
} catch (Throwable var5) {
;
}
this.mcSoundHandler.unloadSounds();
} finally {
Display.destroy();
if (!this.hasCrashed) {
System.exit(0);
}
}
System.gc();
}
示例14: freeMemory
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
public void freeMemory() {
try {
memoryReserve = new byte[0];
this.renderGlobal.deleteAllDisplayLists();
} catch (Throwable var3) {
;
}
try {
System.gc();
this.loadWorld((WorldClient) null);
} catch (Throwable var2) {
;
}
System.gc();
}
示例15: randomDisplayTick
import net.minecraft.client.multiplayer.WorldClient; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
for(int i = 0; i <= Math.min(state.getValue(State.POWER), 8); i++) {
if(rand.nextFloat() < 0.2F) {
Vector3 vec = Vector3.getRandomVec(0.15F);
vec.add(BB.getCenter());
vec.add(pos.getX(), pos.getY(), pos.getZ());
ParticleUtil.spawnChargedIce(world, vec,
Vector3.ImmutableVector3.NULL, 0xFFFFFF, 45, 0.45F * rand.nextFloat());
}
}
if(state.getValue(State.POWER) > 0 && world.rand.nextBoolean()) {
for(int i = 0; i < 1 + world.rand.nextInt(3); i++) {
Vector3 from = Vector3.create(pos).add(0.5D);
Vector3 to = Vector3.create(0, 1, 0)
.rotate(EnumFacing.Axis.X, world.rand.nextFloat() * 360)
.rotate(EnumFacing.Axis.Y, world.rand.nextFloat() * 360)
.rotate(EnumFacing.Axis.Z, world.rand.nextFloat() * 360)
.add(from);
ParticleUtil.spawnBolt(world, from, to, 4, 0.25F, 0x5194FF, true, true);
}
((WorldClient) world).playSound(pos, SolarSounds.SPARK, SoundCategory.BLOCKS, 0.05F, 1F, false);
}
}