Java Code Examples for net.minecraftforge.common.util.FakePlayerFactory#get()
The following examples show how to use
net.minecraftforge.common.util.FakePlayerFactory#get() .
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: GregFakePlayer.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static FakePlayer get(WorldServer world) { FakePlayer ret = GREGTECH_PLAYER != null ? GREGTECH_PLAYER.get() : null; if (ret == null) { ret = FakePlayerFactory.get(world, GREGTECH); GREGTECH_PLAYER = new WeakReference<>(ret); } return ret; }
Example 2
Source File: BlockUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
public static EntityPlayerMP makePlacer(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { if (entity instanceof EntityPlayerMP) { return (EntityPlayerMP) entity; } EntityPlayerMP bro = FakePlayerFactory.get((WorldServer) world, PLACER); bro.moveToBlockPosAndAngles(pos, 0, -90); bro.setSneaking(true); return bro; }
Example 3
Source File: BlockUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
public static boolean placeBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, @Nonnull ItemStack stack) { if (!world.isBlockLoaded(pos)) return false; FakePlayer player = FakePlayerFactory.get((WorldServer) world, PLACER); player.moveToBlockPosAndAngles(pos, 0, -90); player.setHeldItem(EnumHand.MAIN_HAND, stack); player.setSneaking(true); if (!hasEditPermission(pos, player)) return false; EnumActionResult result = player.interactionManager.processRightClickBlock( player, world, stack, EnumHand.MAIN_HAND, pos, facing, 0, 0, 0); return result != EnumActionResult.FAIL; }
Example 4
Source File: BlockUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
public static EntityPlayerMP makeBreaker(@Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { if (entity instanceof EntityPlayerMP) { return (EntityPlayerMP) entity; } EntityPlayerMP bro = FakePlayerFactory.get((WorldServer) world, BREAKER); bro.moveToBlockPosAndAngles(pos, 0, -90); return bro; }
Example 5
Source File: TileEntityDrawbridge.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Nonnull private FakePlayer getPlayer() { if (this.fakePlayer == null) { int dim = this.getWorld().provider.getDimension(); this.fakePlayer = FakePlayerFactory.get((WorldServer) this.getWorld(), new GameProfile(new UUID(dim, dim), Reference.MOD_ID + ":drawbridge")); } return this.fakePlayer; }
Example 6
Source File: TileEntitySentryTurret.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
private EntityPlayer getFakePlayer(){ return FakePlayerFactory.get((WorldServer)worldObj, new GameProfile(null, "Sentry Turret")); }