use of stevekung.mods.moreplanets.util.JsonUtil in project MorePlanets by SteveKunG.
the class EntityVeinFloater method onLivingUpdate.
@Override
public void onLivingUpdate() {
if (this.spawner != null) {
List<EntityPlayer> playersWithin = this.world.getEntitiesWithinAABB(EntityPlayer.class, this.spawner.getRangeBounds());
this.entitiesWithin = playersWithin.size();
if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) {
List<EntityPlayer> playerWithin = this.world.getEntitiesWithinAABB(EntityPlayer.class, this.spawner.getRangeBoundsPlus11());
for (EntityPlayer player : playerWithin) {
JsonUtil json = new JsonUtil();
player.sendMessage(json.text(GCCoreUtil.translate("gui.skeleton_boss.message")).setStyle(json.red()));
}
this.setDead();
return;
}
this.entitiesWithinLast = this.entitiesWithin;
}
if (!this.playMusic) {
this.world.playEvent(1010, this.getPosition(), Item.getIdFromItem(MPItems.VEIN_FLOATER_DISC));
this.playMusic = true;
}
this.partHead.onUpdate();
this.partHead.setLocationAndAngles(this.posX, this.posY + 13.0D, this.posZ, 0.0F, 0.0F);
this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth());
super.onLivingUpdate();
}
use of stevekung.mods.moreplanets.util.JsonUtil in project MorePlanets by SteveKunG.
the class EntityMiniVeinFloater method onLivingUpdate.
@Override
public void onLivingUpdate() {
if (this.spawner != null) {
List<EntityPlayer> playersWithin = this.world.getEntitiesWithinAABB(EntityPlayer.class, this.spawner.getRangeBounds());
this.entitiesWithin = playersWithin.size();
if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) {
List<EntityPlayer> playerWithin = this.world.getEntitiesWithinAABB(EntityPlayer.class, this.spawner.getRangeBoundsPlus11());
for (EntityPlayer player : playerWithin) {
JsonUtil json = new JsonUtil();
player.sendMessage(new JsonUtil().text(GCCoreUtil.translate("gui.skeleton_boss.message")).setStyle(json.red()));
}
this.setDead();
return;
}
this.entitiesWithinLast = this.entitiesWithin;
}
this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth());
super.onLivingUpdate();
}
use of stevekung.mods.moreplanets.util.JsonUtil in project MorePlanets by SteveKunG.
the class TileEntityBlackHoleStorage method update.
@Override
public void update() {
super.update();
this.renderTicks++;
if (this.initialize) {
this.renderTicks = this.renderTicks + this.world.rand.nextInt(100);
this.initialize = false;
}
if (this.ticks % 20 == 0) {
this.world.playSound(null, this.pos.getX(), this.pos.getY(), this.pos.getZ(), MPSounds.BLACK_HOLE_AMBIENT, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
if (this.world != null && !this.world.isRemote) {
this.updateStorage();
List<EntityBlackHoleStorage> blackHoleList = this.world.getEntitiesWithinAABB(EntityBlackHoleStorage.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 2, this.pos.getZ(), this.pos.getX() + 1.0D, this.pos.getY() + 3, this.pos.getZ() + 1.0D));
for (EntityBlackHoleStorage bh : blackHoleList) {
bh.setDisable(this.disableBlackHole);
bh.setCollectMode(this.collectMode);
}
if (blackHoleList.isEmpty()) {
JsonUtil json = new JsonUtil();
EntityPlayer player = this.world.getPlayerEntityByUUID(UUID.fromString(this.ownerUUID));
this.destroyBlock();
if (player != null) {
player.sendMessage(json.text(GCCoreUtil.translate("gui.black_hole_disappear.message")).setStyle(json.red()));
}
}
this.xpTemp = this.fluidTank.getFluidAmount();
}
}
use of stevekung.mods.moreplanets.util.JsonUtil in project MorePlanets by SteveKunG.
the class ClientEventHandler method onPlayerTick.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerTick(PlayerTickEvent event) {
String URL = "https://minecraft.curseforge.com/projects/galacticraft-add-on-more-planets";
JsonUtil json = new JsonUtil();
EntityPlayer player = event.player;
if (player != null) {
// prevent randomly NPE
if (this.mc.player == player) {
this.runAlienBeamTick(player);
}
// 0 = OutOfDate, 1 = ShowDesc, 2 = NoConnection
if (player.world.isRemote) {
if (ConfigManagerMP.enableVersionChecker) {
if (!MorePlanetsCore.STATUS_CHECK[2] && VersionChecker.INSTANCE.noConnection()) {
player.sendMessage(json.text("Unable to check latest version, Please check your internet connection").setStyle(json.red()));
player.sendMessage(json.text(VersionChecker.INSTANCE.getExceptionMessage()).setStyle(json.red()));
MorePlanetsCore.STATUS_CHECK[2] = true;
return;
}
if (!MorePlanetsCore.STATUS_CHECK[0] && !MorePlanetsCore.STATUS_CHECK[2] && VersionChecker.INSTANCE.isLatestVersion()) {
player.sendMessage(json.text("New version of ").appendSibling(json.text("More Planets").setStyle(json.style().setColor(TextFormatting.AQUA)).appendSibling(json.text(" is available ").setStyle(json.white()).appendSibling(json.text("v" + VersionChecker.INSTANCE.getLatestVersion().replace("[" + MorePlanetsCore.MC_VERSION + "]=", "")).setStyle(json.style().setColor(TextFormatting.GREEN)).appendSibling(json.text(" for ").setStyle(json.white()).appendSibling(json.text("MC-" + MorePlanetsCore.MC_VERSION).setStyle(json.style().setColor(TextFormatting.GOLD))))))));
player.sendMessage(json.text("Download Link ").setStyle(json.style().setColor(TextFormatting.YELLOW)).appendSibling(json.text("[CLICK HERE]").setStyle(json.style().setColor(TextFormatting.BLUE).setHoverEvent(json.hover(HoverEvent.Action.SHOW_TEXT, json.text("Click Here!").setStyle(json.style().setColor(TextFormatting.DARK_GREEN)))).setClickEvent(json.click(ClickEvent.Action.OPEN_URL, URL)))));
MorePlanetsCore.STATUS_CHECK[0] = true;
}
}
if (ConfigManagerMP.enableChangeLogInGame) {
if (!MorePlanetsCore.STATUS_CHECK[1] && !MorePlanetsCore.STATUS_CHECK[2]) {
for (String log : VersionChecker.INSTANCE.getChangeLog()) {
player.sendMessage(json.text(log).setStyle(json.colorFromConfig("gray")));
}
player.sendMessage(json.text("To read More Planets full change log. Use /mpchangelog command!").setStyle(json.colorFromConfig("gray").setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/mpchangelog"))));
}
MorePlanetsCore.STATUS_CHECK[1] = true;
}
}
}
}
use of stevekung.mods.moreplanets.util.JsonUtil in project MorePlanets by SteveKunG.
the class ItemAlienDefenderReinforcement method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack itemStack = player.getHeldItem(hand);
int range = 16;
Vec3d playerEye = player.getPositionEyes(1.0F);
Vec3d playerLook = player.getLook(1.0F);
Vec3d lookRange = playerEye.addVector(playerLook.x * range, playerLook.y * range, playerLook.z * range);
RayTraceResult moving = world.rayTraceBlocks(playerEye, lookRange);
boolean disable = false;
if (moving != null && disable) {
BlockPos pos = moving.getBlockPos();
if (world.isAirBlock(pos.up())) {
if (world.isRemote) {
FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.alien_defender_beacon.message")).setStyle(new JsonUtil().colorFromConfig("yellow")).getFormattedText(), false);
player.swingArm(hand);
} else {
world.setBlockState(pos.up(), MPBlocks.ALIEN_DEFENDER_BEACON.getDefaultState());
TileEntityAlienDefenderBeacon beacon = (TileEntityAlienDefenderBeacon) world.getTileEntity(pos.up());
beacon.bossCountdown = 200 + world.rand.nextInt(400);
if (!player.capabilities.isCreativeMode) {
itemStack.shrink(1);
}
}
} else {
if (world.isRemote) {
FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.not_air_block.message")).setStyle(new JsonUtil().red()).getFormattedText(), false);
player.swingArm(hand);
}
}
} else {
if (world.isRemote && disable) {
FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.target_too_far.message", range)).setStyle(new JsonUtil().red()).getFormattedText(), false);
player.swingArm(hand);
}
}
return new ActionResult<>(EnumActionResult.PASS, itemStack);
}
Aggregations