Tabnine Logo
MultiServantLogic
Code IndexAdd Tabnine to your IDE (free)

How to use
MultiServantLogic
in
slimeknights.mantle.multiblock

Best Java code snippets using slimeknights.mantle.multiblock.MultiServantLogic (Showing top 8 results out of 315)

origin: SlimeKnights/TinkersConstruct

 protected boolean isValidSlave(World world, BlockPos pos) {
  if(!world.isBlockLoaded(pos)) {
   return false;
  }
  TileEntity te = world.getTileEntity(pos);

  // slave-blocks are only allowed if they already belong to this smeltery
  if(te instanceof MultiServantLogic) {
   MultiServantLogic slave = (MultiServantLogic) te;
   if(slave.hasValidMaster()) {
    if(!tile.getPos().equals(slave.getMasterPosition())) {
     return false;
    }
   }
  }

  return true;
 }
}
origin: SlimeKnights/TinkersConstruct

 public static void assignMultiBlock(World world, BlockPos master, List<BlockPos> servants) {
  TileEntity masterBlock = world.getTileEntity(master);
  if(!(masterBlock instanceof IMasterLogic)) {
   throw new IllegalArgumentException("Master must be of IMasterLogic");
  }

  // assign master to each servant
  for(BlockPos pos : servants) {
   if(world.isBlockLoaded(pos)) {
    TileEntity slave = world.getTileEntity(pos);
    if(slave instanceof MultiServantLogic && slave.getWorld() != null) {
     ((MultiServantLogic) slave).overrideMaster(master);
     IBlockState state = world.getBlockState(pos);
     world.notifyBlockUpdate(pos, state, state, 3);
    }
   }
  }
 }
}
origin: SlimeKnights/TinkersConstruct

@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
 super.onDataPacket(net, pkt);
 readFromNBT(pkt.getNbtCompound());
}
origin: SlimeKnights/Mantle

@Override
public boolean verifyMaster(IMasterLogic logic, World world, BlockPos pos) {
 if(this.hasMaster) {
  return this.hasValidMaster();
 }
 else {
  this.overrideMaster(pos);
  return true;
 }
}
origin: SlimeKnights/Mantle

@Override
public void notifyMasterOfChange() {
 if(this.hasValidMaster()) {
  IMasterLogic logic = (IMasterLogic) this.world.getTileEntity(this.master);
  logic.notifyChange(this, this.pos);
 }
}
origin: SlimeKnights/Mantle

public void readFromNBT(NBTTagCompound tags) {
 super.readFromNBT(tags);
 this.readCustomNBT(tags);
public NBTTagCompound writeToNBT(NBTTagCompound tags) {
 tags = super.writeToNBT(tags);
 return this.writeCustomNBT(tags);
public NBTTagCompound getUpdateTag() {
 NBTTagCompound tag = new NBTTagCompound();
 this.writeCustomNBT(tag);
 return tag;
origin: SlimeKnights/Mantle

@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
 this.readCustomNBT(packet.getNbtCompound());
 this.world.notifyLightSet(this.pos);
 IBlockState state = world.getBlockState(this.pos);
 this.world.notifyBlockUpdate(this.pos, state, state, 3);
}
origin: SlimeKnights/Mantle

@Deprecated
public boolean setMaster(BlockPos pos) {
 if(!this.hasMaster || this.world.getBlockState(this.master) != this.state || (this.world
                                            .getBlockState(this.master)
                                            .getBlock() != this.masterBlock)) {
  this.overrideMaster(pos);
  return true;
 }
 else {
  return false;
 }
}
slimeknights.mantle.multiblockMultiServantLogic

Most used methods

  • hasValidMaster
  • overrideMaster
  • getMasterPosition
  • onDataPacket
  • readCustomNBT
  • writeCustomNBT

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now