mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
Some More Updating, Crash Prevention
This commit is contained in:
parent
fcd27e9d6b
commit
93cfe0cd5f
6 changed files with 23 additions and 41 deletions
|
@ -92,10 +92,8 @@ public class ActuallyAdditions{
|
|||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event){
|
||||
|
||||
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
|
||||
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
|
||||
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ConfigurationHandler{
|
|||
ConfigValues.defineConfigValues(config);
|
||||
}
|
||||
catch(Exception e){
|
||||
e.printStackTrace();
|
||||
ModUtil.LOGGER.error("Loading the Config File failed!", e);
|
||||
}
|
||||
finally{
|
||||
if(config.hasChanged()){
|
||||
|
|
|
@ -15,7 +15,6 @@ public class InitEvents{
|
|||
Util.registerEvent(new TooltipEvent());
|
||||
Util.registerEvent(new EntityLivingEvent());
|
||||
Util.registerEvent(new WorldDecorationEvent());
|
||||
//Util.registerEvent(new LivingKillEvent());
|
||||
Util.registerEvent(new BucketFillEvent());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package ellpeck.actuallyadditions.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
|
||||
public class LivingKillEvent{
|
||||
|
||||
private static final int SQUID_MESSAGES = 3;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDeathEvent(LivingDeathEvent event){
|
||||
/*if(event.source.getEntity() instanceof EntityPlayer){
|
||||
if(event.entity instanceof EntitySquid){
|
||||
String message = StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".squidKilled.desc."+(new Random().nextInt(SQUID_MESSAGES)+1));
|
||||
((EntityPlayer)event.source.getEntity()).addChatComponentMessage(new ChatComponentText(message));
|
||||
event.source.getEntity().worldObj.playSoundAtEntity(event.source.getEntity(), "mob.wither.death", 0.3F, 0.001F);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -139,7 +139,8 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
|
||||
ItemStack theStack = null;
|
||||
for(int i = theSlotToPull; i < this.slotToPullEnd; i++){
|
||||
if(i < 0 || i >= theInventory.getSizeInventory()) return;
|
||||
if(i < 0) continue;
|
||||
if(i >= theInventory.getSizeInventory()) return;
|
||||
|
||||
ItemStack tempStack = theInventory.getStackInSlot(i);
|
||||
if(tempStack != null){
|
||||
|
@ -201,7 +202,8 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
if(this.slots[0] != null){
|
||||
ItemStack theStack = null;
|
||||
for(int i = theSlotToPut; i < this.slotToPutEnd; i++){
|
||||
if(i < 0 || i >= theInventory.getSizeInventory()) return;
|
||||
if(i < 0) continue;
|
||||
if(i >= theInventory.getSizeInventory()) return;
|
||||
|
||||
ItemStack tempStack = theInventory.getStackInSlot(i);
|
||||
if(tempStack != null){
|
||||
|
|
|
@ -28,7 +28,7 @@ public class UpdateChecker{
|
|||
new UpdateCheckThread();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(receiveCanceled = true)
|
||||
public void onTick(TickEvent.ClientTickEvent event){
|
||||
if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
@ -36,20 +36,24 @@ public class UpdateChecker{
|
|||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".update.failed.desc")));
|
||||
}
|
||||
else if(onlineVersion.length() > 0){
|
||||
int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", ""));
|
||||
int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
|
||||
try{
|
||||
int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", ""));
|
||||
int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
|
||||
|
||||
if(update > client){
|
||||
String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc";
|
||||
String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc";
|
||||
String notice3 = "info." + ModUtil.MOD_ID_LOWER + ".update.changelog.desc";
|
||||
String notice4 = "info." + ModUtil.MOD_ID_LOWER + ".update.download.desc";
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal(notice1)));
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, onlineVersion)));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(notice3, changelog)));
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice4, "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files")));
|
||||
if(update > client){
|
||||
String notice1 = "info."+ModUtil.MOD_ID_LOWER+".update.generic.desc";
|
||||
String notice2 = "info."+ModUtil.MOD_ID_LOWER+".update.versionComp.desc";
|
||||
String notice3 = "info."+ModUtil.MOD_ID_LOWER+".update.changelog.desc";
|
||||
String notice4 = "info."+ModUtil.MOD_ID_LOWER+".update.download.desc";
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal(notice1)));
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, onlineVersion)));
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(notice3, changelog)));
|
||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice4, "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files")));
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Sending the Update Check Information to the Chat failed!", e);
|
||||
}
|
||||
|
||||
}
|
||||
notified = true;
|
||||
}
|
||||
|
@ -80,9 +84,8 @@ public class UpdateChecker{
|
|||
ModUtil.LOGGER.info("Update Check done!");
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Update Check failed!");
|
||||
checkFailed = true;
|
||||
e.printStackTrace();
|
||||
ModUtil.LOGGER.error("Update Check failed!", e);
|
||||
}
|
||||
doneChecking = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue