From da0f071d58f8facc9730416e2f6cf8bbee65fa76 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 27 May 2016 18:54:17 +0200 Subject: [PATCH] Death tracking part 1 --- .../mod/booklet/GuiBooklet.java | 10 +- .../mod/event/EntityLivingEvent.java | 82 ---------- .../mod/event/EntityLivingEvents.java | 151 ++++++++++++++++++ .../mod/event/InitEvents.java | 3 +- .../mod/event/LivingDropEvent.java | 53 ------ .../mod/event/PlayerObtainEvents.java | 4 +- .../mod/inventory/ContainerDrill.java | 3 +- .../mod/items/ItemLaserWrench.java | 7 +- .../mod/items/ItemPhantomConnector.java | 7 +- .../mod/misc/DamageSources.java | 3 +- .../actuallyadditions/mod/misc/WorldData.java | 14 +- .../mod/proxy/ClientProxy.java | 5 +- .../mod/tile/TileEntityInventoryBase.java | 3 +- .../TileEntityLaserRelayItemWhitelist.java | 7 +- ...ntClientData.java => ExtraClientData.java} | 2 +- ...tServerData.java => PlayerServerData.java} | 2 +- .../assets/actuallyadditions/lang/en_US.lang | 1 + 17 files changed, 189 insertions(+), 168 deletions(-) delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java create mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java rename src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/{PersistentClientData.java => ExtraClientData.java} (99%) rename src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/{PersistentServerData.java => PlayerServerData.java} (98%) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index 43f922449..217305ddb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -27,7 +27,7 @@ import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; +import de.ellpeck.actuallyadditions.mod.util.playerdata.ExtraClientData; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; @@ -353,14 +353,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ if(ItemBooklet.forcedEntry == null){ //Open last entry or introductory entry - if(this.tryOpenMainPage && !PersistentClientData.getBoolean("BookAlreadyOpened")){ + if(this.tryOpenMainPage && !ExtraClientData.getBoolean("BookAlreadyOpened")){ BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true); BookletUtils.openChapter(this, InitBooklet.chapterIntro, null); - PersistentClientData.setBoolean("BookAlreadyOpened", true); + ExtraClientData.setBoolean("BookAlreadyOpened", true); } else{ - PersistentClientData.openLastBookPage(this); + ExtraClientData.openLastBookPage(this); } } else{ @@ -410,7 +410,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ @Override public void onGuiClosed(){ if(this.saveOnClose){ - PersistentClientData.saveBookPage(this); + ExtraClientData.saveBookPage(this); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java deleted file mode 100644 index c15e0e0f8..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file ("EntityLivingEvent.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.event; - -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.passive.EntityOcelot; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.UUID; - -public class EntityLivingEvent{ - - @SubscribeEvent - public void livingUpdateEvent(LivingUpdateEvent event){ - //Ocelots dropping Hair Balls - if(event.getEntityLiving() != null && event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote){ - if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){ - if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){ - if(Util.RANDOM.nextInt(5000)+1 == 1){ - EntityItem item = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall)); - event.getEntityLiving().worldObj.spawnEntityInWorld(item); - } - } - } - } - - //Wings allowing Flight - this.doWingStuff(event); - } - - /** - * Makes players be able to fly if they have Wings Of The Bats equipped - * (Partially excerpted from Botania's Wing System by Vazkii (as I had fiddled around with the system and couldn't make it work) with permission, thanks!) - */ - private void doWingStuff(LivingUpdateEvent event){ - if(event.getEntityLiving() instanceof EntityPlayer){ - EntityPlayer player = (EntityPlayer)event.getEntityLiving(); - boolean wingsEquipped = ItemWingsOfTheBats.getWingItem(player) != null; - - //If Player isn't (really) winged - if(!ItemWingsOfTheBats.isPlayerWinged(player)){ - if(wingsEquipped){ - //Make the Player actually winged - ItemWingsOfTheBats.addWingsToPlayer(player); - } - } - //If Player is (or should be) winged - else{ - if(wingsEquipped){ - //Allow the Player to fly when he has Wings equipped - player.capabilities.allowFlying = true; - } - else{ - //Make the Player not winged - ItemWingsOfTheBats.removeWingsFromPlayer(player); - //Reset Player's Values - if(!player.capabilities.isCreativeMode){ - player.capabilities.allowFlying = false; - player.capabilities.isFlying = false; - //Enables Fall Damage again (Automatically gets disabled for some reason) - player.capabilities.disableDamage = false; - } - } - } - } - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java new file mode 100644 index 000000000..f24326d96 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java @@ -0,0 +1,151 @@ +/* + * This file ("EntityLivingEvent.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.event; + +import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; +import de.ellpeck.actuallyadditions.mod.items.InitItems; +import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats; +import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; +import de.ellpeck.actuallyadditions.mod.misc.WorldData; +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.Util; +import de.ellpeck.actuallyadditions.mod.util.playerdata.PlayerServerData; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.UUID; + +public class EntityLivingEvents{ + + @SubscribeEvent + public void livingUpdateEvent(LivingUpdateEvent event){ + //Ocelots dropping Hair Balls + if(event.getEntityLiving() != null){ + if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote){ + if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){ + if(ConfigBoolValues.DO_CAT_DROPS.isEnabled()){ + if(Util.RANDOM.nextInt(5000)+1 == 1){ + EntityItem item = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall)); + event.getEntityLiving().worldObj.spawnEntityInWorld(item); + } + } + } + } + + //Wings allowing Flight + this.doWingStuff(event.getEntityLiving()); + } + } + + @SubscribeEvent + public void livingDeathEvent(LivingDeathEvent event){ + if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityPlayer){ + EntityPlayer player = (EntityPlayer)event.getEntityLiving(); + NBTTagCompound data = PlayerServerData.getDataFromPlayer(player); + + NBTTagList deaths = data.getTagList("Deaths", 10); + while(deaths.tagCount() >= 5){ + deaths.removeTag(0); + } + + NBTTagCompound death = new NBTTagCompound(); + death.setDouble("X", player.posX); + death.setDouble("Y", player.posY); + death.setDouble("Z", player.posZ); + deaths.appendTag(death); + + data.setTag("Deaths", deaths); + + player.addChatComponentMessage(new TextComponentTranslation("info."+ModUtil.MOD_ID+".deathRecorded")); + WorldData.makeDirty(); + } + } + + @SubscribeEvent + public void onEntityDropEvent(LivingDropsEvent event){ + if(event.getEntityLiving().worldObj != null && !event.getEntityLiving().worldObj.isRemote && event.getSource().getEntity() instanceof EntityPlayer){ + //Drop Solidified XP + if(event.getEntityLiving() instanceof EntityCreature){ + if(Util.RANDOM.nextInt(10) <= event.getLootingLevel()*2){ + event.getEntityLiving().entityDropItem(new ItemStack(InitItems.itemSolidifiedExperience, Util.RANDOM.nextInt(2+event.getLootingLevel())+1), 0); + } + } + + //Drop Cobwebs from Spiders + if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof EntitySpider){ + if(Util.RANDOM.nextInt(20) <= event.getLootingLevel()*2){ + event.getEntityLiving().entityDropItem(new ItemStack(Blocks.WEB, Util.RANDOM.nextInt(2+event.getLootingLevel())+1), 0); + } + } + + //Drop Wings from Bats + if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof EntityBat){ + if(Util.RANDOM.nextInt(15) <= event.getLootingLevel()*2){ + event.getEntityLiving().entityDropItem(new ItemStack(InitItems.itemMisc, Util.RANDOM.nextInt(2+event.getLootingLevel())+1, TheMiscItems.BAT_WING.ordinal()), 0); + } + } + } + } + + /** + * Makes players be able to fly if they have Wings Of The Bats equipped + * (Partially excerpted from Botania's Wing System by Vazkii (as I had fiddled around with the system and couldn't make it work) with permission, thanks!) + */ + private void doWingStuff(EntityLivingBase living){ + if(living instanceof EntityPlayer){ + EntityPlayer player = (EntityPlayer)living; + boolean wingsEquipped = ItemWingsOfTheBats.getWingItem(player) != null; + + //If Player isn't (really) winged + if(!ItemWingsOfTheBats.isPlayerWinged(player)){ + if(wingsEquipped){ + //Make the Player actually winged + ItemWingsOfTheBats.addWingsToPlayer(player); + } + } + //If Player is (or should be) winged + else{ + if(wingsEquipped){ + //Allow the Player to fly when he has Wings equipped + player.capabilities.allowFlying = true; + } + else{ + //Make the Player not winged + ItemWingsOfTheBats.removeWingsFromPlayer(player); + //Reset Player's Values + if(!player.capabilities.isCreativeMode){ + player.capabilities.allowFlying = false; + player.capabilities.isFlying = false; + //Enables Fall Damage again (Automatically gets disabled for some reason) + player.capabilities.disableDamage = false; + } + } + } + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java index 72050a4e1..b605b6700 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/InitEvents.java @@ -24,8 +24,7 @@ public class InitEvents{ ModUtil.LOGGER.info("Initializing Events..."); Util.registerEvent(new PlayerObtainEvents()); - Util.registerEvent(new LivingDropEvent()); - Util.registerEvent(new EntityLivingEvent()); + Util.registerEvent(new EntityLivingEvents()); Util.registerEvent(new LogoutEvent()); Util.registerEvent(new WorldLoadingEvents()); Util.registerEvent(new BreakEvent()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java deleted file mode 100644 index a6168f2b8..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/LivingDropEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file ("LivingDropEvent.java") is part of the Actually Additions mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015-2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.event; - -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class LivingDropEvent{ - - @SubscribeEvent - public void onEntityDropEvent(LivingDropsEvent event){ - if(event.getSource().getEntity() instanceof EntityPlayer){ - //Drop Solidified XP - if(event.getEntityLiving() instanceof EntityCreature){ - if(Util.RANDOM.nextInt(10) <= event.getLootingLevel()*2){ - event.getEntityLiving().entityDropItem(new ItemStack(InitItems.itemSolidifiedExperience, Util.RANDOM.nextInt(2+event.getLootingLevel())+1), 0); - } - } - - //Drop Cobwebs from Spiders - if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.getEntityLiving() instanceof EntitySpider){ - if(Util.RANDOM.nextInt(20) <= event.getLootingLevel()*2){ - event.getEntityLiving().entityDropItem(new ItemStack(Blocks.WEB, Util.RANDOM.nextInt(2+event.getLootingLevel())+1), 0); - } - } - - //Drop Wings from Bats - if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.getEntityLiving() instanceof EntityBat){ - if(Util.RANDOM.nextInt(15) <= event.getLootingLevel()*2){ - event.getEntityLiving().entityDropItem(new ItemStack(InitItems.itemMisc, Util.RANDOM.nextInt(2+event.getLootingLevel())+1, TheMiscItems.BAT_WING.ordinal()), 0); - } - } - } - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java index 3bb1efb61..f6fc2871f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.misc.WorldData; import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData; +import de.ellpeck.actuallyadditions.mod.util.playerdata.PlayerServerData; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -49,7 +49,7 @@ public class PlayerObtainEvents{ String name = event.crafting.getItem().getRegistryName().toString(); if(name != null && name.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID)){ - NBTTagCompound compound = PersistentServerData.getDataFromPlayer(event.player); + NBTTagCompound compound = PlayerServerData.getDataFromPlayer(event.player); if(compound != null && !compound.getBoolean("BookGottenAlready")){ compound.setBoolean("BookGottenAlready", true); WorldData.makeDirty(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 64c38e872..1304dab0b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -25,6 +25,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import javax.annotation.Nonnull; @@ -265,7 +266,7 @@ public class ContainerDrill extends Container{ @Nonnull @Override public ITextComponent getDisplayName(){ - return new TextComponentString(StringUtil.localize(this.getName())); + return new TextComponentTranslation(this.getName()); } } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index f69f7973c..8044a357d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -25,6 +25,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -48,7 +49,7 @@ public class ItemLaserWrench extends ItemBase{ if(tile instanceof TileEntityLaserRelay){ if(ItemPhantomConnector.getStoredPosition(stack) == null){ ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".laser.stored.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.stored.desc")); } else{ BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack); @@ -60,10 +61,10 @@ public class ItemLaserWrench extends ItemBase{ ((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate(); ((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate(); - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".laser.connected.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.connected.desc")); } else{ - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".laser.cantConnect.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".laser.cantConnect.desc")); ItemPhantomConnector.clearStorage(stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 46082e8fd..487dcf517 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -26,6 +26,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -96,7 +97,7 @@ public class ItemPhantomConnector extends ItemBase{ ((TileEntityBase)tile).sendUpdate(); } clearStorage(stack); - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.connected.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".phantom.connected.desc")); return EnumActionResult.SUCCESS; } return EnumActionResult.FAIL; @@ -104,7 +105,7 @@ public class ItemPhantomConnector extends ItemBase{ } //Storing Connections storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.stored.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".phantom.stored.desc")); } return EnumActionResult.SUCCESS; } @@ -117,7 +118,7 @@ public class ItemPhantomConnector extends ItemBase{ if(tile instanceof IPhantomTile){ ((IPhantomTile)tile).setBoundPosition(null); } - player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID+".phantom.unbound.desc"))); + player.addChatComponentMessage(new TextComponentTranslation("tooltip."+ModUtil.MOD_ID+".phantom.unbound.desc")); return false; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java index a3bfe983c..076da6eaa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java @@ -17,6 +17,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import javax.annotation.Nonnull; @@ -35,6 +36,6 @@ public class DamageSources extends DamageSource{ @Override public ITextComponent getDeathMessage(EntityLivingBase entity){ String locTag = "death."+ModUtil.MOD_ID+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1); - return new TextComponentString(StringUtil.localizeFormatted(locTag, entity.getName())); + return new TextComponentTranslation(String.format(locTag, entity.getName())); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java index 1f210a75f..f188da725 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.misc; import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentServerData; +import de.ellpeck.actuallyadditions.mod.util.playerdata.PlayerServerData; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.server.MinecraftServer; @@ -65,9 +65,9 @@ public class WorldData extends WorldSavedData{ ModUtil.LOGGER.info("Clearing leftover Laser Relay Connection Data from other worlds!"); LaserRelayConnectionHandler.getInstance().networks.clear(); } - if(!PersistentServerData.playerSaveData.isEmpty()){ + if(!PlayerServerData.playerSaveData.isEmpty()){ ModUtil.LOGGER.info("Clearing leftover Persistent Server Data from other worlds!"); - PersistentServerData.playerSaveData.clear(); + PlayerServerData.playerSaveData.clear(); } } @@ -83,8 +83,8 @@ public class WorldData extends WorldSavedData{ //Player Data NBTTagList playerList = compound.getTagList("PlayerData", 10); for(int i = 0; i < playerList.tagCount(); i++){ - PersistentServerData.PlayerSave aSave = PersistentServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i)); - PersistentServerData.playerSaveData.add(aSave); + PlayerServerData.PlayerSave aSave = PlayerServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i)); + PlayerServerData.playerSaveData.add(aSave); } } @@ -100,8 +100,8 @@ public class WorldData extends WorldSavedData{ //Player Data NBTTagList playerList = new NBTTagList(); - for(int i = 0; i < PersistentServerData.playerSaveData.size(); i++){ - PersistentServerData.PlayerSave theSave = PersistentServerData.playerSaveData.get(i); + for(int i = 0; i < PlayerServerData.playerSaveData.size(); i++){ + PlayerServerData.PlayerSave theSave = PlayerServerData.playerSaveData.get(i); playerList.appendTag(theSave.toNBT()); } compound.setTag("PlayerData", playerList); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 68e491fd6..ffd5df5d3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -18,7 +18,6 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.mod.blocks.render.RenderCompost; import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens; import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud; -import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.event.InitEvents; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; @@ -29,7 +28,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud; import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper; import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem; import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; +import de.ellpeck.actuallyadditions.mod.util.playerdata.ExtraClientData; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -122,7 +121,7 @@ public class ClientProxy implements IProxy{ ModUtil.LOGGER.warn("You have turned Seasonal Mode off. Therefore, you are evil."); } - PersistentClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"data.dat")); + ExtraClientData.setTheFile(new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"data.dat")); for(Map.Entry entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){ ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index a0dd6b7e0..1f2c8190d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.wrapper.SidedInvWrapper; @@ -217,7 +218,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements @Nonnull @Override public ITextComponent getDisplayName(){ - return new TextComponentString(StringUtil.localize(this.getName())); + return new TextComponentTranslation(this.getName()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java index 595fa942e..ecdd6b98f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.items.IItemHandler; import javax.annotation.Nonnull; @@ -38,9 +39,9 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem this.filterInventory = new IInventory(){ - private de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist tile; + private TileEntityLaserRelayItemWhitelist tile; - private IInventory setTile(de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemWhitelist tile){ + private IInventory setTile(TileEntityLaserRelayItemWhitelist tile){ this.tile = tile; return this; } @@ -153,7 +154,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem @Nonnull @Override public ITextComponent getDisplayName(){ - return new TextComponentString(StringUtil.localize(this.getName())); + return new TextComponentTranslation(this.getName()); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentClientData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/ExtraClientData.java similarity index 99% rename from src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentClientData.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/ExtraClientData.java index 66de9c155..a21aed15d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentClientData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/ExtraClientData.java @@ -27,7 +27,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; @SideOnly(Side.CLIENT) -public class PersistentClientData{ +public class ExtraClientData{ private static File theFile; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PlayerServerData.java similarity index 98% rename from src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PlayerServerData.java index 06e65668e..e862aa28b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PersistentServerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/playerdata/PlayerServerData.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; import java.util.UUID; -public class PersistentServerData{ +public class PlayerServerData{ public static final ArrayList playerSaveData = new ArrayList(); diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index f9229f5b3..6b5fe4d3c 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -547,6 +547,7 @@ info.actuallyadditions.noLens=No Lens info.actuallyadditions.booklet.manualName.1=Actually Additions info.actuallyadditions.booklet.manualName.2=Manual info.actuallyadditions.booklet.edition=Edition +info.actuallyadditions.deathRecorded=Your death has been recorded. Use a Death Tracker to find the death location! #Container Names container.actuallyadditions.inputter.name=ESD