mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +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
|
@EventHandler
|
||||||
public void serverStarting(FMLServerStartingEvent event){
|
public void serverStarting(FMLServerStartingEvent event){
|
||||||
|
|
||||||
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
|
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
|
||||||
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
|
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
|
||||||
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
|
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class ConfigurationHandler{
|
||||||
ConfigValues.defineConfigValues(config);
|
ConfigValues.defineConfigValues(config);
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
e.printStackTrace();
|
ModUtil.LOGGER.error("Loading the Config File failed!", e);
|
||||||
}
|
}
|
||||||
finally{
|
finally{
|
||||||
if(config.hasChanged()){
|
if(config.hasChanged()){
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class InitEvents{
|
||||||
Util.registerEvent(new TooltipEvent());
|
Util.registerEvent(new TooltipEvent());
|
||||||
Util.registerEvent(new EntityLivingEvent());
|
Util.registerEvent(new EntityLivingEvent());
|
||||||
Util.registerEvent(new WorldDecorationEvent());
|
Util.registerEvent(new WorldDecorationEvent());
|
||||||
//Util.registerEvent(new LivingKillEvent());
|
|
||||||
Util.registerEvent(new BucketFillEvent());
|
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;
|
ItemStack theStack = null;
|
||||||
for(int i = theSlotToPull; i < this.slotToPullEnd; i++){
|
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);
|
ItemStack tempStack = theInventory.getStackInSlot(i);
|
||||||
if(tempStack != null){
|
if(tempStack != null){
|
||||||
|
@ -201,7 +202,8 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
if(this.slots[0] != null){
|
if(this.slots[0] != null){
|
||||||
ItemStack theStack = null;
|
ItemStack theStack = null;
|
||||||
for(int i = theSlotToPut; i < this.slotToPutEnd; i++){
|
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);
|
ItemStack tempStack = theInventory.getStackInSlot(i);
|
||||||
if(tempStack != null){
|
if(tempStack != null){
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class UpdateChecker{
|
||||||
new UpdateCheckThread();
|
new UpdateCheckThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent(receiveCanceled = true)
|
||||||
public void onTick(TickEvent.ClientTickEvent event){
|
public void onTick(TickEvent.ClientTickEvent event){
|
||||||
if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){
|
if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
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")));
|
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".update.failed.desc")));
|
||||||
}
|
}
|
||||||
else if(onlineVersion.length() > 0){
|
else if(onlineVersion.length() > 0){
|
||||||
int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", ""));
|
try{
|
||||||
int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
|
int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", ""));
|
||||||
|
int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
|
||||||
|
|
||||||
if(update > client){
|
if(update > client){
|
||||||
String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc";
|
String notice1 = "info."+ModUtil.MOD_ID_LOWER+".update.generic.desc";
|
||||||
String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc";
|
String notice2 = "info."+ModUtil.MOD_ID_LOWER+".update.versionComp.desc";
|
||||||
String notice3 = "info." + ModUtil.MOD_ID_LOWER + ".update.changelog.desc";
|
String notice3 = "info."+ModUtil.MOD_ID_LOWER+".update.changelog.desc";
|
||||||
String notice4 = "info." + ModUtil.MOD_ID_LOWER + ".update.download.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.translateToLocal(notice1)));
|
||||||
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, onlineVersion)));
|
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, onlineVersion)));
|
||||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(notice3, changelog)));
|
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")));
|
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;
|
notified = true;
|
||||||
}
|
}
|
||||||
|
@ -80,9 +84,8 @@ public class UpdateChecker{
|
||||||
ModUtil.LOGGER.info("Update Check done!");
|
ModUtil.LOGGER.info("Update Check done!");
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
ModUtil.LOGGER.error("Update Check failed!");
|
|
||||||
checkFailed = true;
|
checkFailed = true;
|
||||||
e.printStackTrace();
|
ModUtil.LOGGER.error("Update Check failed!", e);
|
||||||
}
|
}
|
||||||
doneChecking = true;
|
doneChecking = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue