Skip to content

Commit

Permalink
IntelliJ code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Roadhog360 committed Oct 30, 2024
1 parent b862f43 commit 5cdf0c3
Show file tree
Hide file tree
Showing 100 changed files with 549 additions and 611 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public static void addOre(Block from, int fromMeta, Block to, int toMeta, boolea
* CraftTweaker OreDictionary additions/removals may not work. For best results, please restart the game before reporting issues.
*
* @param oreDict The oreDict tag to overwrite
* @param to The block deepslate changes it to
* @param toMeta The metadata deepslate changes it to
* @param to The block deepslate changes it to
* @param toMeta The metadata deepslate changes it to
*/
public static void addOreByOreDict(String oreDict, Block to, int toMeta) {
boolean hasBadEntry = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MultiBlockSoundRegistry {
public static final Map<Block, MultiBlockSoundContainer> multiBlockSounds = new HashMap<>();

public static void addBasic(Block block, Block.SoundType type, int... metas) {
if(ModRecipes.validateItems(block)) {
if (ModRecipes.validateItems(block)) {
MultiBlockSoundContainer mbs = multiBlockSounds.getOrDefault(block, new BasicMultiBlockSound());
if (mbs instanceof BasicMultiBlockSound) {
((BasicMultiBlockSound) mbs).setTypes(Utils.getSound(type), metas);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package ganymedes01.etfuturum.api.event;

import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.world.World;

import java.util.Random;

import cpw.mods.fml.common.eventhandler.Event;

public class PostTreeGenerateEvent extends Event {
public final World world;
public final Random rand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
public class BasicMultiBlockSound extends MultiBlockSoundContainer {

private final Map<Integer, Block.SoundType> types = Maps.newHashMap();

public BasicMultiBlockSound setTypes(Block.SoundType type, int... metas) {
for(int meta : metas) {
for (int meta : metas) {
types.put(meta, type);
}
return this;
Expand All @@ -21,7 +21,7 @@ public BasicMultiBlockSound setTypes(Block.SoundType type, int... metas) {
@Override
public String getSound(World world, int x, int y, int z, String oldSoundIn, MultiBlockSoundRegistry.BlockSoundType type) {
Block.SoundType soundType = types.get(world.getBlockMetadata(x, y, z));

if (soundType == null) return null;

return switch (type) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ganymedes01/etfuturum/blocks/BaseSlab.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ public float getBlockHardness(World worldIn, int x, int y, int z) {
}

public BaseSlab setHardnessValues(float hardness, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setHardness(hardness);
} else for(int meta : metas) {
} else for (int meta : metas) {
hardnesses.put(meta + 8, hardness);
hardnesses.put(meta, hardness);
}
Expand All @@ -192,16 +192,16 @@ public BaseSlab setHardnessValues(float hardness, int... metas) {
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
Float resistance = resistances.get(world.getBlockMetadata(x, y, z));
if(resistance != null) {
if (resistance != null) {
return resistance / 5.0F;
}
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
}

public BaseSlab setResistanceValues(float resistance, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setResistance(resistance);
} else for(int meta : metas) {
} else for (int meta : metas) {
resistances.put(meta + 8, resistance);
resistances.put(meta, resistance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public float getBlockHardness(World worldIn, int x, int y, int z) {
}

public BaseSubtypesBlock setHardnessValues(float hardness, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setHardness(hardness);
} else for(int meta : metas) {
} else for (int meta : metas) {
hardnesses.put(meta, hardness);
}
return this;
Expand All @@ -103,16 +103,16 @@ public BaseSubtypesBlock setHardnessValues(float hardness, int... metas) {
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
Float resistance = resistances.get(world.getBlockMetadata(x, y, z));
if(resistance != null) {
if (resistance != null) {
return resistance / 5.0F;
}
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
}

public BaseSubtypesBlock setResistanceValues(float resistance, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setResistance(resistance);
} else for(int meta : metas) {
} else for (int meta : metas) {
resistances.put(meta, resistance);
}
return this;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ganymedes01/etfuturum/blocks/BaseWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ public float getBlockHardness(World worldIn, int x, int y, int z) {
}

public BaseWall setHardnesses(float hardness, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setHardness(hardness);
} else for(int meta : metas) {
} else for (int meta : metas) {
hardnesses.put(meta, hardness);
}
return this;
Expand All @@ -162,16 +162,16 @@ public BaseWall setHardnesses(float hardness, int... metas) {
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
Float resistance = resistances.get(world.getBlockMetadata(x, y, z));
if(resistance != null) {
if (resistance != null) {
return resistance / 5.0F;
}
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
}

public BaseWall setResistances(float resistance, int... metas) {
if(metas.length == 0) {
if (metas.length == 0) {
setResistance(resistance);
} else for(int meta : metas) {
} else for (int meta : metas) {
resistances.put(meta, resistance);
}
return this;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockBamboo.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static int setStalkSize(int meta, boolean large) {
return meta | (large ? 0x1 : 0);
}

private static Vec3 OFFSET_VEC = Vec3.createVectorHelper(0.5D, 0D, 0.5D);
private static final Vec3 OFFSET_VEC = Vec3.createVectorHelper(0.5D, 0D, 0.5D);

public static Vec3 getOffset(int x, int z) {
OFFSET_VEC.xCoord = 0.1875D + ((double) (Math.abs(Utils.cantor(x * 2654435761L, z * -2654435761L)) % 41) * 0.015625D);
Expand Down Expand Up @@ -234,8 +234,6 @@ public boolean isOpaqueCube() {
return false;
}

;

@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
return true;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockBeeHive.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ public void randomDisplayTick(World world, int x, int y, int z, Random random) {
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
if (!world.isRemote) {
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof TileEntityBeeHive) {
TileEntityBeeHive beehivetileentity = (TileEntityBeeHive) tileentity;
if (tileentity instanceof TileEntityBeeHive beehivetileentity) {
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
int fortune = EnchantmentHelper.getFortuneModifier(player);
boolean empty = beehivetileentity.hasNoBees() && beehivetileentity.getHoneyLevel() == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public BlockBlackstoneWall() {

@Override
public IIcon getIcon(int side, int meta) {
if(meta == 0) {
if (meta == 0) {
ModBlocks.BLACKSTONE.get().getIcon(side, 0);
}
return super.getIcon(side, meta);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public void registerBlockIcons(IIconRegister reg) {
outer_icons = new IIcon[outerIconCount()];
top_icons = new IIcon[topIconCount()];
int i = 0;
for(char a = 'a'; i < largest && a < 'z'; a++, i++) {
if(i < innerIconCount()) {
for (char a = 'a'; i < largest && a < 'z'; a++, i++) {
if (i < innerIconCount()) {
inner_icons[i] = reg.registerIcon(getTextureName() + "_inner_" + (char) (a + (isUp ? innerIconCount() : 0)));
}
if(i < outerIconCount()) {
if (i < outerIconCount()) {
outer_icons[i] = reg.registerIcon(getTextureName() + "_outer_" + (char) (a + (isUp ? outerIconCount() : 0)));
}
if(i < topIconCount()) {
if (i < topIconCount()) {
top_icons[i] = reg.registerIcon(getTextureName() + "_" + (isUp ? "up" : "down") + "_top_" + a);
}
}
Expand All @@ -84,7 +84,7 @@ public IIcon getIcon(int side, int meta) {
@Override
public IIcon getIcon(IBlockAccess worldIn, int x, int y, int z, int side) {
int pseudoRand = (int) Utils.cantor(x, z);
if(side < 2) {
if (side < 2) {
return top_icons[pseudoRand % top_icons.length];
} else {
return renderingInner.get() ? inner_icons[pseudoRand % inner_icons.length] : outer_icons[pseudoRand % outer_icons.length];
Expand All @@ -94,7 +94,7 @@ public IIcon getIcon(IBlockAccess worldIn, int x, int y, int z, int side) {
@Override
public void randomDisplayTick(World worldIn, int x, int y, int z, Random random) {
super.randomDisplayTick(worldIn, x, y, z, random);
if(random.nextInt(256) == 0) {
if (random.nextInt(256) == 0) {
worldIn.playSound(x + random.nextFloat(), y + random.nextFloat(), z + random.nextFloat(),
getBubblingNoise(worldIn, x, y, z, random), 1, 1, false);
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neig

protected void manageColumn(World world, int x, int y, int z) {
Block below = world.getBlock(x, y - 1, z);
if(below != this && !supportBlocks.contains(below)) {
if (below != this && !supportBlocks.contains(below)) {
world.setBlock(x, y, z, Blocks.water);
} else if (isFullVanillaWater(world.getBlock(x, y + 1, z), world.getBlockMetadata(x, y + 1, z))) {
world.setBlock(x, y + 1, z, this, 0, 3);
Expand Down Expand Up @@ -154,7 +154,7 @@ public boolean isOpaqueCube() {

@Override
public void postInitAction() {
if(ModRecipes.validateItems(this)) {
if (ModRecipes.validateItems(this)) {
supportBlocks.stream().filter(ModRecipes::validateItems).forEach(block -> EtFuturumWorldListener.bubbleColumnMap.put(block, this));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockCopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public BlockCopper() {

public BlockCopper(String... types) {
super(Material.iron, types);
if(types.length % 4 != 0) {
if (types.length % 4 != 0) {
throw new IllegalArgumentException("Copper variants count must be a multiple of 4.");
}
if(types.length < 8) {
if (types.length < 8) {
throw new IllegalArgumentException("Copper must have at least 8 variants! (4 waxable and 4 regular)");
}
setHardness(3);
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockCopperBulb.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class BlockCopperBulb extends BlockCopper {
protected final boolean powered;

public BlockCopperBulb(boolean powered) {
super(powered ? new String[] {
super(powered ? new String[]{
"copper_bulb_powered", "exposed_copper_bulb_powered", "weathered_copper_bulb_powered", "oxidized_copper_bulb_powered",
"copper_bulb_lit_powered", "exposed_copper_bulb_lit_powered", "weathered_copper_bulb_lit_powered", "oxidized_copper_bulb_lit_powered",
"waxed_copper_bulb_powered", "waxed_exposed_copper_bulb_powered", "waxed_weathered_copper_bulb_powered", "waxed_oxidized_copper_bulb_powered",
"waxed_copper_bulb_lit_powered", "waxed_exposed_copper_bulb_lit_powered", "waxed_weathered_copper_bulb_lit_powered", "waxed_oxidized_copper_bulb_lit"
} : new String[] {
} : new String[]{
"copper_bulb", "exposed_copper_bulb", "weathered_copper_bulb", "oxidized_copper_bulb",
"copper_bulb_lit", "exposed_copper_bulb_lit", "weathered_copper_bulb_lit", "oxidized_copper_bulb_lit",
"waxed_copper_bulb", "waxed_exposed_copper_bulb", "waxed_weathered_copper_bulb", "waxed_oxidized_copper_bulb",
Expand Down Expand Up @@ -76,10 +76,8 @@ public boolean hasComparatorInputOverride() {
}

@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor)
{
if (!world.isRemote)
{
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
if (!world.isRemote) {
boolean poweredByRedstone = world.isBlockIndirectlyGettingPowered(x, y, z);
if ((!powered && poweredByRedstone) || (powered && !poweredByRedstone)) {
switchBulbState(world, x, y, z);
Expand All @@ -98,12 +96,11 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block neighb
// switchBulbState(world, x, y, z);
// }
// }

private void switchBulbState(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
boolean lit = isLit(world, x, y, z, meta);
if(!powered) {
world.playSoundEffect(x, y, z,Reference.MCAssetVer + ":block.copper_bulb.turn_" + (lit ? "off" : "on"), 1, 1);
if (!powered) {
world.playSoundEffect(x, y, z, Reference.MCAssetVer + ":block.copper_bulb.turn_" + (lit ? "off" : "on"), 1, 1);
if (lit) {
meta -= 4;
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockCopperDoor.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public void updateTick(World world, int x, int y, int z, Random rand) {
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ)
{
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) {
int meta = world.getBlockMetadata(x, y, z);
if(!tryWaxOnWaxOff(world, x, y + (meta < 8 ? 1 : 0), z, player)) {
if (!tryWaxOnWaxOff(world, x, y + (meta < 8 ? 1 : 0), z, player)) {
int i1 = this.func_150012_g(world, x, y, z); // getFullMetadata
int j1 = i1 & 7;
j1 ^= 4;
Expand Down Expand Up @@ -85,13 +84,14 @@ public int getFinalCopperMeta(IBlockAccess world, int x, int y, int z, int meta,

public void setCopperBlock(Block newBlock, int newMeta, World world, int x, int y, int z) {
IDegradable.super.setCopperBlock(newBlock, newMeta, world, x, y, z);
if(newBlock != world.getBlock(x, y - 1, z)) {
if (newBlock != world.getBlock(x, y - 1, z)) {
world.setBlock(x, y - 1, z, newBlock, world.getBlockMetadata(x, y - 1, z), 2);
}
}

/**
* Only evaluate the top half of the door for copper oxidation speed calc
*
* @param meta
* @param world
* @param x
Expand All @@ -104,11 +104,11 @@ public boolean countTowardsDegredation(int meta, IBlockAccess world, int x, int
return IDegradable.super.countTowardsDegredation(meta, world, x, y, z) && world.getBlockMetadata(x, y, z) > 7;
}

private ThreadLocal<Boolean> playSound = ThreadLocal.withInitial(() -> true);
private final ThreadLocal<Boolean> playSound = ThreadLocal.withInitial(() -> true);

@Override
public void playSound(World world, double x, double y, double z, int type) {
if(playSound.get()) {
if (playSound.get()) {
IDegradable.super.playSound(world, x, y + 0.5D, z, type);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public BlockCopperTrapdoor(int meta) {
}

@Override
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ)
{
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) {
if (!tryWaxOnWaxOff(worldIn, x, y, z, player)) {
int i1 = worldIn.getBlockMetadata(x, y, z);
worldIn.setBlockMetadataWithNotify(x, y, z, i1 ^ 4, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MapColor getMapColor(int _meta) {
}

@Override
public IIcon getIcon(int side, int meta) {
public IIcon getIcon(int side, int meta) {
switch (side) {
case 0:
return blockIconFlipped;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockLight.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ public boolean isNormalCube() {
}

@Override
public boolean getBlocksMovement(IBlockAccess worldIn, int x, int y, int z)
{
public boolean getBlocksMovement(IBlockAccess worldIn, int x, int y, int z) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public IIcon getIcon(int side, int meta) {
}

@Override
public void registerBlockIcons(IIconRegister ignored) {}
public void registerBlockIcons(IIconRegister ignored) {
}

@Override
public int getDamageValue(World worldIn, int x, int y, int z) {
Expand Down
Loading

0 comments on commit 5cdf0c3

Please sign in to comment.