Skip to content
Permalink
Browse files

More code cleanup. And lots of Intellij auto-formatting

  • Loading branch information...
alcatrazEscapee committed Mar 6, 2019
1 parent f69e4c0 commit 5efc6c0518ad99b9a5de467b3c4c7307185b508c
Showing with 860 additions and 897 deletions.
  1. +2 −2 src/main/java/net/dries007/tfc/CommonEventHandler.java
  2. +6 −6 src/main/java/net/dries007/tfc/api/capability/ISmallVesselHandler.java
  3. +14 −14 src/main/java/net/dries007/tfc/api/capability/forge/ForgeableHandler.java
  4. +1 −0 src/main/java/net/dries007/tfc/api/capability/forge/IForgeable.java
  5. +7 −7 src/main/java/net/dries007/tfc/api/capability/heat/IItemHeat.java
  6. +2 −1 src/main/java/net/dries007/tfc/api/capability/heat/ItemHeatHandler.java
  7. +1 −2 src/main/java/net/dries007/tfc/api/capability/size/CapabilityItemSize.java
  8. +1 −2 src/main/java/net/dries007/tfc/api/recipes/AnvilRecipe.java
  9. +3 −5 src/main/java/net/dries007/tfc/api/types/Plant.java
  10. +8 −8 src/main/java/net/dries007/tfc/client/gui/GuiAnvilPlan.java
  11. +54 −54 src/main/java/net/dries007/tfc/client/gui/GuiCustomizeWorld.java
  12. +25 −25 src/main/java/net/dries007/tfc/client/gui/GuiKnapping.java
  13. +12 −12 src/main/java/net/dries007/tfc/objects/blocks/BlockSlabTFC.java
  14. +25 −25 src/main/java/net/dries007/tfc/objects/blocks/BlockTorchTFC.java
  15. +13 −13 src/main/java/net/dries007/tfc/objects/blocks/BlockWorldItem.java
  16. +3 −11 src/main/java/net/dries007/tfc/objects/blocks/BlocksTFC.java
  17. +13 −14 src/main/java/net/dries007/tfc/objects/blocks/devices/BlockBellows.java
  18. +36 −31 src/main/java/net/dries007/tfc/objects/blocks/devices/BlockCrucible.java
  19. +17 −17 src/main/java/net/dries007/tfc/objects/blocks/devices/BlockFirePit.java
  20. +13 −13 src/main/java/net/dries007/tfc/objects/blocks/devices/BlockPitKiln.java
  21. +12 −12 src/main/java/net/dries007/tfc/objects/blocks/metal/BlockAnvilTFC.java
  22. +24 −24 src/main/java/net/dries007/tfc/objects/blocks/metal/BlockIngotPile.java
  23. +3 −10 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockCactusTFC.java
  24. +5 −8 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockCreepingPlantTFC.java
  25. +3 −8 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockDoublePlantTFC.java
  26. +3 −8 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockFloatingWaterTFC.java
  27. +7 −7 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockPlantTFC.java
  28. +3 −8 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockShortGrassTFC.java
  29. +3 −9 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockStackPlantTFC.java
  30. +2 −7 src/main/java/net/dries007/tfc/objects/blocks/plants/BlockTallGrassTFC.java
  31. +88 −88 src/main/java/net/dries007/tfc/objects/blocks/stone/BlockStoneAnvil.java
  32. +13 −13 src/main/java/net/dries007/tfc/objects/blocks/wood/BlockLogPile.java
  33. +17 −18 src/main/java/net/dries007/tfc/objects/blocks/wood/BlockLogTFC.java
  34. +13 −13 src/main/java/net/dries007/tfc/objects/blocks/wood/BlockSaplingTFC.java
  35. +20 −20 src/main/java/net/dries007/tfc/objects/blocks/wood/BlockToolRack.java
  36. +6 −6 src/main/java/net/dries007/tfc/objects/container/ContainerFirePit.java
  37. +16 −17 src/main/java/net/dries007/tfc/objects/container/ContainerKnapping.java
  38. +37 −37 src/main/java/net/dries007/tfc/objects/container/ContainerTE.java
  39. +1 −5 src/main/java/net/dries007/tfc/objects/fluids/FluidsTFC.java
  40. +24 −24 src/main/java/net/dries007/tfc/objects/items/ItemDebug.java
  41. +52 −52 src/main/java/net/dries007/tfc/objects/items/ceramics/ItemMold.java
  42. +52 −52 src/main/java/net/dries007/tfc/objects/items/ceramics/ItemSmallVessel.java
  43. +15 −12 src/main/java/net/dries007/tfc/objects/items/itemblock/ItemBlockFloatingWaterTFC.java
  44. +7 −7 src/main/java/net/dries007/tfc/objects/items/metal/ItemMetal.java
  45. +5 −5 src/main/java/net/dries007/tfc/objects/items/metal/ItemMetalTool.java
  46. +7 −7 src/main/java/net/dries007/tfc/objects/items/metal/ItemOreTFC.java
  47. +12 −12 src/main/java/net/dries007/tfc/objects/recipes/UnmoldRecipe.java
  48. +18 −17 src/main/java/net/dries007/tfc/objects/te/TEAnvilTFC.java
  49. +30 −30 src/main/java/net/dries007/tfc/objects/te/TECharcoalForge.java
  50. +16 −12 src/main/java/net/dries007/tfc/objects/te/TECrucible.java
  51. +45 −45 src/main/java/net/dries007/tfc/objects/te/TEFirePit.java
  52. +28 −28 src/main/java/net/dries007/tfc/objects/te/TEToolRack.java
  53. +5 −0 src/main/java/net/dries007/tfc/util/Alloy.java
  54. +2 −1 src/main/java/net/dries007/tfc/util/IFireable.java
  55. +2 −1 src/main/java/net/dries007/tfc/util/SimpleCraftMatrix.java
  56. +6 −6 src/main/java/net/dries007/tfc/world/classic/WorldGenSettings.java
  57. +2 −6 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenPlantTFC.java
