当前位置: 首页>>代码示例>>Java>>正文


Java TileEntityMobSpawner类代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityMobSpawner的典型用法代码示例。如果您正苦于以下问题:Java TileEntityMobSpawner类的具体用法?Java TileEntityMobSpawner怎么用?Java TileEntityMobSpawner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TileEntityMobSpawner类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityMobSpawner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addInformation

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
@Override
    public void addInformation(World world, BlockPos pos, TileEntity te, List<String> infoList) {
        if (te instanceof TileEntityMobSpawner) {
            MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) te).getSpawnerBaseLogic();
            ResourceLocation rl = Reflections.getEntityId(spawner);
//            infoList.add("Spawner Type: " + I18n.format("entity." + spawner.getEntityNameToSpawn() + ".name"));
            infoList.add("Spawner Type: " + (rl == null ? "?" : rl.toString()));
            
            if (Reflections.isActivated(spawner) || SemiBlockManager.getInstance(world).getSemiBlock(SemiBlockSpawnerAgitator.class, world, pos) != null) {
                infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false));
            } else if (HackableMobSpawner.isHacked(world, pos)) {
                infoList.add("Spawner is hacked");
            } else {
                infoList.add("Spawner is standing by");
            }
        }

    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:BlockTrackEntryMobSpawner.java

