mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 15:03:14 +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
@@ -68,8 +68,9 @@ public class AlvearyFrame {
|
||||
}
|
||||
|
||||
public IHiveFrame getHiveFrame() {
|
||||
if (this.getInventory().getStackInSlot(AlvearyFrame.slotFrame) != null) {
|
||||
return (IHiveFrame) this.getInventory().getStackInSlot(AlvearyFrame.slotFrame).getItem();
|
||||
ItemStack stackInSlot = this.getInventory().getStackInSlot(AlvearyFrame.slotFrame);
|
||||
if (stackInSlot != null) {
|
||||
return (IHiveFrame) stackInSlot.getItem();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,12 @@ public class BeeModelProvider implements IBeeModelProvider {
|
||||
public void registerModels(Item item, IModelManager manager) {
|
||||
String beeIconDir = "bees/default/";
|
||||
EnumBeeType beeType = BeeManager.beeRoot.getType(new ItemStack(item));
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
if (beeType != null) {
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
|
||||
models[beeType.ordinal()] = getModelLocation("forestry", beeTypeNameBase);
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
models[beeType.ordinal()] = getModelLocation("forestry", beeTypeNameBase);
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,9 +112,6 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
|
||||
|
||||
public boolean isAcceptedFlower(final World world, final IIndividual individual, final BlockPos pos) {
|
||||
final Block block = world.getBlockState(pos).getBlock();
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
switch (this) {
|
||||
case WATER: {
|
||||
return block == Blocks.WATERLILY;
|
||||
@@ -220,13 +217,11 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
|
||||
final int z2 = pos.getZ() - tZ + world.rand.nextInt(1 + 2 * tZ);
|
||||
final BlockPos pos2 = new BlockPos(x2, y2, z2);
|
||||
final Block block = world.getBlockState(pos2).getBlock();
|
||||
if (block != null) {
|
||||
if (block == Mods.Botania.block("flower")) {
|
||||
final int meta = world.getBlockState(pos2).getBlock().getMetaFromState(world.getBlockState(pos2));
|
||||
final Item item = Mods.Botania.item("petal");
|
||||
if (item != null) {
|
||||
prods.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
if (block == Mods.Botania.block("flower")) {
|
||||
final int meta = world.getBlockState(pos2).getBlock().getMetaFromState(world.getBlockState(pos2));
|
||||
final Item item = Mods.Botania.item("petal");
|
||||
if (item != null) {
|
||||
prods.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,23 +135,19 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect {
|
||||
final double var3 = pos.getZ() + world.rand.nextFloat();
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, var1, var2, var3, 0.0, 0.0, 0.0);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, var1, var2, var3, 0.0, 0.0, 0.0);
|
||||
final EntityLiving var4 = (EntityLiving) EntityList.createEntityByName(name, world);
|
||||
if (var4 == null) {
|
||||
return;
|
||||
}
|
||||
final int var5 = world.getEntitiesWithinAABB(var4.getClass(), new AxisAlignedBB(pos, pos.add(1, 1, 1)).expand(8.0, 4.0, 8.0)).size();
|
||||
if (var5 >= 6) {
|
||||
return;
|
||||
}
|
||||
if (var4 != null) {
|
||||
final double var6 = pos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0;
|
||||
final double var7 = pos.getY() + world.rand.nextInt(3) - 1;
|
||||
final double var8 = pos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0;
|
||||
var4.setLocationAndAngles(var6, var7, var8, world.rand.nextFloat() * 360.0f, 0.0f);
|
||||
if (var4.getCanSpawnHere()) {
|
||||
world.spawnEntityInWorld(var4);
|
||||
world.playEvent(2004, pos, 0);//playSFX
|
||||
var4.spawnExplosionParticle();
|
||||
final EntityLiving entity = (EntityLiving) EntityList.createEntityByName(name, world);
|
||||
if (entity != null) {
|
||||
final int nearbyEntityCount = world.getEntitiesWithinAABB(entity.getClass(), new AxisAlignedBB(pos, pos.add(1, 1, 1)).expand(8.0, 4.0, 8.0)).size();
|
||||
if (nearbyEntityCount < 6) {
|
||||
final double var6 = pos.getX() + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0;
|
||||
final double var7 = pos.getY() + world.rand.nextInt(3) - 1;
|
||||
final double var8 = pos.getZ() + (world.rand.nextDouble() - world.rand.nextDouble()) * 4.0;
|
||||
entity.setLocationAndAngles(var6, var7, var8, world.rand.nextFloat() * 360.0f, 0.0f);
|
||||
if (entity.getCanSpawnHere()) {
|
||||
world.spawnEntityInWorld(entity);
|
||||
world.playEvent(2004, pos, 0);//playSFX
|
||||
entity.spawnExplosionParticle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,10 @@ public class ControlBiomes extends Control implements ITooltip {
|
||||
final int y = (int) (this.getRelativeMousePosition().y() / 16.0f);
|
||||
final int i = x + y * 8;
|
||||
if (i < this.tolerated.size()) {
|
||||
list.add(Biome.getBiome(this.tolerated.get(i)).getBiomeName());
|
||||
Biome biome = Biome.getBiome(this.tolerated.get(i));
|
||||
if (biome != null) {
|
||||
list.add(biome.getBiomeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user