Skip to content

Commit

Permalink
Catch everything during packet reading; clean up; bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
3TUSK committed Nov 17, 2017
1 parent 2297739 commit 9b00a05
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Mapping_Ver=snapshot_20171020

FCR_Ver_Major=2
FCR_Ver_Minor=0
FCR_Ver_Patch=3
FCR_Ver_Patch=4

IC2_Ver=2.8.27
JEI_Ver=4.8.0.109
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

package frogcraftrebirth.common.item;

import java.util.List;

import frogcraftrebirth.common.lib.item.ItemFrogCraft;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
Expand All @@ -34,8 +32,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;

public class ItemDecayBattery extends ItemFrogCraft implements ISpecialElectricItem {

Expand All @@ -61,7 +59,6 @@ public void addInformation(ItemStack stack, World worldIn, List<String> tooltips
}

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
if (this.isInCreativeTab(tab)) {
list.add(new ItemStack(this, 1, 0));
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/frogcraftrebirth/common/item/ItemMPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

package frogcraftrebirth.common.item;

import java.util.List;

import frogcraftrebirth.common.block.BlockMPS;
import frogcraftrebirth.common.lib.item.ItemFrogBlock;
import ic2.api.item.ElectricItem;
Expand All @@ -35,8 +33,8 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;

public class ItemMPS extends ItemFrogBlock implements IElectricItem {

Expand Down Expand Up @@ -68,8 +66,7 @@ public double getTransferLimit(ItemStack itemStack) {
normalize(itemStack);
return itemStack.getTagCompound().getInteger("tier") * 32;
}

@SideOnly(Side.CLIENT)

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
if (this.isInCreativeTab(tab)) {
Expand All @@ -80,8 +77,7 @@ public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
list.add(discharged);
}
}

@SideOnly(Side.CLIENT)

@Override
public void addInformation(ItemStack stack, World worldIn, List<String> aList, ITooltipFlag flag) {
aList.add(I18n.format("tile.mobilePowerStation.info"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@

package frogcraftrebirth.common.lib.item;

import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import frogcraftrebirth.api.FrogAPI;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.translation.I18n;

public abstract class ItemFrogCraft extends Item {
Expand All @@ -48,8 +46,7 @@ public ItemFrogCraft(boolean hasSubType){
public String getItemStackDisplayName(ItemStack stack) {
return I18n.translateToLocal(getUnlocalizedName(stack));
}

@SideOnly(Side.CLIENT)

@Override
public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list) {
if (this.isInCreativeTab(tabs)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void decodeDataClient(InputStream input, EntityPlayerSP player) {
break;
}
}
} catch (IOException e) {
} catch (Exception e) { // BTM Moon: catch everything, don't crash the client - only causes render abnormality
FrogAPI.FROG_LOG.error("Fail to unpack data, please report to author!", e);
}
}
Expand All @@ -101,10 +101,9 @@ private void decodeDataServer(InputStream input, EntityPlayerMP player) {
default:
break; // This suppresses unused warning
}
} catch (IOException e) {
} catch (Exception e) { // BTM Moon: catch everything, don't crash the server - only causes weird de-sync
FrogAPI.FROG_LOG.error("Fail to unpack data, please report to author!", e);
}

}

private static ByteBuf asByteBuf(IFrogPacket packet) {
Expand Down

0 comments on commit 9b00a05

Please sign in to comment.