mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-25 22:34:29 +00:00
run through formatter
This commit is contained in:
1 parent
e2c89a1857
commit
73cc5133d1
28 files changed
+89
-58
No files matched your search
@@ -45,6 +45,7 @@ public class Mantle
|
||||
@SidedProxy(clientSide = "mantle.client.MProxyClient", serverSide = "mantle.common.MProxyCommon")
|
||||
public static MProxyCommon proxy;
|
||||
public static Manual mantleBook;
|
||||
|
||||
/**
|
||||
* FML preinitialisation handler
|
||||
*
|
||||
@@ -63,8 +64,6 @@ public class Mantle
|
||||
|
||||
mantleBook = (Manual) new Manual().setUnlocalizedName("mantle.manual");
|
||||
GameRegistry.registerItem(mantleBook, "mantleBook");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ public class BlockUtils
|
||||
{
|
||||
return Block.getBlockFromItem(item);
|
||||
}
|
||||
|
||||
public static Block getBlockFromItemStack (ItemStack itemStack)
|
||||
{
|
||||
return getBlockFromItem(itemStack.getItem());
|
||||
|
||||
@@ -16,17 +16,21 @@ import net.minecraft.world.World;
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
public abstract class MantleBlock extends Block {
|
||||
public abstract class MantleBlock extends Block
|
||||
{
|
||||
|
||||
public MantleBlock(Material material) {
|
||||
public MantleBlock(Material material)
|
||||
{
|
||||
super(material);
|
||||
}
|
||||
|
||||
// IDebuggable support - Uses a stick for debug purposes.
|
||||
//TODO onBlockClicked
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && player.getHeldItem() != null && player.getHeldItem().getItem() == Item.getItemFromBlock(Block.getBlockFromName("Item_Stick")))
|
||||
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && player.getHeldItem() != null
|
||||
&& player.getHeldItem().getItem() == Item.getItemFromBlock(Block.getBlockFromName("Item_Stick")))
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof IDebuggable)
|
||||
|
||||
@@ -100,8 +100,9 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I
|
||||
{
|
||||
return getRenderDirection();
|
||||
}
|
||||
public World getWorld()
|
||||
|
||||
public World getWorld ()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
return this.getWorldObj();
|
||||
}
|
||||
}
|
||||
@@ -214,9 +214,10 @@ public abstract class ExpandableInventoryLogic extends InventoryLogic implements
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public World getWorld()
|
||||
|
||||
public World getWorld ()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
return this.getWorldObj();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -126,13 +126,14 @@ public abstract class InventoryBlock extends BlockContainer
|
||||
int side = -1;
|
||||
|
||||
//This class does not have an actual block placed in the world
|
||||
//TODO onBlockPlaced
|
||||
//TODO onBlockPlaced
|
||||
@Override
|
||||
public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
|
||||
{
|
||||
this.side = side;
|
||||
return meta;
|
||||
}
|
||||
|
||||
//TODO onBlockPlacedBy
|
||||
@Override
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack)
|
||||
@@ -201,7 +202,8 @@ public abstract class InventoryBlock extends BlockContainer
|
||||
|
||||
/* IDebuggable */
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && player.getHeldItem().getItem() == Item.getItemById(000)) //TODO make this get a stick!!
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
@@ -126,7 +126,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory, I
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
this.invName = tags.getString("InvName");
|
||||
NBTTagList nbttaglist = tags.getTagList("Items", 0); //TODO WTF goes here <-
|
||||
NBTTagList nbttaglist = tags.getTagList("Items", 9);
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
|
||||
{
|
||||
@@ -227,15 +227,18 @@ public abstract class InventoryLogic extends TileEntity implements IInventory, I
|
||||
{
|
||||
|
||||
}
|
||||
public World getWorld()
|
||||
|
||||
public World getWorld ()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
return this.getWorldObj();
|
||||
}
|
||||
|
||||
/* IDebuggable */
|
||||
@Override
|
||||
public DebugData getDebugInfo(EntityPlayer player) {
|
||||
public DebugData getDebugInfo (EntityPlayer player)
|
||||
{
|
||||
String[] strs = new String[1];
|
||||
strs[0] = "invName: "+ invName + ", inventory.length: " + inventory.length + ", stackSizeLimit: " + stackSizeLimit;
|
||||
strs[0] = "invName: " + invName + ", inventory.length: " + inventory.length + ", stackSizeLimit: " + stackSizeLimit;
|
||||
return new DebugData(player, getClass(), strs);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class InventorySlab extends InventoryBlock
|
||||
|
||||
return super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
|
||||
//TODO: addCollisionBoxesToList()
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity)
|
||||
|
||||
@@ -57,9 +57,12 @@ public class MultiItemBlock extends ItemBlock
|
||||
|
||||
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, (specialIndex[0] > Integer.MIN_VALUE) ? specialIndex[0] : (blockType.length - 1));
|
||||
int sbIndex = (specialIndex[1] > Integer.MIN_VALUE) ? pos : (specialIndex[1] - pos);
|
||||
try {
|
||||
try
|
||||
{
|
||||
return (new StringBuilder()).append(unlocalizedName).append(".").append(blockType[sbIndex]).append(append).toString();
|
||||
} catch (ArrayIndexOutOfBoundsException ex) {
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException ex)
|
||||
{
|
||||
logger.warn("[MultiItemBlock] Caught array index error in getUnlocalizedName: " + ex.getMessage());
|
||||
logger.warn("[MultiItemBlock] Returning unlocalized name!");
|
||||
return getUnlocalizedName();
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic, IDeb
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasValidMaster ( )
|
||||
public boolean hasValidMaster ()
|
||||
{
|
||||
if (!hasMaster)
|
||||
return false;
|
||||
@@ -86,7 +86,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic, IDeb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateMaster (IMasterLogic master,World w, int x, int y, int z)
|
||||
public void invalidateMaster (IMasterLogic master, World w, int x, int y, int z)
|
||||
{
|
||||
hasMaster = false;
|
||||
master = null;
|
||||
@@ -179,9 +179,10 @@ public class MultiServantLogic extends TileEntity implements IServantLogic, IDeb
|
||||
}
|
||||
return new DebugData(player, getClass(), strs);
|
||||
}
|
||||
public World getWorld()
|
||||
{
|
||||
|
||||
public World getWorld ()
|
||||
{
|
||||
return this.getWorldObj();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public interface IServantLogic
|
||||
* @return Is this block tied to this master?
|
||||
*/
|
||||
|
||||
public boolean verifyMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
|
||||
public boolean verifyMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
|
||||
|
||||
/** Exactly what it says on the tin
|
||||
*
|
||||
@@ -43,5 +43,5 @@ public interface IServantLogic
|
||||
* @param z zCoord of master
|
||||
*/
|
||||
|
||||
public void invalidateMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
|
||||
public void invalidateMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster);
|
||||
}
|
||||
@@ -71,8 +71,8 @@ public class RenderItemCopy extends Render
|
||||
int i;
|
||||
|
||||
Block block = null;
|
||||
|
||||
block = Block.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
block = Block.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, new RenderBlocks(), 000)) // TODO what goes here not 000
|
||||
{
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
|
||||
this.renderEngine.bindTexture(par2ResourceLocation);
|
||||
if (this.renderEngine == null)
|
||||
logger.error("renderEngine is null");
|
||||
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("Minecraft", "textures/font/ascii.png"));
|
||||
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("Minecraft", "textures/font/ascii.png"));
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
int j = (i >> 3 & 1) * 85;
|
||||
@@ -731,12 +731,13 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
|
||||
else
|
||||
{
|
||||
int i;
|
||||
if(ChatAllowedCharacters.isAllowedCharacter(par1))
|
||||
if (ChatAllowedCharacters.isAllowedCharacter(par1))
|
||||
i = par1;
|
||||
else{
|
||||
i =69;
|
||||
else
|
||||
{
|
||||
i = 69;
|
||||
logger.error("dont send bad chat characters to my font renderer!");
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 0 && !this.unicodeFlag)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static mantle.lib.CoreRepo.logger;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TurnPageButton extends GuiButton
|
||||
{
|
||||
@@ -19,7 +20,6 @@ public class TurnPageButton extends GuiButton
|
||||
private final boolean nextPage;
|
||||
private static ResourceLocation background;// = new ResourceLocation("tinker", "textures/gui/bookleft.png");
|
||||
|
||||
|
||||
public TurnPageButton(int par1, int par2, int par3, boolean par4, BookData data)
|
||||
{
|
||||
super(par1, par2, par3, 23, 13, "");
|
||||
@@ -27,7 +27,6 @@ public class TurnPageButton extends GuiButton
|
||||
background = data.leftImage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*/
|
||||
|
||||
@@ -32,8 +32,9 @@ public class FurnacePage extends BookPage
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
if (text != null){
|
||||
if(isTranslatable)
|
||||
if (text != null)
|
||||
{
|
||||
if (isTranslatable)
|
||||
text = StatCollector.translateToLocal(text);
|
||||
manual.fonts.drawString("\u00a7n" + text, localWidth + 50, localHeight + 4, 0);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class PicturePage extends BookPage
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
if(isTranslatable)
|
||||
if (isTranslatable)
|
||||
text = StatCollector.translateToLocal(text);
|
||||
manual.fonts.drawSplitString(text, localWidth + 8, localHeight, 178, 0);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ public class SidebarPage extends BookPage
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
if(isTranslatable){
|
||||
if (isTranslatable)
|
||||
{
|
||||
text = StatCollector.translateToLocal(text);
|
||||
}
|
||||
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
|
||||
@@ -47,8 +48,9 @@ public class SidebarPage extends BookPage
|
||||
int offset = text.length() / 4 + 10;
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
{
|
||||
if(isTranslatable){
|
||||
iconText[i]= StatCollector.translateToLocal(iconText[i]);
|
||||
if (isTranslatable)
|
||||
{
|
||||
iconText[i] = StatCollector.translateToLocal(iconText[i]);
|
||||
}
|
||||
manual.renderitem.renderItemIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 8, localHeight + 18 * i + offset);
|
||||
int yOffset = 39;
|
||||
|
||||
@@ -11,16 +11,19 @@ public class ComparisonHelper
|
||||
//TODO figure this out!!!
|
||||
return item.equals(block);
|
||||
}
|
||||
|
||||
public static boolean areEquivalent (Block block1, Block block2)
|
||||
{
|
||||
//TODO figure this out!!!
|
||||
return block1.equals(block2);
|
||||
}
|
||||
|
||||
public static boolean areEquivalent (Item item1, Item item2)
|
||||
{
|
||||
//TODO figure this out!!!
|
||||
return item1.equals(item2);
|
||||
}
|
||||
|
||||
public static boolean areEquivalent (ItemStack is1, ItemStack is2)
|
||||
{
|
||||
//TODO figure this out!!!
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.world.World;
|
||||
public class MProxyCommon implements IGuiHandler
|
||||
{
|
||||
public static int manualGuiID = -1;
|
||||
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
@@ -24,9 +23,11 @@ public class MProxyCommon implements IGuiHandler
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerRenderer ()
|
||||
{
|
||||
}
|
||||
|
||||
public void readManuals ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
public class DebugData {
|
||||
public class DebugData
|
||||
{
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final Class cl;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DebugHelper
|
||||
handleConsoleDebug(data);
|
||||
}
|
||||
|
||||
private static void handleChatDebug(DebugData data)
|
||||
private static void handleChatDebug (DebugData data)
|
||||
{
|
||||
EntityPlayer player = data.player;
|
||||
String prefix = "[" + data.cl.getSimpleName() + "] ";
|
||||
|
||||
@@ -9,8 +9,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
public interface IDebuggable {
|
||||
public interface IDebuggable
|
||||
{
|
||||
|
||||
public DebugData getDebugInfo(EntityPlayer player);
|
||||
public DebugData getDebugInfo (EntityPlayer player);
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.util.StatCollector;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static mantle.lib.CoreRepo.logger;
|
||||
|
||||
public class Manual extends CraftingItem
|
||||
{
|
||||
|
||||
@@ -60,14 +61,14 @@ public class Manual extends CraftingItem
|
||||
@Override
|
||||
public String getUnlocalizedName ()
|
||||
{
|
||||
// logger.info("unloc: " + super.getUnlocalizedName());
|
||||
// logger.info("unloc: " + super.getUnlocalizedName());
|
||||
return modID + ":" + super.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack par1ItemStack)
|
||||
{
|
||||
// logger.info("unloc IS " + super.getUnlocalizedName(par1ItemStack));
|
||||
// logger.info("unloc IS " + super.getUnlocalizedName(par1ItemStack));
|
||||
return super.getUnlocalizedName(par1ItemStack);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package mantle.lib;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* Mantle object repository
|
||||
*
|
||||
|
||||
@@ -39,7 +39,8 @@ public class EnvironmentChecks
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine() || Loader.isModLoaded("optifine"))
|
||||
{
|
||||
if (!CoreConfig.silenceEnvChecks) logger.error("[Environment Checks] Optifine detected. This may cause issues due to base edits or ASM usage.");
|
||||
if (!CoreConfig.silenceEnvChecks)
|
||||
logger.error("[Environment Checks] Optifine detected. This may cause issues due to base edits or ASM usage.");
|
||||
hasOptifine = true;
|
||||
modIds.add("optifine");
|
||||
}
|
||||
@@ -49,7 +50,8 @@ public class EnvironmentChecks
|
||||
Class cl = Class.forName("org.bukkit.Bukkit");
|
||||
if (cl != null)
|
||||
{
|
||||
if (!CoreConfig.silenceEnvChecks) logger.error("[Environment Checks] Bukkit implementation detected. This may cause issues. Bukkit implementations include Craftbukkit and MCPC+.");
|
||||
if (!CoreConfig.silenceEnvChecks)
|
||||
logger.error("[Environment Checks] Bukkit implementation detected. This may cause issues. Bukkit implementations include Craftbukkit and MCPC+.");
|
||||
modIds.add("bukkit");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.util.ChatComponentText;
|
||||
*/
|
||||
public class PlayerUtils
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Sends a given message to a specific player (due to 1.7 axing addChatMessage())
|
||||
*/
|
||||
@@ -19,5 +19,5 @@ public class PlayerUtils
|
||||
if (p != null && message != null && message.isEmpty())
|
||||
p.addChatComponentMessage(new ChatComponentText(message));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,21 +1,25 @@
|
||||
package mantle.world;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Helper functions for dealing with ForgeDirection
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
public class DirectionUtils {
|
||||
public class DirectionUtils
|
||||
{
|
||||
|
||||
private DirectionUtils() {} // All static
|
||||
private DirectionUtils()
|
||||
{
|
||||
} // All static
|
||||
|
||||
public static boolean isRightAngles(ForgeDirection a, ForgeDirection b)
|
||||
public static boolean isRightAngles (ForgeDirection a, ForgeDirection b)
|
||||
{
|
||||
return a != b && a != b.getOpposite() && a != ForgeDirection.UNKNOWN && b != ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static boolean isHorizontal(ForgeDirection a)
|
||||
public static boolean isHorizontal (ForgeDirection a)
|
||||
{
|
||||
return a == ForgeDirection.EAST || a == ForgeDirection.NORTH || a == ForgeDirection.SOUTH || a == ForgeDirection.WEST;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ public class WorldHelper
|
||||
{
|
||||
return ComparisonHelper.areEquivalent(access.getBlock(x, y, z), Blocks.air);
|
||||
}
|
||||
|
||||
public static boolean isAirBlock (World access, int x, int y, int z)
|
||||
{
|
||||
return ComparisonHelper.areEquivalent(access.getBlock(x, y, z), Blocks.air);
|
||||
|
||||
Reference in new issue
Block a user