use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class MagnifyingGlassViewHandler method onPlayerRender.
@SuppressWarnings("unused")
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerRender(RenderPlayerEvent.Pre event) {
if (this.isActive()) {
PlayerRenderer renderer = event.getRenderer();
PlayerModel<AbstractClientPlayerEntity> model = renderer.getEntityModel();
Hand hand = this.getActiveHand();
HandSide side = Minecraft.getInstance().gameSettings.mainHand;
if ((hand == Hand.MAIN_HAND && side == HandSide.RIGHT) || (hand == Hand.OFF_HAND && side == HandSide.LEFT)) {
model.rightArmPose = BipedModel.ArmPose.BLOCK;
model.leftArmPose = BipedModel.ArmPose.EMPTY;
} else if ((hand == Hand.MAIN_HAND && side == HandSide.LEFT) || (hand == Hand.OFF_HAND && side == HandSide.RIGHT)) {
model.leftArmPose = BipedModel.ArmPose.BLOCK;
model.rightArmPose = BipedModel.ArmPose.EMPTY;
}
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class BlockUpdateHandler method onBlockUpdate.
@SubscribeEvent
@SuppressWarnings("unused")
public void onBlockUpdate(BlockEvent.NeighborNotifyEvent event) {
if (event.getWorld() instanceof ServerWorld) {
ServerWorld world = (ServerWorld) event.getWorld();
RegistryKey<World> dimension = world.getDimensionKey();
this.listeners.computeIfPresent(dimension, (dim, chunkMap) -> {
chunkMap.computeIfPresent(new ChunkPos(event.getPos()), (chunkPos, posMap) -> {
posMap.computeIfPresent(event.getPos(), (pos, set) -> {
set.forEach(listener -> listener.onBlockUpdate(world, pos));
return set;
});
return posMap;
});
return chunkMap;
});
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class ItemToolTipHandler method addRegistryInfo.
@SubscribeEvent
@SuppressWarnings("unused")
public void addRegistryInfo(ItemTooltipEvent event) {
if (AgriCraft.instance.getConfig().registryTooltips()) {
final Item item = event.getItemStack().getItem();
addCategory(event, "Registry");
addParameter(event, "id", item.getRegistryName());
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class BlockGreenHouseAirRenderer method render.
@SubscribeEvent
@SuppressWarnings("unused")
public void render(RenderWorldLastEvent event) {
PlayerEntity player = AgriCraft.instance.getClientPlayer();
ItemStack stack = player.getHeldItemMainhand();
if (stack.getItem() != AgriCraft.instance.getModItemRegistry().debugger) {
return;
}
if (AgriCraft.instance.getModItemRegistry().debugger.getDebugMode(stack) instanceof DebugModeGreenHouse) {
this.highlightGreenHouseAirBlocks(player.getEntityWorld(), player.getPosition(), event.getMatrixStack());
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class GeneAnimalAttractant method onEntitySpawned.
@SubscribeEvent
@SuppressWarnings("unused")
public void onEntitySpawned(EntityJoinWorldEvent event) {
if (!event.getWorld().isRemote() && this.clazz.isInstance(event.getEntity())) {
MobEntity entity = this.clazz.cast(event.getEntity());
EatCropGoal goal = new EatCropGoal(this, entity, SPEED, COOLDOWN, this.defaultPlantIds);
if (EntityHelper.injectGoal(entity, goal, PRIORITY)) {
CapabilityEatCropGoal.getInstance().setCropEatGoal(entity, goal);
}
}
}
Aggregations