示例2: update

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
@Override
public void update() {
    super.update();
    if (!world.isRemote) {
        TileEntityMobSpawner te = getTileEntity();
        if(te != null){
            MobSpawnerBaseLogic spawnerLogic = te.getSpawnerBaseLogic();
            
            //Only tick the logic if it wasn't ticked already by the TE itself, to prevent double ticking.
            if(!Reflections.isActivated(spawnerLogic)){
                
                //Temporarily add a fake player to the world to trick the spawner into thinking there's a player nearby
                EntityPlayer fakePlayer = FakePlayerFactory.get((WorldServer)world, FAKE_PLAYER_PROFILE);
                fakePlayer.posX = getPos().getX();
                fakePlayer.posY = getPos().getY();
                fakePlayer.posZ = getPos().getZ();
                
                world.playerEntities.add(fakePlayer);
                spawnerLogic.updateSpawner();
                world.playerEntities.remove(fakePlayer);
            }                
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:25,代码来源:SemiBlockSpawnerAgitator.java

示例3: handleUpdateTileEntity

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:NetHandlerPlayClient.java

示例4: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:TileEntityRendererDispatcher.java

示例5: handleUpdateTileEntity

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * Updates the NBTTagCompound metadata of instances of the following
 * entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

	if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
		TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
		int i = packetIn.getTileEntityType();

		if (i == 1 && tileentity instanceof TileEntityMobSpawner
				|| i == 2 && tileentity instanceof TileEntityCommandBlock
				|| i == 3 && tileentity instanceof TileEntityBeacon
				|| i == 4 && tileentity instanceof TileEntitySkull
				|| i == 5 && tileentity instanceof TileEntityFlowerPot
				|| i == 6 && tileentity instanceof TileEntityBanner) {
			tileentity.readFromNBT(packetIn.getNbtCompound());
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:NetHandlerPlayClient.java

示例6: handleUpdateTileEntity

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:26,代码来源:NetHandlerPlayClient.java

示例7: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
    this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:TileEntityRendererDispatcher.java

示例8: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:TileEntityRendererDispatcher.java

示例9: placeSpawnerAtCurrentPosition

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
protected void placeSpawnerAtCurrentPosition(World var1, Random var2, int var3, int var4, int var5, String var6, StructureBoundingBox var7)
{
    final int var8 = this.getXWithOffset(var3, var5);
    final int var9 = this.getYWithOffset(var4);
    final int var10 = this.getZWithOffset(var3, var5);

    if (var7.isVecInside(var8, var9, var10) && var1.getBlock(var8, var9, var10) != Blocks.mob_spawner)
    {
        var1.setBlock(var8, var9, var10, Blocks.mob_spawner, 0, 3);
        final TileEntityMobSpawner var11 = (TileEntityMobSpawner) var1.getTileEntity(var8, var9, var10);

        if (var11 != null)
        {
            var11.func_145881_a().setEntityName(var6);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:StructureComponentGC.java

示例10: onReceiveClient

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
@Override
public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) {
    BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem);
    if (blockSystem != null) {
        if (blockSystem.isBlockLoaded(this.pos)) {
            TileEntity blockEntity = blockSystem.getTileEntity(this.pos);
            boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock;
            if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) {
                blockEntity.readFromNBT(this.data);
            } else {
                blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data));
            }
            if (commandBlock && client.currentScreen instanceof GuiCommandBlock) {
                ((GuiCommandBlock) client.currentScreen).updateGui();
            }
        }
    }
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:19,代码来源:UpdateBlockEntityMessage.java

示例11: onBlockPlaced

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * Called from BlockMobSpawner on the client via asm generated onBlockPlacedBy
 */
public static void onBlockPlaced(World world, BlockPos pos, ItemStack stack) {
    if (!NEIClientConfig.hasSMPCounterPart()) {
        return;
    }

    TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(pos);
    if (tileentitymobspawner != null) {
        setDefaultTag(stack);
        String mobtype = IDtoNameMap.get(stack.getItemDamage());
        if (mobtype != null) {
            NEIClientPacketHandler.sendMobSpawnerID(pos.getX(), pos.getY(), pos.getZ(), mobtype);
            tileentitymobspawner.getSpawnerBaseLogic().setEntityId(new ResourceLocation(mobtype));
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:19,代码来源:ItemMobSpawner.java

示例12: findSpawners

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * search in all loaded TileEntities for MobSpawners,
 * when a new MobSpawner gets found, display its type and coordinates in chat.
 * @param showKnown show already found spawners
 */
public static void findSpawners(boolean showKnown) {
    final Minecraft mc = Minecraft.getMinecraft();
    if (mc == null || mc.theWorld == null || mc.theWorld.loadedTileEntityList == null)
        return;
    for (Object o : mc.theWorld.loadedTileEntityList) {
        if (o.getClass() == TileEntityMobSpawner.class) {
            final TileEntityMobSpawner spawnerTileEntity = (TileEntityMobSpawner) o;
            final BlockPos spawnerPos = spawnerTileEntity.getPos();
            if (showKnown || !foundSpawners.contains(spawnerPos)) {
                if (!showKnown) foundSpawners.add(spawnerPos);

                // tell player about newly found spawner
                NBTTagCompound nbt = new NBTTagCompound();
                spawnerTileEntity.writeToNBT(nbt);
                final String entityId = nbt.getString("EntityId");
                mc.thePlayer.addChatMessage(getSpawnerFoundChatMessage(spawnerPos, entityId));
            }
        }
    }
}
 
开发者ID:Gjum,项目名称:MobSpawnerFinder,代码行数:26,代码来源:MobSpawnerFinder.java

示例13: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityRendererPiston());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new RenderEndPortal());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    Iterator var1 = this.mapSpecialRenderers.values().iterator();

    while (var1.hasNext())
    {
        TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next();
        var2.func_147497_a(this);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:TileEntityRendererDispatcher.java

示例14: copyToSpawner

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
private void copyToSpawner(NBTTagCompound nbt, ItemStack stack, TileEntityMobSpawner mobSpawner, EntityPlayer player)
    {
        if(mobSpawner.func_145881_a().getRandomEntity() == null)
        {
            mobSpawner.func_145881_a().setRandomEntity(mobSpawner.func_145881_a().new WeightedRandomMinecart((NBTTagCompound) nbt.copy(), mobSpawner.func_145881_a().getEntityNameToSpawn()));
        }
        else
        {
            NBTTagCompound old = mobSpawner.func_145881_a().getRandomEntity().field_98222_b;
            if(nbt.hasKey("CustomAITasks"))
                old.setTag("CustomAITasks", nbt.getTag("CustomAITasks"));
            if(nbt.hasKey("CustomAITargetTasks"))
                old.setTag("CustomAITargetTasks", nbt.getTag("CustomAITargetTasks"));
        }
        player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC+"Successfully transfered AI data to the spawner"));
//        ModCustomAI.packetPipeline.sendToAll(new PacketUpdateMobSpawnerData(mobSpawner, fromNBTListToList((NBTTagList)nbt.getTag("CustomAITasks")), fromNBTListToList((NBTTagList)nbt.getTag("CustomAITargetTasks"))));
        mobSpawner.getWorldObj().markBlockForUpdate(mobSpawner.xCoord, mobSpawner.yCoord, mobSpawner.zCoord);
    }
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:19,代码来源:AICopierItem.java

示例15: handleUpdateTileEntity

import net.minecraft.tileentity.TileEntityMobSpawner; //导入依赖的package包/类
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
        else
        {
            tileentity.onDataPacket(netManager, packetIn);
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:30,代码来源:NetHandlerPlayClient.java


注:本文中的net.minecraft.tileentity.TileEntityMobSpawner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。