@@ -68,8 +68,8 @@ public static void onBlockHarvestDrops(BlockEvent.HarvestDropsEvent event)
* Notes:
* 1) `onBlockActivate` doesn't get called when the player is sneaking, unless doesSneakBypassUse returns true.
* 2) This event handler is fired first with the main hand as event.getStack()
* If nothing happens (as per vanilla behavior, even if this event causes something to happen),
* The event will fire AGAIN with the offhand and offhand stack.
* If nothing happens (as per vanilla behavior, even if this event causes something to happen),
* The event will fire AGAIN with the offhand and offhand stack.
*/
@SubscribeEvent
public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event)
@@ -19,18 +19,18 @@
{

/**
* This sets the fluid mode. When fluid is empty, it defaults to item mode
* This gets the fluid mode, including liquid temperature status
*
* @param fluidMode true = fluids, false = items
* @return INVENTORY = items, LIQUID = fluids molten or solid based on temperature
*/
void setFluidMode(boolean fluidMode);
Mode getFluidMode();

/**
* This gets the fluid mode, including liquid temperature status
* This sets the fluid mode. When fluid is empty, it defaults to item mode
*
* @return INVENTORY = items, LIQUID = fluids molten or solid based on temperature
* @param fluidMode true = fluids, false = items
*/
Mode getFluidMode();
void setFluidMode(boolean fluidMode);

enum Mode
{
@@ -86,6 +86,20 @@ public void reset()
work = 0;
}

@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
{
return capability == CapabilityForgeable.FORGEABLE_CAPABILITY || super.hasCapability(capability, facing);
}

@SuppressWarnings("unchecked")
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
{
return hasCapability(capability, facing) ? (T) this : null;
}

@Override
@Nonnull
public NBTTagCompound serializeNBT()
@@ -113,18 +127,4 @@ public void deserializeNBT(@Nullable NBTTagCompound nbt)
}
super.deserializeNBT(nbt);
}

@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing)
{
return capability == CapabilityForgeable.FORGEABLE_CAPABILITY || super.hasCapability(capability, facing);
}

@SuppressWarnings("unchecked")
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
{
return hasCapability(capability, facing) ? (T) this : null;
}
}
@@ -72,6 +72,7 @@ default void setRecipe(@Nullable AnvilRecipe recipe)

/**
* Adds a step to the object, shuffling the last three steps down
*
* @param step The step to add. In general this should not be null, although it is perfectly valid for it to be
*/
void addStep(@Nullable ForgeStep step);
@@ -28,19 +28,19 @@
float getTemperature();

