本文整理匯總了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");
}
}
}
示例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);
}
}
}
}
示例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());
}
}
}
示例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);
}
}
示例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());
}
}
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
}
}
}
示例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));
}
}
}
示例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));
}
}
}
}
示例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);
}
示例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();
}
}
}