use of net.minecraftforge.eventbus.api.SubscribeEvent in project SpongeCommon by SpongePowered.
the class SpongeForge method onServerAboutToStart.
@SubscribeEvent
public void onServerAboutToStart(final FMLServerAboutToStartEvent event) {
// Save config now that registries have been initialized
ConfigHandle.setSaveSuppressed(false);
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.establishServerServices();
lifecycle.establishServerFeatures();
lifecycle.establishServerRegistries((Server) event.getServer());
lifecycle.callStartingEngineEvent((Server) event.getServer());
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project SpongeCommon by SpongePowered.
the class SpongeForge method onServerStoppedEvent.
@SubscribeEvent
public void onServerStoppedEvent(final FMLServerStoppedEvent event) {
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.callStoppingEngineEvent((Server) event.getServer());
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class JsonSyncHandler method onConnect.
@SubscribeEvent
@SuppressWarnings("unused")
public void onConnect(PlayerEvent.PlayerLoggedInEvent event) {
if (event.getPlayer() instanceof ServerPlayerEntity) {
ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer();
MinecraftServer server = player.getServer();
if (server != null) {
if (server.isDedicatedServer()) {
// always sync on dedicated servers
this.syncJsons(player);
} else if (server.getPublic()) {
// only sync when the server is open to LAN on integrated servers
this.syncJsons(player);
}
}
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class AnvilHandler method onAnvilUpdate.
@SubscribeEvent
@SuppressWarnings("unused")
public void onAnvilUpdate(AnvilUpdateEvent event) {
ItemStack armor = ItemStack.EMPTY;
if (event.getLeft().getItem() == AgriCraft.instance.getModItemRegistry().magnifying_glass) {
armor = event.getRight();
} else if (event.getRight().getItem() == AgriCraft.instance.getModItemRegistry().magnifying_glass) {
armor = event.getLeft();
}
if (CapabilityGeneInspector.getInstance().shouldApplyCapability(armor)) {
if (CapabilityGeneInspector.getInstance().hasInspectionCapability(armor)) {
return;
}
ItemStack output = armor.copy();
if (CapabilityGeneInspector.getInstance().applyInspectionCapability(output)) {
// Set the name
String inputName = event.getName();
if (inputName == null || inputName.isEmpty()) {
output.clearCustomName();
} else {
output.setDisplayName(new StringTextComponent(inputName));
}
// set output and cost
event.setOutput(output);
event.setCost(1);
}
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project AgriCraft by AgriCraft.
the class JournalViewPointHandler method onPlayerRender.
@SuppressWarnings("unused")
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Pre event) {
if (event.getPlayer() == AgriCraft.instance.getClientPlayer()) {
if (event.getRenderer().getEntityModel() instanceof IAnimatablePlayerModel) {
IAnimatablePlayerModel model = (IAnimatablePlayerModel) event.getRenderer().getEntityModel();
model.setDoArmWobble(!this.isActive());
}
}
}
Aggregations