Skip to content

Commit

Permalink
Apply spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
glowredman committed Mar 16, 2024
1 parent 8ac3acf commit 97904b5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
22 changes: 14 additions & 8 deletions src/main/java/buildcraft/oiltweak/BuildCraftOilTweak.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
* @author Vexatos
*/
@Mod(
modid = Mods.BCOilTweak,
name = Mods.BCOilTweak_NAME,
canBeDeactivated = true,
dependencies = "after:BuildCraft|Core@[6.4.1,);after:Forge@[10.13.2.1236,);"
+ "after:BuildCraft|Energy@[6.4.1,);after:EnderIO@[1.7.10_2.2.7,);after:simplyjetpacks")
modid = Mods.BCOilTweak,
name = Mods.BCOilTweak_NAME,
version = Tags.VERSION,
canBeDeactivated = true,
dependencies = "after:BuildCraft|Core@[6.4.1,);after:Forge@[10.13.2.1236,);"
+ "after:BuildCraft|Energy@[6.4.1,);after:EnderIO@[1.7.10_2.2.7,);after:simplyjetpacks")
public class BuildCraftOilTweak extends OilTweakAPI {

@Instance(Mods.BCOilTweak)
Expand All @@ -48,19 +48,25 @@ public void preInit(FMLPreInitializationEvent event) {
@EventHandler
public void init(FMLInitializationEvent event) {
eventHandler = new OilTweakEventHandler();
FMLCommonHandler.instance().bus().register(eventHandler);
FMLCommonHandler.instance()
.bus()
.register(eventHandler);
MinecraftForge.EVENT_BUS.register(eventHandler);
if (Mods.isLoaded(Mods.SimplyJetpacks)) {
simplyJetpacks = new IntegrationSimplyJetpacks();
FMLCommonHandler.instance().bus().register(simplyJetpacks);
FMLCommonHandler.instance()
.bus()
.register(simplyJetpacks);
simplyJetpacks.init();
}
}

@EventHandler
public void deInit(FMLModDisabledEvent event) {
if (eventHandler != null) {
FMLCommonHandler.instance().bus().unregister(eventHandler);
FMLCommonHandler.instance()
.bus()
.unregister(eventHandler);
MinecraftForge.EVENT_BUS.unregister(eventHandler);
}
if (Mods.isLoaded(Mods.SimplyJetpacks) && simplyJetpacks != null) {
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/buildcraft/oiltweak/OilTweakEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected InOil getInOil(Entity entity) {
for (int z = minZ; z <= maxZ; ++z) {
if (isOil(entity.worldObj.getBlock(x, y, z))) {
return maxY == minY || isOil(entity.worldObj.getBlock(x, maxY, z)) ? InOil.FULL
: InOil.HALF;
: InOil.HALF;
}
}
}
Expand All @@ -73,8 +73,9 @@ private boolean isOil(Block block) {
}
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
return fluid != null && FluidRegistry.isFluidRegistered(fluid)
&& fluid.getName() != null
&& fluid.getName().equalsIgnoreCase("oil");
&& fluid.getName() != null
&& fluid.getName()
.equalsIgnoreCase("oil");
}

@SubscribeEvent(priority = EventPriority.LOWEST)
Expand Down Expand Up @@ -164,7 +165,7 @@ public void onTeleportAttempt(EnderTeleportEvent e) {
}
EntityLivingBase player = e.entityLiving;
if (!(player instanceof EntityPlayer && ((EntityPlayer) player).capabilities.isCreativeMode)
&& getInOil(player).halfOfFull()) {
&& getInOil(player).halfOfFull()) {
e.setCanceled(true);
e.setResult(Event.Result.DENY);
}
Expand All @@ -178,14 +179,12 @@ public void onRightClick(PlayerInteractEvent e) {
EntityPlayer player = e.entityPlayer;
if (!player.capabilities.isCreativeMode && player.getCurrentEquippedItem() != null) {
InOil inOil = getInOil(player);
if (inOil.halfOfFull()
&& ((inOil == InOil.FULL && !(player.getCurrentEquippedItem().getItem() instanceof ItemBlock))
|| OilTweakAPI.INSTANCE.getItemBlacklistRegistry()
.isBlacklisted(player, player.getCurrentEquippedItem()))) {
if (inOil.halfOfFull() && ((inOil == InOil.FULL && !(player.getCurrentEquippedItem()
.getItem() instanceof ItemBlock)) || OilTweakAPI.INSTANCE.getItemBlacklistRegistry()
.isBlacklisted(player, player.getCurrentEquippedItem()))) {
player.addChatComponentMessage(
new ChatComponentTranslation(
inOil == InOil.FULL ? "oiltweak.chat.tooDense.use"
: "oiltweak.chat.tooDense.use.half"));
new ChatComponentTranslation(
inOil == InOil.FULL ? "oiltweak.chat.tooDense.use" : "oiltweak.chat.tooDense.use.half"));
e.setCanceled(true);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/buildcraft/oiltweak/OilTweakProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
public class OilTweakProperties implements IExtendedEntityProperties {

private Entity entity;
public float realStepHeight;
public boolean inOil;

Expand All @@ -34,7 +33,6 @@ public void loadNBTData(NBTTagCompound data) {

@Override
public void init(Entity entity, World world) {
this.entity = entity;
this.inOil = false;
this.realStepHeight = entity.stepHeight;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/buildcraft/oiltweak/reference/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Mods {

// Other mods
public static final String BuildCraftCore = "BuildCraft|Core", BuildCraftEnergy = "BuildCraft|Energy",
SimplyJetpacks = "simplyjetpacks";
SimplyJetpacks = "simplyjetpacks";

public static boolean hasAPI(String name) {
return ModAPIManager.INSTANCE.hasAPI(name);
Expand Down

0 comments on commit 97904b5

Please sign in to comment.