Code cleanup (null checks & BeamFrequency)

This commit is contained in:
Unknown 2020-05-01 04:32:32 +02:00
parent 5bcb64edcf
commit e8452e0dbf
6 changed files with 7 additions and 14 deletions

View file

@ -55,9 +55,8 @@ public class ItemBlockAbstractBase extends ItemBlock implements IItemBase {
@Nonnull
@Override
public String getTranslationKey(final ItemStack itemStack) {
public String getTranslationKey(@Nonnull final ItemStack itemStack) {
if ( hasUniqueName
|| itemStack == null
|| !(block instanceof BlockAbstractContainer)
|| !((BlockAbstractContainer) block).hasSubBlocks ) {
return getTranslationKey();

View file

@ -15,10 +15,7 @@ public class ItemBlockDecorative extends ItemBlockAbstractBase {
@Nonnull
@Override
public String getTranslationKey(final ItemStack itemStack) {
if (itemStack == null) {
return getTranslationKey();
}
public String getTranslationKey(@Nonnull final ItemStack itemStack) {
return getTranslationKey() + EnumDecorativeType.byMetadata(itemStack.getItemDamage()).getName();
}
}

View file

@ -30,10 +30,7 @@ public class ItemBlockForceFieldProjector extends ItemBlockAbstractBase {
@Nonnull
@Override
public String getTranslationKey(final ItemStack itemStack) {
if (itemStack == null) {
return getTranslationKey();
}
public String getTranslationKey(@Nonnull final ItemStack itemStack) {
return getTranslationKey() + (itemStack.getItemDamage() == 1 ? ".double" : ".single");
}
}

View file

@ -33,8 +33,8 @@ public class ItemBlockHull extends ItemBlockAbstractBase {
@Nonnull
@Override
public String getTranslationKey(final ItemStack itemStack) {
if (itemStack == null || block instanceof BlockHullStairs) {
public String getTranslationKey(@Nonnull final ItemStack itemStack) {
if (block instanceof BlockHullStairs) {
return getTranslationKey();
}
return getTranslationKey() + EnumDyeColor.byMetadata( itemStack.getItemDamage() ).getTranslationKey();

View file

@ -29,7 +29,7 @@ public class ItemBlockHullSlab extends ItemBlockHull {
@Nonnull
@Override
public String getTranslationKey(final ItemStack itemstack) {
public String getTranslationKey(@Nonnull final ItemStack itemstack) {
return getTranslationKey();
}

View file

@ -167,7 +167,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
}
// frequency status
isConnected = beamFrequency > 0 && beamFrequency <= IBeamFrequency.BEAM_FREQUENCY_MAX;
isConnected = IBeamFrequency.isValid(beamFrequency);
// always cool down
if (tickCooldown > 0) {