net.minecraft.tileentity.MobSpawnerBaseLogic Java Examples

The following examples show how to use net.minecraft.tileentity.MobSpawnerBaseLogic. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Spawnable.java    From minecraft-roguelike with GNU General Public License v3.0 6 votes vote down vote up
public void generate(IWorldEditor editor, Random rand, Coord cursor, int level){
	Coord pos = new Coord(cursor);
	editor.setBlock(pos, new MetaBlock(Blocks.MOB_SPAWNER.getDefaultState()), true,	true);
	
	TileEntity tileentity = editor.getTileEntity(pos);
	if (!(tileentity instanceof TileEntityMobSpawner)) return;
	
	TileEntityMobSpawner spawner = (TileEntityMobSpawner)tileentity;
	MobSpawnerBaseLogic spawnerLogic = spawner.getSpawnerBaseLogic();
	
	NBTTagCompound nbt = new NBTTagCompound();
	nbt.setInteger("x", pos.getX());
	nbt.setInteger("y", pos.getY());
	nbt.setInteger("z", pos.getZ());
	
	nbt.setTag("SpawnPotentials", getSpawnPotentials(rand, level));
	
	spawnerLogic.readFromNBT(nbt);
	spawnerLogic.updateSpawner();
	tileentity.markDirty();
}
 
Example #2
Source File: MixinTileEntityMobSpawnerRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderMob", cancellable = true, at = @At("HEAD"))
private static void injectPaintingSpawnerFix(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks, CallbackInfo ci) {
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity == null || entity instanceof EntityPainting)
        ci.cancel();
}
 
Example #3
Source File: MixinTileEntityMobSpawnerRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderMob", cancellable = true, at = @At("HEAD"))
private static void injectPaintingSpawnerFix(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks, CallbackInfo ci) {
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity == null || entity instanceof EntityPainting)
        ci.cancel();
}
 
Example #4
Source File: HackableMobSpawner.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean afterHackTick(World world, int x, int y, int z){
    MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)world.getTileEntity(x, y, z)).func_145881_a();
    spawner.field_98284_d = spawner.field_98287_c;//oldRotation = rotation, to stop render glitching
    spawner.spawnDelay = 10;
    return false;
}
 
Example #5
Source File: BlockTrackEntryMobSpawner.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void addInformation(World world, int x, int y, int z, TileEntity te, List<String> infoList){
    if(te instanceof TileEntityMobSpawner) {
        MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner)te).func_145881_a();
        infoList.add("Spawner Type: " + StatCollector.translateToLocal("entity." + spawner.getEntityNameToSpawn() + ".name"));
        if(spawner.isActivated()) {
            infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false));
        } else if(HackableMobSpawner.isHacked(world, x, y, z)) {
            infoList.add("Spawner is hacked");
        } else {
            infoList.add("Spawner is standing by");
        }
    }

}
 
Example #6
Source File: MageTowerGenerator.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void placeSpawner(World world, BlockPos pos, String mob) {
	placeBlock(world, pos, Blocks.MOB_SPAWNER);
	TileEntityMobSpawner theSpawner = (TileEntityMobSpawner) world.getTileEntity(pos);
	MobSpawnerBaseLogic logic = theSpawner.getSpawnerBaseLogic();
	logic.setEntityId(new ResourceLocation(mob));
}
 
Example #7
Source File: MonolithGenerator.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public void placeSpawner(World world, BlockPos pos) {
	setBlockAndNotifyAdequately(world, pos, Blocks.MOB_SPAWNER.getDefaultState());
	TileEntityMobSpawner theSpawner = (TileEntityMobSpawner) world.getTileEntity(pos);
	MobSpawnerBaseLogic logic = theSpawner.getSpawnerBaseLogic();
	logic.setEntityId(new ResourceLocation("magma_cube"));
}
 
Example #8
Source File: AdapterMobSpawner.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
private static MobSpawnerBaseLogic getSpawnerLogic(TileEntityMobSpawner spawner) {
	return spawner.func_145881_a();
}