Skip to content

Refactoring, removal of many suppress warnings. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# for kde users
*.directory

#Mac OS X
.DS_Store
2 changes: 0 additions & 2 deletions powercraft/api/PC_3DRotationFull.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@

public class PC_3DRotationFull implements PC_3DRotation {

@SuppressWarnings("unused")
public PC_3DRotationFull(PC_Direction side, Entity entity) {
// TODO Auto-generated constructor stub
}

@SuppressWarnings("unused")
public PC_3DRotationFull(NBTTagCompound nbtTagCompound, Flag flag){
// TODO Auto-generated constructor stub
}
Expand Down
3 changes: 1 addition & 2 deletions powercraft/api/PC_3DRotationY.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public PC_3DRotationY(int rotation){
public PC_3DRotationY(Entity entity){
this.rotation = PC_Utils.getRotation(entity);
}

@SuppressWarnings("unused")

public PC_3DRotationY(NBTTagCompound nbtTagCompound, Flag flag){
this.rotation = nbtTagCompound.getByte("rotation");
}
Expand Down
14 changes: 6 additions & 8 deletions powercraft/api/PC_Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
@Mod(modid = PC_Api.NAME, name = PC_Api.NAME, version = PC_Api.VERSION, dependencies=PC_Api.DEPENDENCIES)
public final class PC_Api extends PC_Module {

public static final String NAME = POWERCRAFT+"-Api";
public static final String NAME = POWERCRAFT + "-Api";
public static final String VERSION = PC_Build.BUILD_VERSION;
public static final String DEPENDENCIES = "required-before:"+PCco_Core.NAME+"@"+PCco_Core.VERSION;
public static final String DEPENDENCIES = "required-before:" + PCco_Core.NAME + "@" + PCco_Core.VERSION;

static{
PC_Bootstrap.prepare();
Expand All @@ -56,10 +56,9 @@ private PC_Api(){
showPreversions = getConfig().get("options", "showPreversions", false).getBoolean(false);
}

@SuppressWarnings({ "static-method", "unused" })
@SuppressWarnings({ "static-method" })
@EventHandler
public void preInit(FMLPreInitializationEvent event) {

PC_Modules.construct();

PC_PacketHandler.register();
Expand All @@ -86,28 +85,27 @@ public void preInit(FMLPreInitializationEvent event) {
}


@SuppressWarnings("unused")
@EventHandler
public void init(FMLInitializationEvent event) {
//
}


@SuppressWarnings({ "unused", "static-method" })
@SuppressWarnings({ "static-method" })
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
PC_Miniscript.loadDefaultReplacements();
PC_Modules.saveConfig();
}

@SuppressWarnings({ "unused", "static-method" })
@SuppressWarnings({ "static-method" })
@EventHandler
public void serverStarted(FMLServerAboutToStartEvent start) {
PC_Utils.markThreadAsServer();
PC_PacketHandler.setupPackets();
}

@SuppressWarnings({ "static-method", "unused" })
@SuppressWarnings({ "static-method" })
@EventHandler
public void onServerStopping(FMLServerStoppedEvent serverStoppedEvent){
PC_WorldSaveData.onServerStopping();
Expand Down
1 change: 0 additions & 1 deletion powercraft/api/PC_Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public final class PC_Bootstrap {
/**
* initialize Utils and Registry and logger
*/
@SuppressWarnings("unused")
static void prepare() {
try{
if(FMLCommonHandler.instance().getSide()==Side.CLIENT){
Expand Down
1 change: 0 additions & 1 deletion powercraft/api/PC_ClientRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
public final class PC_ClientRegistry extends PC_Registry {

Expand Down
2 changes: 0 additions & 2 deletions powercraft/api/PC_ClientUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @author XOR
*
*/
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
public final class PC_ClientUtils extends PC_Utils {

Expand Down Expand Up @@ -84,7 +83,6 @@ GameType iGetGameTypeFor(EntityPlayer player) {
* is this game running on client
* @return always yes
*/
@SuppressWarnings("hiding")
@Override
PC_Side iGetSide(){
Boolean isClient = PC_ClientUtils.isClient.get();
Expand Down
2 changes: 0 additions & 2 deletions powercraft/api/PC_ImmutableArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public ListIterator<E> listIterator() {
return listIterator(0);
}

@SuppressWarnings("hiding")
@Override
public ListIterator<E> listIterator(int start) {
return new ImmutableListIterator(start);
Expand Down Expand Up @@ -194,7 +193,6 @@ public int size() {
return this.end-this.start;
}

@SuppressWarnings("hiding")
@Override
public List<E> subList(int start, int end) {
if(end>size())
Expand Down
2 changes: 0 additions & 2 deletions powercraft/api/PC_ImmutableList.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public ListIterator<E> listIterator() {
return listIterator(0);
}

@SuppressWarnings("hiding")
@Override
public ListIterator<E> listIterator(int start) {
return new ImmutableListIterator(start);
Expand Down Expand Up @@ -192,7 +191,6 @@ public int size() {
return this.end-this.start;
}

@SuppressWarnings("hiding")
@Override
public List<E> subList(int start, int end) {
if(end>size())
Expand Down
26 changes: 23 additions & 3 deletions powercraft/api/PC_Keyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.lwjgl.input.Keyboard;

import powercraft.api.PC_TickHandler.PC_ITickHandler;
import powercraft.api.reflect.PC_Security;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
Expand All @@ -15,7 +16,7 @@
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public final class PC_Keyboard {
public final class PC_Keyboard implements PC_ITickHandler{

static List<PC_KeyHandler> handlers = new ArrayList<PC_KeyHandler>();

Expand All @@ -25,14 +26,15 @@ public final class PC_Keyboard {
static void register(){
PC_Security.allowedCaller("PC_Keyboard.register()", PC_ClientUtils.class);
FMLCommonHandler.instance().bus().register(INSTANCE);
PC_TickHandler.registerTickHandler(INSTANCE);
}

private PC_Keyboard(){

}

@SideOnly(Side.CLIENT)
@SuppressWarnings({ "unused", "static-method" })
@SuppressWarnings({ "static-method" })
@SubscribeEvent
public void onKeyEvent(KeyInputEvent inputEvent){
int key = Keyboard.getEventKey();
Expand All @@ -53,7 +55,6 @@ public PC_KeyHandler(String sKey, int key, String desk) {
handlers.add(this);
}

@SuppressWarnings("hiding")
void onEvent(boolean state) {
if(this.state && state){
onTick();
Expand All @@ -75,7 +76,26 @@ public boolean isPressed() {
public abstract void onPressed();

public abstract void onRelease();

void checkUnpressed() {
if(!getIsKeyPressed() && this.state){
onRelease();
this.state = false;
}
}

}

@Override
public void onStartTick(PC_Side side) {
//
}

@Override
public void onEndTick(PC_Side side) {
for(PC_KeyHandler handler:handlers){
handler.checkUnpressed();
}
}

}
2 changes: 1 addition & 1 deletion powercraft/api/PC_OreDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static String[] getOreNames(){
}

public static List<ItemStack> getOres(int id){
return getOres(getOreName(id));
return OreDictionary.getOres(Integer.valueOf(id));
}

public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict){
Expand Down
3 changes: 1 addition & 2 deletions powercraft/api/PC_Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static <E extends Entity & PC_IEntity>void registerEntity(Class<? extends
INSTANCE.iRegisterEntity(entity, name, entityTypeID, module, trackingRange, updateFrequency, sendsVelocityUpdates, type);
}

@SuppressWarnings({ "static-method", "unused" })
@SuppressWarnings({ "static-method" })
<E extends Entity & PC_IEntity>void iRegisterEntity(Class<? extends Entity> entity, String name, int entityTypeID, PC_Module module, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, PC_EntityType<E> type){
EntityRegistry.registerModEntity(entity, name, entityTypeID, module, trackingRange, updateFrequency, sendsVelocityUpdates);
}
Expand All @@ -58,7 +58,6 @@ static void playSound(double x, double y, double z, String sound, float soundVol
INSTANCE.iPlaySound(x, y, z, sound, soundVolume, pitch);
}

@SuppressWarnings("unused")
void iPlaySound(double x, double y, double z, String sound, float soundVolume, float pitch) {
//
}
Expand Down
3 changes: 1 addition & 2 deletions powercraft/api/PC_Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ public static String getMD5(String s) {
return new String(digest.digest(s.getBytes()));
}

@SuppressWarnings("unused")
public static int getSideRotation(IBlockAccess world, int x, int y, int z, PC_Direction side, int faceSide) {
notImplementedYet("getSideRotation");
// TODO Auto-generated method stub
Expand Down Expand Up @@ -624,7 +623,7 @@ public static boolean isEntityFX(Entity entity) {
return INSTANCE.iIsEntityFX(entity);
}

@SuppressWarnings({ "static-method", "unused" })
@SuppressWarnings({ "static-method" })
boolean iIsEntityFX(Entity entity) {
return false;
}
Expand Down
Loading