Codota Logo
TileEntityBase
Code IndexAdd Codota to your IDE (free)

How to use
TileEntityBase
in
com.enderio.core.common

Best Java code snippets using com.enderio.core.common.TileEntityBase (Showing top 15 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: SleepyTrousers/EnderIO

@Override
protected void renderTileEntity(@Nonnull T te, @Nonnull IBlockState blockState, float partialTicks, int destroyStage) {
 World world = te.getWorld();
 renderItemStack(te, world, 0, 0, 0, partialTicks);
}
origin: SleepyTrousers/EnderCore

@Override
public final void update() {
 if (!hasWorld() || isInvalid() || !world.isBlockLoaded(getPos()) || world.getTileEntity(getPos()) != this) {
  // we can get ticked after being removed from the world, ignore this
  return;
 }
 if (ConfigHandler.allowExternalTickSpeedup || world.getTotalWorldTime() != lastUpdate) {
  lastUpdate = world.getTotalWorldTime();
  doUpdate();
  sendProgressIf();
 }
}
origin: SleepyTrousers/EnderCore

@Override
public @Nonnull TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
 if (teClass != null) {
  try {
   T te = teClass.newInstance();
   te.setWorldCreate(world);
   te.init();
   return te;
  } catch (Exception e) {
   throw new RuntimeException("Could not create tile entity for block " + getLocalizedName() + " for class " + teClass, e);
  }
 }
 throw new RuntimeException(
   "Cannot create a TileEntity for a block that doesn't have a TileEntity. This is not a problem with EnderCore, this is caused by the caller.");
}
origin: SleepyTrousers/EnderCore

public boolean canPlayerAccess(EntityPlayer player) {
 return hasWorld() && !isInvalid() && player.getDistanceSqToCenter(getPos()) <= 64D;
}
origin: SleepyTrousers/EnderCore

protected boolean isPoweredRedstone() {
 return hasWorld() && world.isBlockLoaded(getPos()) ? world.isBlockIndirectlyGettingPowered(getPos()) > 0 : false;
}
origin: SleepyTrousers/EnderCore

@SuppressWarnings({ "null", "unused" })
@Override
public final void render(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
 if (te != null && te.hasWorld() && !te.isInvalid()) {
  final IBlockState blockState = te.getWorld().getBlockState(te.getPos());
  final int renderPass = MinecraftForgeClient.getRenderPass();
  if ((block == null || block == blockState.getBlock()) && shouldRender(te, blockState, renderPass)) {
   GlStateManager.disableLighting();
   if (renderPass == 0) {
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
   } else {
    GlStateManager.enableBlend();
    GlStateManager.depthMask(false);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   }
   RenderUtil.bindBlockTexture();
   GlStateManager.pushMatrix();
   GlStateManager.translate(x, y, z);
   renderTileEntity(te, blockState, partialTicks, destroyStage);
   GlStateManager.popMatrix();
  }
 } else if (te == null) {
  renderItem();
 }
}
origin: SleepyTrousers/EnderCore

/**
 * SERVER: Called when block data is sent (client receiving blocks from server, via notifyBlockUpdate). No need for x/y/z tags.
 */
@Override
public final SPacketUpdateTileEntity getUpdatePacket() {
 NBTTagCompound tag = new NBTTagCompound();
 writeCustomNBT(NBTAction.CLIENT, tag);
 if (isProgressTile) {
  // TODO: nicer way to do this? This is needed so players who enter a chunk get a correct progress.
  tag.setFloat("tileprogress", ((IProgressTile) this).getProgress());
 }
 return new SPacketUpdateTileEntity(getPos(), 1, tag);
}
origin: SleepyTrousers/EnderIO

