use of crazypants.enderio.util.CapturedMob in project EnderIO by SleepyTrousers.
the class AbstractSoulBinderRecipe method getCompletedResult.
@Override
@Nonnull
public ResultStack[] getCompletedResult(long nextSeed, float chanceMultiplier, @Nonnull NNList<MachineRecipeInput> inputs) {
CapturedMob mobType = null;
ItemStack inputItem = null;
for (MachineRecipeInput input : inputs) {
if (input != null && input.slotNumber == 0 && CapturedMob.containsSoul(input.item)) {
mobType = CapturedMob.create(input.item);
} else if (input != null && input.slotNumber == 1 && isValidInputItem(input.item)) {
inputItem = input.item;
}
}
if (mobType == null || !isValidInputSoul(mobType) || inputItem == null) {
return new ResultStack[0];
}
ItemStack resultStack = getOutputStack(inputItem, mobType);
ItemStack soulVessel = new ItemStack(itemSoulVial.getItemNN());
return new ResultStack[] { new ResultStack(soulVessel), new ResultStack(resultStack) };
}
use of crazypants.enderio.util.CapturedMob in project EnderIO by SleepyTrousers.
the class MobNameOverlayRenderHelper method doItemOverlayIntoGUI.
@SideOnly(Side.CLIENT)
public static void doItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition) {
if (EnderIO.proxy.getClientPlayer().isSneaking() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
CapturedMob capturedMob = CapturedMob.create(stack);
if (capturedMob != null) {
String name = capturedMob.getDisplayName();
int idx = (int) ((EnderIO.proxy.getTickCount() / 4) % name.length());
name = (name + " " + name).substring(idx, idx + 3);
FontRenderer fr = Minecraft.getMinecraft().getRenderManager().getFontRenderer();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
GlStateManager.enableBlend();
fr.drawStringWithShadow(name, xPosition + 8 - fr.getStringWidth(name) / 2, yPosition + 5, 0xFF0030B0);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
}
}
}
use of crazypants.enderio.util.CapturedMob in project EnderIO by SleepyTrousers.
the class BlockPoweredSpawner method getSubBlocks.
@SuppressWarnings("null")
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) {
super.getSubBlocks(tab, list);
if (SpawnerConfig.poweredSpawnerAddAllMobsCreative.get()) {
CapturedMob.getAllSouls().apply(new Callback<CapturedMob>() {
@Override
public void apply(CapturedMob mob) {
list.add(mob.toStack(BlockPoweredSpawner.this, 0, 1));
}
});
} else {
list.add(CapturedMob.create(new ResourceLocation("enderman")).toStack(this, 0, 1));
list.add(CapturedMob.create(new ResourceLocation("chicken")).toStack(this, 0, 1));
list.add(CapturedMob.create(new ResourceLocation("skeleton")).toStack(this, 0, 1));
list.add(CapturedMob.create(new ResourceLocation("wither_skeleton")).toStack(this, 0, 1));
list.add(CapturedMob.create(new ResourceLocation("stray")).toStack(this, 0, 1));
}
}
use of crazypants.enderio.util.CapturedMob in project EnderIO by SleepyTrousers.
the class BlockPoweredSpawner method handleAnvilEvent.
@SubscribeEvent
public void handleAnvilEvent(AnvilUpdateEvent evt) {
if (Prep.isInvalid(evt.getLeft()) || evt.getLeft().getCount() != 1 || evt.getLeft().getItem() != block_powered_spawner.getItem()) {
return;
}
if (Prep.isInvalid(evt.getRight()) || evt.getRight().getCount() != 1 || evt.getRight().getItem() != ModObject.itemBrokenSpawner.getItem()) {
return;
}
CapturedMob spawnerType = CapturedMob.create(evt.getRight());
if (spawnerType == null || isBlackListed(spawnerType.getEntityName())) {
return;
}
evt.setCost(SpawnerConfig.powerSpawnerAddSpawnerCost.get());
evt.setOutput(evt.getLeft().copy());
evt.getOutput().setTagCompound(spawnerType.toNbt(evt.getOutput().getTagCompound()));
}
use of crazypants.enderio.util.CapturedMob in project EnderIO by SleepyTrousers.
the class BlockPaintedPressurePlate method getDrop.
@Nonnull
protected ItemStack getDrop(@Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
CapturedMob mobType = getMobType(world, pos);
ItemStack drop = mobType != null ? mobType.toStack(Item.getItemFromBlock(this), getMetaForStack(world, pos), 1) : new ItemStack(Item.getItemFromBlock(this), 1, getMetaForStack(world, pos));
PaintUtil.setSourceBlock(drop, getPaintSource(world.getBlockState(pos), world, pos));
return drop;
}
Aggregations