use of net.minecraftforge.fml.common.Optional.Method in project EnderIO by SleepyTrousers.
the class ItemMagnet method onWornTick.
@Override
@Method(modid = "Baubles|API")
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
if (itemstack == null || player == null) {
return;
}
if (player instanceof EntityPlayer && isActive(itemstack) && hasPower(itemstack) && ((EntityPlayer) player).getHealth() > 0f) {
MagnetController.doHoover((EntityPlayer) player);
if (!player.world.isRemote && player.world.getTotalWorldTime() % 20 == 0) {
// mustn't change the item that is in the slot or Baubles will ignore the change
ItemStack changedStack = itemstack.copy();
drainPerSecondPower(changedStack);
IInventory baubles = BaublesUtil.instance().getBaubles((EntityPlayer) player);
if (baubles != null) {
for (int i = 0; i < baubles.getSizeInventory(); i++) {
if (baubles.getStackInSlot(i) == itemstack) {
baubles.setInventorySlotContents(i, changedStack);
}
}
}
}
}
}
use of net.minecraftforge.fml.common.Optional.Method in project GregTech by GregTechCE.
the class ShapeGenerator method generate.
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public void generate(long randomSeed, IWorld world, IBlockPos centerPos, IBlockState blockState) {
World mcWorld = CraftTweakerMC.getWorld(world);
net.minecraft.block.state.IBlockState mcBlockState = CraftTweakerMC.getBlockState(blockState);
BlockPos blockPos = CraftTweakerMC.getBlockPos(centerPos);
generate(new Random(randomSeed), (x, y, z) -> mcWorld.setBlockState(blockPos, mcBlockState));
}
Aggregations