use of net.minecraftforge.eventbus.api.SubscribeEvent in project Geolosys by oitsjustjose.
the class ProPickItem method onDrawScreen.
@SubscribeEvent
@OnlyIn(Dist.CLIENT)
@SuppressWarnings("deprecation")
public void onDrawScreen(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getInstance();
if (event.getType() != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo || mc.gameSettings.showDebugProfilerChart) {
return;
}
if (mc.player.getHeldItemMainhand().getItem() instanceof ProPickItem || mc.player.getHeldItemOffhand().getItem() instanceof ProPickItem) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.disableLighting();
int seaLvl = mc.player.getEntityWorld().getSeaLevel();
int level = (int) (seaLvl - mc.player.getPosY());
if (level < 0) {
mc.fontRenderer.drawStringWithShadow(event.getMatrixStack(), I18n.format("geolosys.pro_pick.depth.above", Math.abs(level)), (float) ClientConfig.PROPICK_HUD_X.get(), (float) ClientConfig.PROPICK_HUD_Y.get(), 0xFFFFFFFF);
} else if (level == 0) {
mc.fontRenderer.drawStringWithShadow(event.getMatrixStack(), I18n.format("geolosys.pro_pick.depth.at"), (float) ClientConfig.PROPICK_HUD_X.get(), (float) ClientConfig.PROPICK_HUD_Y.get(), 0xFFFFFFFF);
} else {
mc.fontRenderer.drawStringWithShadow(event.getMatrixStack(), I18n.format("geolosys.pro_pick.depth.below", Math.abs(level)), (float) ClientConfig.PROPICK_HUD_X.get(), (float) ClientConfig.PROPICK_HUD_Y.get(), 0xFFFFFFFF);
}
RenderSystem.color4f(1F, 1F, 1F, 1F);
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project SpongeCommon by SpongePowered.
the class SpongeForge method onServerStarted.
@SubscribeEvent
public void onServerStarted(final FMLServerStartedEvent event) {
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.callStartedEngineEvent((Server) event.getServer());
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project Tropicraft by Tropicraft.
the class TropicraftRenderLayers method registerLayers.
@SubscribeEvent
public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions event) {
KOA_HUNTER_LAYER = registerMain("koa_hunter", KoaModel::create, event);
TROPI_CREEPER_LAYER = registerMain("tropi_creeper", TropiCreeperModel::create, event);
IGUANA_LAYER = registerMain("iguana", IguanaModel::create, event);
UMBRELLA_LAYER = registerMain("umbrella", UmbrellaModel::create, event);
BEACH_FLOAT_LAYER = registerMain("beach_float", BeachFloatModel::create, event);
CHAIR_LAYER = registerMain("chair", ChairModel::create, event);
TROPI_SKELLY_LAYER = registerMain("tropi_skelly", TropiSkellyModel::create, event);
EIH_LAYER = registerMain("eih", EIHModel::create, event);
SEA_TURTLE_LAYER = registerMain("sea_turtle", SeaTurtleModel::create, event);
MARLIN_LAYER = registerMain("marlin", MarlinModel::create, event);
FAILGULL_LAYER = registerMain("failgull", FailgullModel::create, event);
DOLPHIN_LAYER = registerMain("dolphin", TropicraftDolphinModel::create, event);
SEAHORSE_LAYER = registerMain("seahorse", SeahorseModel::create, event);
TREE_FROG_LAYER = registerMain("tree_frog", TreeFrogModel::create, event);
SEA_URCHIN_LAYER = registerMain("sea_urchin", SeaUrchinModel::create, event);
SEA_URCHIN_EGG_ENTITY_LAYER = registerMain("sea_urchin_egg", EggModel::create, event);
STARFISH_EGG_LAYER = registerMain("starfish_egg", EggModel::create, event);
V_MONKEY_LAYER = registerMain("v_monkey", VMonkeyModel::create, event);
PIRANHA_LAYER = registerMain("piranha", PiranhaModel::create, event);
RIVER_SARDINE_LAYER = registerMain("river_sardine", SardineModel::create, event);
TROPICAL_FISH_LAYER = registerMain("tropical_fish", TropicraftTropicalFishModel::create, event);
EAGLE_RAY_LAYER = registerMain("eagle_ray", EagleRayModel::create, event);
TROPI_SPIDER_EGG_LAYER = registerMain("tropi_spider_egg", EggModel::create, event);
ASHEN_LAYER = registerMain("ashen", AshenModel::create, event);
HAMMERHEAD_LAYER = registerMain("hammerhead", SharkModel::create, event);
SEA_TURTLE_EGG_LAYER = registerMain("turtle_egg", EggModel::create, event);
TROPI_BEE_LAYER = registerMain("tropi_bee", TropiBeeModel::createBodyLayer, event);
COWKTAIL_LAYER = registerMain("cowktail", CowModel::createBodyLayer, event);
MAN_O_WAR_OUTER_LAYER = registerMain("man_o_war", ManOWarModel::createOuterModel, event);
MAN_O_WAR_GEL_LAYER = registerMain("man_o_war_gel", ManOWarModel::createGelLayerModel, event);
BAMBOO_MUG = registerMain("bamboo_mug", BambooMugModel::create, event);
// BAMBOO_CHEST = registerMain("bamboo_chest", BambooChestRenderer);
// BAMBOO_DOUBLE_CHEST_LEFT = registerMain("bamboo_double_chest_left", () -> BambooChestBlockEntityRenderer.getLeftDoubleTexturedModelData());
// BAMBOO_DOUBLE_CHEST_RIGHT = registerMain("bamboo_double_chest_right", () -> BambooChestBlockEntityRenderer.getRightDoubleTexturedModelData());
EIHMACHINE_LAYER = registerMain("drink_mixer", EIHMachineModel::create, event);
AIRCOMPRESSOR_LAYER = registerMain("air_compressor", EIHMachineModel::create, event);
BASILISK_LIZARD_LAYER = registerMain("basilisk_lizard", BasiliskLizardModel::create, event);
CUBERA_LAYER = registerMain("cubera", CuberaModel::create, event);
FIDDLER_CRAB_LAYER = registerMain("fiddler_crab", FiddlerCrabModel::create, event);
HUMMINGBIRD_LAYER = registerMain("hummingbird", HummingbirdModel::create, event);
JAGUAR_LAYER = registerMain("jaguar", JaguarModel::create, event);
TAPIR_LAYER = registerMain("tapir", TapirModel::create, event);
SPIDER_MONKEY_LAYER = registerMain("spider_monkey", SpiderMonkeyModel::create, event);
WHITE_LIPPED_PECCARY_LAYER = registerMain("white_lipped_peccary", WhiteLippedPeccaryModel::create, event);
// ArrayList<MaskArmorProvider> MASK_PROVIDER = new ArrayList<>();
final List<RegistryObject<AshenMaskItem>> masks = TropicraftItems.ASHEN_MASKS.values().asList();
for (RegistryObject<AshenMaskItem> maskItem : masks) {
ModelLayerLocation ashen_mask_layer = registerMain("ashen_mask_" + maskItem.get().getMaskType().name().toLowerCase(Locale.ROOT), PlayerHeadpieceModel::create, event);
ASHEN_MASK_LAYERS.add(ashen_mask_layer);
}
STACHE_LAYER = registerMain("nigel_stache", PlayerHeadpieceModel::create, event);
HEAD_SCUBA_LAYER = registerMain("scuba_goggles", ModelScubaGear::create, event);
CHEST_SCUBA_LAYER = registerMain("scuba_harness", ModelScubaGear::create, event);
FEET_SCUBA_LAYER = registerMain("scuba_flippers", ModelScubaGear::create, event);
TANK_SCUBA_LAYER = registerMain("pony_bottle", ModelScubaGear::create, event);
setupScubaGearModels();
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project Tropicraft by Tropicraft.
the class PlayerRotationHandler method onRenderPlayerPost.
@SubscribeEvent
public static void onRenderPlayerPost(RenderPlayerEvent.Post event) {
Player p = event.getPlayer();
if (p.getVehicle() instanceof BeachFloatEntity || p.getVehicle() instanceof SeaTurtleEntity) {
event.getMatrixStack().popPose();
p.setXRot(rotationPitch);
p.xRotO = prevRotationPitch;
}
if (p.getVehicle() instanceof BeachFloatEntity) {
p.yHeadRot = rotationYawHead;
p.yHeadRotO = prevRotationYawHead;
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project Tropicraft by Tropicraft.
the class ScubaHUD method renderHUD.
@SubscribeEvent
public static void renderHUD(RenderGameOverlayEvent event) {
Entity renderViewEntity = Minecraft.getInstance().cameraEntity;
if (event.getType() == ElementType.TEXT && renderViewEntity instanceof Player) {
Player player = (Player) renderViewEntity;
// TODO support other slots than chest?
ItemStack chestStack = player.getItemBySlot(EquipmentSlot.CHEST);
Item chestItem = chestStack.getItem();
if (chestItem instanceof ScubaArmorItem) {
LazyOptional<ScubaData> data = player.getCapability(ScubaData.CAPABILITY);
int airRemaining = ((ScubaArmorItem) chestItem).getRemainingAir(chestStack);
ChatFormatting airColor = getAirTimeColor(airRemaining, player.level);
double depth = ScubaData.getDepth(player);
String depthStr;
if (depth > 0) {
depthStr = String.format("%.1fm", depth);
} else {
depthStr = TropicraftLangKeys.NA.getLocalizedText();
}
data.ifPresent(d -> drawHUDStrings(event.getMatrixStack(), TropicraftLangKeys.SCUBA_AIR_TIME.format(airColor + formatTime(airRemaining)), TropicraftLangKeys.SCUBA_DIVE_TIME.format(formatTime(d.getDiveTime())), TropicraftLangKeys.SCUBA_DEPTH.format(depthStr), TropicraftLangKeys.SCUBA_MAX_DEPTH.format(String.format("%.1fm", d.getMaxDepth()))));
}
}
}
Aggregations