protected void renderItemStack(T te, @Nonnull World world, double x, double y, double z, float tick) {
 EntityItem ei = this.enityItem;
 if (ei == null) {
  this.enityItem = ei = new EntityItem(world, 0, 0, 0, getFloatingItem(te));
 }
 ei.setItem(getFloatingItem(te));
 ei.hoverStart = (float) ((EnderIO.proxy.getTickCount() * 0.05f + (tick * 0.05f)) % (Math.PI * 2));
 RenderUtil.bindBlockTexture();
 GlStateManager.pushMatrix();
 glTranslated(x + 0.5, y + 0.7, z + 0.5);
 glScalef(1.1f, 1.1f, 1.1f);
 BlockPos p;
 if (te != null) {
  p = te.getPos();
 } else {
  p = new BlockPos(0, 0, 0);
 }
 rand.setSeed(p.getX() + p.getY() + p.getZ());
 rand.nextBoolean();
 if (Minecraft.getMinecraft().gameSettings.fancyGraphics) {
  GlStateManager.rotate(rand.nextFloat() * 360f, 0, 1, 0);
 }
 ei.hoverStart += rand.nextFloat();
 GlStateManager.translate(0, -0.15f, 0);
 if (rei == null) {
  rei = new InnerRenderEntityItem(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem());
 }
 rei.doRender(ei, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
 GlStateManager.popMatrix();
}
origin: SleepyTrousers/EnderCore

@Override
public void detectAndSendChanges() {
 super.detectAndSendChanges();
 if (inv instanceof TileEntityBase) {
  // keep in sync with ContainerEnderCap#detectAndSendChanges()
  final SPacketUpdateTileEntity updatePacket = ((TileEntityBase) inv).getUpdatePacket();
  if (updatePacket != null) {
   for (IContainerListener containerListener : listeners) {
    if (containerListener instanceof EntityPlayerMP) {
     ((EntityPlayerMP) containerListener).connection.sendPacket(updatePacket);
    }
   }
  }
 }
}
origin: SleepyTrousers/EnderIO

@Override
public void onChunkUnload() {
 super.onChunkUnload();
 if (DiagnosticsConfig.debugTraceTELivecycleExtremelyDetailed.get()) {
  StringBuilder sb = new StringBuilder("TE ").append(this).append(" unloaded");
  for (StackTraceElement elem : new Exception("Stacktrace").getStackTrace()) {
   sb.append(" at ").append(elem);
  }
  Log.warn(sb);
 }
}
origin: SleepyTrousers/EnderIO

@Override
public void invalidate() {
 super.invalidate();
 if (DiagnosticsConfig.debugTraceTELivecycleExtremelyDetailed.get()) {
  StringBuilder sb = new StringBuilder("TE ").append(this).append(" invalidated");
  for (StackTraceElement elem : new Exception("Stacktrace").getStackTrace()) {
   sb.append(" at ").append(elem);
  }
  Log.warn(sb);
 }
}
origin: SleepyTrousers/EnderCore

protected void updateBlock() {
 if (hasWorld() && world.isBlockLoaded(getPos())) {
  IBlockState bs = world.getBlockState(getPos());
  world.notifyBlockUpdate(pos, bs, bs, 3);
 }
}
origin: SleepyTrousers/EnderCore

updatePacket = getUpdatePacket();
if (updatePacket == null) {
 return;
origin: SleepyTrousers/EnderCore

@Override
public void markDirty() {
 if (hasWorld() && world.isBlockLoaded(getPos())) { // we need the loaded check to make sure we don't trigger a chunk load while the chunk is loaded
  world.markChunkDirty(pos, this);
  IBlockState state = world.getBlockState(pos);
  if (state.hasComparatorInputOverride()) {
   world.updateComparatorOutputLevel(pos, state.getBlock());
  }
 }
}
origin: SleepyTrousers/EnderIO

 @Override
 public IMessage onMessage(PacketPassword msg, MessageContext ctx) {
  TileEntityBase te = msg.getTileEntity(ctx.getServerHandler().player.world);
  if (te instanceof ITravelAccessable) {
   if (((ITravelAccessable) te).canUiBeAccessed(ctx.getServerHandler().player)) {
    if (Prep.isValid(msg.stack)) {
     msg.stack.setCount(1);
    }
    if (msg.setLabel) {
     ((ITravelAccessable) te).setItemLabel(msg.stack);
    } else {
     ((ITravelAccessable) te).getPassword().set(msg.slot, msg.stack);
     ((ITravelAccessable) te).clearAuthorisedUsers();
    }
    BlockPos pos = msg.getPos();
    IBlockState bs = te.getWorld().getBlockState(pos);
    te.getWorld().notifyBlockUpdate(pos, bs, bs, 3);
   }
  }
  return null;
 }
}
com.enderio.core.commonTileEntityBase

Most used methods

  • getWorld
  • getPos
  • doUpdate
  • getUpdatePacket
    SERVER: Called when block data is sent (client receiving blocks from server, via notifyBlockUpdate).
  • hasWorld
  • init
    Called directly after the TE is constructed. This is the place to call non-final methods. Note: This
  • invalidate
  • isInvalid
  • onChunkUnload
  • readCustomNBT
  • sendProgressIf
  • setGhostSlotContents
    Called server-side when a GhostSlot is changed. Check that the given slot number really is a ghost s
  • sendProgressIf,
  • setGhostSlotContents,
  • setWorld,
  • setWorldCreate,
  • shouldDoWorkThisTick,
  • updateBlock,
  • writeCustomNBT

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now