/**
* Gets the Heat capacity. (A measure of how fast this items heats up or cools down)
* Implementation is left up to the heating object. (See TEFirePit for example)
* Sets the temperature. Used for anything that modifies the temperature.
*
* @return the heat capacity. Typically 0 - 1, can be outside this range, must be non-negative
* @param temperature the temperature to set.
*/
float getHeatCapacity();
void setTemperature(float temperature);

/**
* Sets the temperature. Used for anything that modifies the temperature.
* Gets the Heat capacity. (A measure of how fast this items heats up or cools down)
* Implementation is left up to the heating object. (See TEFirePit for example)
*
* @param temperature the temperature to set.
* @return the heat capacity. Typically 0 - 1, can be outside this range, must be non-negative
*/
void setTemperature(float temperature);
float getHeatCapacity();

/**
* Gets the melting point of the item.
@@ -36,7 +36,7 @@
*
* @param nbt The NBT of the itemstack. (Provided in Item#initCapabilities())
* @param heatCapacity The heat capacity
* @param meltTemp The melting point
* @param meltTemp The melting point
*/
public ItemHeatHandler(@Nullable NBTTagCompound nbt, float heatCapacity, float meltTemp)
{
@@ -62,6 +62,7 @@ public float getTemperature()

/**
* Update the temperature, and save the timestamp of when it was updated
*
* @param temperature the temperature to set. Between 0 - 1600
*/
@Override
@@ -21,10 +21,9 @@

public final class CapabilityItemSize
{
private static final ResourceLocation ID = new ResourceLocation(TFCConstants.MOD_ID, "item_size");

@CapabilityInject(IItemSize.class)
public static final Capability<IItemSize> ITEM_SIZE_CAPABILITY = Helpers.getNull();
private static final ResourceLocation ID = new ResourceLocation(TFCConstants.MOD_ID, "item_size");

public static void preInit()
{
@@ -29,9 +29,8 @@
@ParametersAreNonnullByDefault
public class AnvilRecipe extends IForgeRegistryEntry.Impl<AnvilRecipe>
{
private static long SEED = 0;

private static final Random RNG = new Random();
private static long SEED = 0;

@Nonnull
public static List<AnvilRecipe> getAllFor(ItemStack stack)
@@ -1,8 +1,6 @@
/*
*
* * Work under Copyright. Licensed under the EUPL.
* * See the project README.md and LICENSE.txt for more information.
*
* Work under Copyright. Licensed under the EUPL.
* See the project README.md and LICENSE.txt for more information.
*/

package net.dries007.tfc.api.types;
@@ -105,7 +103,7 @@ public boolean isValidFloatingWaterDepth(World world, BlockPos pos, IBlockState
{
depthCounter++;
}
return (maxDepth > 0) ? depthCounter <= maxDepth + 1 : false;
return (maxDepth > 0) && depthCounter <= maxDepth + 1;
}

public int getMinWaterDepth()
@@ -83,14 +83,6 @@ protected void renderHoveredToolTip(int mouseX, int mouseY)
super.renderHoveredToolTip(mouseX, mouseY);
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1, 1, 1, 1);
mc.getTextureManager().bindTexture(background);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
@@ -100,6 +92,14 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1, 1, 1, 1);
mc.getTextureManager().bindTexture(background);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

@Override
protected void actionPerformed(GuiButton button) throws IOException
{
@@ -75,51 +75,17 @@ protected void keyTyped(char typedChar, int keyCode)
}

@Override
public void setEntryValue(int id, boolean value)
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
switch (id)
{
case ID_FLAT_BEDROCK:
settings.flatBedrock = value;
break;
}
update();
super.mouseClicked(mouseX, mouseY, mouseButton);
list.mouseClicked(mouseX, mouseY, mouseButton);
}

@Override
public void setEntryValue(int id, float value)
protected void mouseReleased(int mouseX, int mouseY, int state)
{
switch (id)
{
case ID_SPAWN_FUZZ:
settings.spawnFuzz = Math.round(value);
break;

case ID_RAVINE_RARITY:
settings.ravineRarity = Math.round(value);
break;
case ID_RAVINE_HEIGHT:
settings.ravineHeight = Math.round(value);
break;
case ID_RAVINE_VARIABILITY:
settings.ravineVariability = Math.round(value);
break;

case ID_SURFACE_RAVINE_RARITY:
settings.surfaceRavineRarity = Math.round(value);
break;
case ID_SURFACE_RAVINE_HEIGHT:
settings.surfaceRavineHeight = Math.round(value);
break;
case ID_SURFACE_RAVINE_VARIABILITY:
settings.surfaceRavineVariability = Math.round(value);
break;

case ID_RIVER_RAVINE_RARITY:
settings.riverRavineRarity = Math.round(value);
break;
}
update();
super.mouseReleased(mouseX, mouseY, state);
list.mouseReleased(mouseX, mouseY, state);
}

@Override
@@ -146,20 +112,6 @@ protected void actionPerformed(GuiButton button) throws IOException
update();
}

