use of net.minecraft.entity.player.PlayerEntity in project NetherEx by LogicTechCorp.
the class RenderEventHandler method onRenderSpecificHand.
@SubscribeEvent
public static void onRenderSpecificHand(RenderHandEvent event) {
PlayerEntity player = MINECRAFT.player;
MatrixStack matrixStack = event.getMatrixStack();
if (player != null && player.isPotionActive(NetherExEffects.FIRE_BURNING.get())) {
renderFirstPersonBlueFire(matrixStack);
}
}
use of net.minecraft.entity.player.PlayerEntity in project AgriCraft by AgriCraft.
the class ItemTrowel method onItemUse.
@Nonnull
@Override
public ActionResultType onItemUse(@Nonnull ItemUseContext context) {
World world = context.getWorld();
BlockPos pos = context.getPos();
ItemStack stack = context.getItem();
PlayerEntity player = context.getPlayer();
return AgriApi.getCrop(world, pos).map(crop -> this.tryUseOnCrop(crop, stack, player)).orElseGet(() -> this.tryPlantOnSoil(world, pos, stack, player));
}
use of net.minecraft.entity.player.PlayerEntity in project AgriCraft by AgriCraft.
the class MagnifyingGlassViewHandler method checkInspectedPosition.
protected void checkInspectedPosition() {
RayTraceResult hit = Minecraft.getInstance().objectMouseOver;
Target target = Target.getTarget(hit);
if (target == null) {
this.endInspection();
return;
}
if (target.isNewTarget(this.lastTarget)) {
this.endInspection();
MessageMagnifyingGlassObserving.sendToServer(this.getPlayer(), true);
World world = AgriCraft.instance.getClientWorld();
PlayerEntity player = AgriCraft.instance.getClientPlayer();
this.inspectors.stream().filter(inspector -> target.canInspect(world, inspector, player)).findAny().ifPresent(inspector -> {
this.lastTarget = target;
this.inspector = inspector;
this.lastTarget.onInspectionStart(world, inspector, player);
});
}
}
use of net.minecraft.entity.player.PlayerEntity in project AgriCraft by AgriCraft.
the class ItemSeedBag method onItemUse.
@Nonnull
@Override
public ActionResultType onItemUse(@Nonnull ItemUseContext context) {
Contents contents = this.getContents(context.getItem());
if (this.isActivated(context.getItem())) {
Hand hand = context.getHand();
PlayerEntity player = context.getPlayer();
if (hand == Hand.OFF_HAND) {
// From off hand: interact with main to insert / extract seeds
if (player != null && this.attemptExtractOrInsertSeed(player, contents)) {
return ActionResultType.SUCCESS;
}
} else {
// From main hand: interact with the world to plant the seed
if (this.attemptPlantSeed(context.getWorld(), context.getPos(), contents, player)) {
return ActionResultType.SUCCESS;
}
}
}
return ActionResultType.PASS;
}
use of net.minecraft.entity.player.PlayerEntity in project AgriCraft by AgriCraft.
the class MessageCompareLight method processMessage.
@Override
protected void processMessage(NetworkEvent.Context ctx) {
// Get world.
final World world = AgriCraft.instance.proxy().getWorldFromDimension(this.dimId);
// Get player.
final PlayerEntity player = ctx.getSender();
// Get server light data.
final byte[] serverLightData = LightHelper.getLightData(world, this.pos);
// Message the light data to the player.
LightHelper.messageLightData(player, clientLightData, serverLightData);
}
Aggregations