mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 23:12:58 +00:00
Fix some null warnings
This commit is contained in:
1 parent
c6783e573c
commit
3178aa890d
22 files changed
+114
-95
No files matched your search
@@ -6,8 +6,9 @@ import net.minecraft.potion.PotionEffect;
|
||||
|
||||
public class AlcoholEffect {
|
||||
public static void makeDrunk(final EntityPlayer player, final float strength) {
|
||||
final int existingStrength = player.isPotionActive(MobEffects.NAUSEA) ? player.getActivePotionEffect(MobEffects.NAUSEA).getAmplifier() : 0;
|
||||
final int existingTime = player.isPotionActive(MobEffects.NAUSEA) ? player.getActivePotionEffect(MobEffects.NAUSEA).getDuration() : 0;
|
||||
PotionEffect potionEffect = player.getActivePotionEffect(MobEffects.NAUSEA);
|
||||
final int existingStrength = potionEffect != null ? potionEffect.getAmplifier() : 0;
|
||||
final int existingTime = potionEffect != null ? potionEffect.getDuration() : 0;
|
||||
int time = (int) (100.0 * Math.sqrt(strength)) + existingTime;
|
||||
final float intensity = 0.1f * strength + existingStrength + existingTime / 500;
|
||||
if (time < 5) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package binnie.extratrees.carpentry;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.util.TileUtil;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
@@ -45,10 +46,12 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
|
||||
return;
|
||||
}
|
||||
final DesignBlock block = blockC.getCarpentryBlock(world, pos);
|
||||
final TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(pos);
|
||||
//block.rotate(event.getFace(), item, player, world, pos);
|
||||
final int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
final TileEntityMetadata tile = TileUtil.getTile(world, pos, TileEntityMetadata.class);
|
||||
if (tile != null) {
|
||||
//block.rotate(event.getFace(), item, player, world, pos);
|
||||
final int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockDesign(final IDesignSystem system, final Material material) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -71,16 +72,13 @@ public class Brewery {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static FluidStack getOutput(final BreweryCrafting crafting) {
|
||||
if (crafting.currentInput == null) {
|
||||
return null;
|
||||
}
|
||||
if (crafting.yeast == null) {
|
||||
return null;
|
||||
}
|
||||
for (final IBreweryRecipe recipe : Brewery.recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
if (crafting.currentInput != null && crafting.yeast != null) {
|
||||
for (final IBreweryRecipe recipe : Brewery.recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -275,9 +273,12 @@ public class Brewery {
|
||||
|
||||
@Override
|
||||
protected void onFinishTask() {
|
||||
final FluidStack output = Brewery.getOutput(this.currentCrafting).copy();
|
||||
output.amount = 1000;
|
||||
this.getUtil().fillTank(Brewery.tankOutput, output);
|
||||
FluidStack output = Brewery.getOutput(this.currentCrafting);
|
||||
if (output != null) {
|
||||
output = output.copy();
|
||||
output.amount = 1000;
|
||||
this.getUtil().fillTank(Brewery.tankOutput, output);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,7 +318,11 @@ public class Brewery {
|
||||
if (this.currentCrafting == null) {
|
||||
return "Empty";
|
||||
}
|
||||
return "Creating " + Brewery.getOutput(this.currentCrafting).getFluid().getLocalizedName(Brewery.getOutput(this.currentCrafting));
|
||||
FluidStack output = Brewery.getOutput(this.currentCrafting);
|
||||
if (output == null) {
|
||||
return "Empty";
|
||||
}
|
||||
return "Creating " + output.getFluid().getLocalizedName(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user