@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
list.mouseClicked(mouseX, mouseY, mouseButton);
}

@Override
protected void mouseReleased(int mouseX, int mouseY, int state)
{
super.mouseReleased(mouseX, mouseY, state);
list.mouseReleased(mouseX, mouseY, state);
}

@Override
public void initGui()
{
@@ -199,6 +151,54 @@ public void handleMouseInput() throws IOException
this.list.handleMouseInput();
}

@Override
public void setEntryValue(int id, boolean value)
{
switch (id)
{
case ID_FLAT_BEDROCK:
settings.flatBedrock = value;
break;
}
update();
}

@Override
public void setEntryValue(int id, float value)
{
switch (id)
{
case ID_SPAWN_FUZZ:
settings.spawnFuzz = Math.round(value);
break;

case ID_RAVINE_RARITY:
settings.ravineRarity = Math.round(value);
break;
case ID_RAVINE_HEIGHT:
settings.ravineHeight = Math.round(value);
break;
case ID_RAVINE_VARIABILITY:
settings.ravineVariability = Math.round(value);
break;

case ID_SURFACE_RAVINE_RARITY:
settings.surfaceRavineRarity = Math.round(value);
break;
case ID_SURFACE_RAVINE_HEIGHT:
settings.surfaceRavineHeight = Math.round(value);
break;
case ID_SURFACE_RAVINE_VARIABILITY:
settings.surfaceRavineVariability = Math.round(value);
break;

case ID_RIVER_RAVINE_RARITY:
settings.riverRavineRarity = Math.round(value);
break;
}
update();
}

@Override
public void setEntryValue(int id, String value)
{
@@ -46,6 +46,31 @@ public void initGui()
}
}

@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick)
{
if (clickedMouseButton == 0)
{
for (GuiButton button : this.buttonList)
{
if (button instanceof GuiButtonKnapping && button.mousePressed(mc, mouseX, mouseY))
{
GuiScreenEvent.ActionPerformedEvent.Pre event = new GuiScreenEvent.ActionPerformedEvent.Pre(this, button, buttonList);
if (MinecraftForge.EVENT_BUS.post(event))
break;
else if (selectedButton == event.getButton())
continue;

selectedButton = event.getButton();
event.getButton().mousePressed(mc, mouseX, mouseY);
actionPerformed(event.getButton());

MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.ActionPerformedEvent.Post(this, event.getButton(), buttonList));
}
}
}
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
@@ -73,29 +98,4 @@ protected void actionPerformed(GuiButton button)
button.playPressSound(mc.getSoundHandler());
}
}

@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick)
{
if (clickedMouseButton == 0)
{
for (GuiButton button : this.buttonList)
{
if (button instanceof GuiButtonKnapping && button.mousePressed(mc, mouseX, mouseY))
{
GuiScreenEvent.ActionPerformedEvent.Pre event = new GuiScreenEvent.ActionPerformedEvent.Pre(this, button, buttonList);
if (MinecraftForge.EVENT_BUS.post(event))
break;
else if (selectedButton == event.getButton())
continue;

selectedButton = event.getButton();
event.getButton().mousePressed(mc, mouseX, mouseY);
actionPerformed(event.getButton());

MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.ActionPerformedEvent.Post(this, event.getButton(), buttonList));
}
}
}
}
}

0 comments on commit 5efc6c0

Please sign in to comment.
You can’t perform that action at this time.