mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Death tracking part 1
This commit is contained in:
parent
32b2de21e0
commit
da0f071d58
17 changed files with 189 additions and 168 deletions
|
@ -27,7 +27,7 @@ import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
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.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
@ -353,14 +353,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
|
|
||||||
if(ItemBooklet.forcedEntry == null){
|
if(ItemBooklet.forcedEntry == null){
|
||||||
//Open last entry or introductory entry
|
//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.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
|
||||||
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
|
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
|
||||||
|
|
||||||
PersistentClientData.setBoolean("BookAlreadyOpened", true);
|
ExtraClientData.setBoolean("BookAlreadyOpened", true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
PersistentClientData.openLastBookPage(this);
|
ExtraClientData.openLastBookPage(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -410,7 +410,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed(){
|
public void onGuiClosed(){
|
||||||
if(this.saveOnClose){
|
if(this.saveOnClose){
|
||||||
PersistentClientData.saveBookPage(this);
|
ExtraClientData.saveBookPage(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,8 +24,7 @@ public class InitEvents{
|
||||||
ModUtil.LOGGER.info("Initializing Events...");
|
ModUtil.LOGGER.info("Initializing Events...");
|
||||||
|
|
||||||
Util.registerEvent(new PlayerObtainEvents());
|
Util.registerEvent(new PlayerObtainEvents());
|
||||||
Util.registerEvent(new LivingDropEvent());
|
Util.registerEvent(new EntityLivingEvents());
|
||||||
Util.registerEvent(new EntityLivingEvent());
|
|
||||||
Util.registerEvent(new LogoutEvent());
|
Util.registerEvent(new LogoutEvent());
|
||||||
Util.registerEvent(new WorldLoadingEvents());
|
Util.registerEvent(new WorldLoadingEvents());
|
||||||
Util.registerEvent(new BreakEvent());
|
Util.registerEvent(new BreakEvent());
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
import de.ellpeck.actuallyadditions.mod.misc.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
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.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -49,7 +49,7 @@ public class PlayerObtainEvents{
|
||||||
|
|
||||||
String name = event.crafting.getItem().getRegistryName().toString();
|
String name = event.crafting.getItem().getRegistryName().toString();
|
||||||
if(name != null && name.toLowerCase(Locale.ROOT).contains(ModUtil.MOD_ID)){
|
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")){
|
if(compound != null && !compound.getBoolean("BookGottenAlready")){
|
||||||
compound.setBoolean("BookGottenAlready", true);
|
compound.setBoolean("BookGottenAlready", true);
|
||||||
WorldData.makeDirty();
|
WorldData.makeDirty();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -265,7 +266,7 @@ public class ContainerDrill extends Container{
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName(){
|
public ITextComponent getDisplayName(){
|
||||||
return new TextComponentString(StringUtil.localize(this.getName()));
|
return new TextComponentTranslation(this.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -48,7 +49,7 @@ public class ItemLaserWrench extends ItemBase{
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if(tile instanceof TileEntityLaserRelay){
|
||||||
if(ItemPhantomConnector.getStoredPosition(stack) == null){
|
if(ItemPhantomConnector.getStoredPosition(stack) == null){
|
||||||
ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world);
|
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{
|
else{
|
||||||
BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack);
|
BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack);
|
||||||
|
@ -60,10 +61,10 @@ public class ItemLaserWrench extends ItemBase{
|
||||||
((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate();
|
((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate();
|
||||||
((TileEntityLaserRelay)world.getTileEntity(pos)).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{
|
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);
|
ItemPhantomConnector.clearStorage(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
@ -96,7 +97,7 @@ public class ItemPhantomConnector extends ItemBase{
|
||||||
((TileEntityBase)tile).sendUpdate();
|
((TileEntityBase)tile).sendUpdate();
|
||||||
}
|
}
|
||||||
clearStorage(stack);
|
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.SUCCESS;
|
||||||
}
|
}
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
|
@ -104,7 +105,7 @@ public class ItemPhantomConnector extends ItemBase{
|
||||||
}
|
}
|
||||||
//Storing Connections
|
//Storing Connections
|
||||||
storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world);
|
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;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +118,7 @@ public class ItemPhantomConnector extends ItemBase{
|
||||||
if(tile instanceof IPhantomTile){
|
if(tile instanceof IPhantomTile){
|
||||||
((IPhantomTile)tile).setBoundPosition(null);
|
((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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -35,6 +36,6 @@ public class DamageSources extends DamageSource{
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDeathMessage(EntityLivingBase entity){
|
public ITextComponent getDeathMessage(EntityLivingBase entity){
|
||||||
String locTag = "death."+ModUtil.MOD_ID+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1);
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.misc;
|
package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
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.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.server.MinecraftServer;
|
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!");
|
ModUtil.LOGGER.info("Clearing leftover Laser Relay Connection Data from other worlds!");
|
||||||
LaserRelayConnectionHandler.getInstance().networks.clear();
|
LaserRelayConnectionHandler.getInstance().networks.clear();
|
||||||
}
|
}
|
||||||
if(!PersistentServerData.playerSaveData.isEmpty()){
|
if(!PlayerServerData.playerSaveData.isEmpty()){
|
||||||
ModUtil.LOGGER.info("Clearing leftover Persistent Server Data from other worlds!");
|
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
|
//Player Data
|
||||||
NBTTagList playerList = compound.getTagList("PlayerData", 10);
|
NBTTagList playerList = compound.getTagList("PlayerData", 10);
|
||||||
for(int i = 0; i < playerList.tagCount(); i++){
|
for(int i = 0; i < playerList.tagCount(); i++){
|
||||||
PersistentServerData.PlayerSave aSave = PersistentServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i));
|
PlayerServerData.PlayerSave aSave = PlayerServerData.PlayerSave.fromNBT(playerList.getCompoundTagAt(i));
|
||||||
PersistentServerData.playerSaveData.add(aSave);
|
PlayerServerData.playerSaveData.add(aSave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ public class WorldData extends WorldSavedData{
|
||||||
|
|
||||||
//Player Data
|
//Player Data
|
||||||
NBTTagList playerList = new NBTTagList();
|
NBTTagList playerList = new NBTTagList();
|
||||||
for(int i = 0; i < PersistentServerData.playerSaveData.size(); i++){
|
for(int i = 0; i < PlayerServerData.playerSaveData.size(); i++){
|
||||||
PersistentServerData.PlayerSave theSave = PersistentServerData.playerSaveData.get(i);
|
PlayerServerData.PlayerSave theSave = PlayerServerData.playerSaveData.get(i);
|
||||||
playerList.appendTag(theSave.toNBT());
|
playerList.appendTag(theSave.toNBT());
|
||||||
}
|
}
|
||||||
compound.setTag("PlayerData", playerList);
|
compound.setTag("PlayerData", playerList);
|
||||||
|
|
|
@ -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.RenderCompost;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud;
|
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.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.event.InitEvents;
|
import de.ellpeck.actuallyadditions.mod.event.InitEvents;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
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.FluidStateMapper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
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.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
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.");
|
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<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){
|
for(Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){
|
||||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||||
|
@ -217,7 +218,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName(){
|
public ITextComponent getDisplayName(){
|
||||||
return new TextComponentString(StringUtil.localize(this.getName()));
|
return new TextComponentTranslation(this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@ -38,9 +39,9 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
|
||||||
|
|
||||||
this.filterInventory = new IInventory(){
|
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;
|
this.tile = tile;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +154,7 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName(){
|
public ITextComponent getDisplayName(){
|
||||||
return new TextComponentString(StringUtil.localize(this.getName()));
|
return new TextComponentTranslation(this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class PersistentClientData{
|
public class ExtraClientData{
|
||||||
|
|
||||||
private static File theFile;
|
private static File theFile;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PersistentServerData{
|
public class PlayerServerData{
|
||||||
|
|
||||||
public static final ArrayList<PlayerSave> playerSaveData = new ArrayList<PlayerSave>();
|
public static final ArrayList<PlayerSave> playerSaveData = new ArrayList<PlayerSave>();
|
||||||
|
|
|
@ -547,6 +547,7 @@ info.actuallyadditions.noLens=No Lens
|
||||||
info.actuallyadditions.booklet.manualName.1=Actually Additions
|
info.actuallyadditions.booklet.manualName.1=Actually Additions
|
||||||
info.actuallyadditions.booklet.manualName.2=Manual
|
info.actuallyadditions.booklet.manualName.2=Manual
|
||||||
info.actuallyadditions.booklet.edition=Edition
|
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 Names
|
||||||
container.actuallyadditions.inputter.name=ESD
|
container.actuallyadditions.inputter.name=ESD
|
||||||
|
|
Loading…
Reference in a new issue