Skip to content
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

Add Flammable, Rotation. Document Health, Hunger, Position, Velocity, Level, Solid, Hangable, Removable. Update Model #135

Merged
merged 2 commits into from
Sep 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.component.attribute;

import org.spongepowered.api.component.Component;

/**
* Gives the "flammable" attribute.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better description on all of these attributes may be nice

*/
public interface Flammable extends Component {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing blank line


/**
* Gets the remaining time for an {@link Entity} to be on fire.
*
* @return The duration in ticks
*/
int getDuration();

/**
* Checks to see if {@link Entity} is on fire.
*
* @return true If {@link #getDuration()} is greater than 0
*/
boolean isBurning();

/**
* Sets the remaining time for an {@link Entity} to be on fire if
* {@link #isBurning()} is true.
*
* @param ticks The amount to set
*/
void setDuration(int ticks);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.component.attribute;

import org.spongepowered.api.component.Component;

/**
* Gives the "hangable" attribute.
* </p>
* Examples of "hangable" entities: ItemFrame, LeashHitch, Painting.
*/
public interface Hangable extends Component {

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,32 @@
* Gives the "health" attribute.
*/
public interface Health extends Component {

/**
* Gets the value of the current health
* @return The value
* Gets the value of the current health.
*
* @return The health value
*/
double getHealth();

/**
* Sets the value for the health
* @param value The value
* Checks if {@link Entity} is invulnerable.
*
* @return true If {@link Entity} is invulnerable
*/
boolean isInvulnerable();

/**
* Sets {@link Entity} invulnerable if true.
*
* @param invulnerable true to make invulnerable
*/
void setInvulnerable(boolean invulnerable);

/**
* Sets the value for the health.
*
* @param value The health value
*/
void setHealth(double value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,32 @@
* Gives the "hunger" attribute.
*/
public interface Hunger extends Component {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing blank line


/**
* Gets the current hunger level.
*
* @return The hunger level
*/
double getHunger();

/**
* Gets the current saturation level.
*
* @return The saturation level
*/
double getSaturation();

/**
* Sets the current hunger level.
*
* @param hunger The hunger level
*/
void setHunger(double hunger);

double getSaturation();

/**
* Sets the current saturation level.
*
* @param saturation The saturation level
*/
void setSaturation(double saturation);
}
61 changes: 61 additions & 0 deletions src/main/java/org/spongepowered/api/component/attribute/Level.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.component.attribute;

import org.spongepowered.api.component.Component;

/**
* Gives the "level" attribute.
*/
public interface Level extends Component {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing blank line


/**
* Gets the experience value.
*
* @return The experience value
*/
double getExperience();

/**
* Gets the level value.
*
* @return The level value
*/
int getLevel();

/**
* Sets the experience value.
*
* @param experience The experience value
*/
void setExperience(double experience);

/**
* Sets the level value.
*
* @param level The Level value
*/
void setLevel(int level);
}
42 changes: 39 additions & 3 deletions src/main/java/org/spongepowered/api/component/attribute/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,52 @@
* Gives the "model" attribute, used in rendering.
*/
public interface Model extends Component {

/**
* Returns the identifier of the model.
*
* @return The model identifier
*/
String getModel();

/**
* Enum representing all Vanilla models.
*/
public static enum VanillaModels implements Model {
// TODO Someone want to add all the Vanilla models?
// TODO Eventhough the Enderman is THE best entity, he isn't id 0...give him the right one hm?
ENDERMAN(0, "minecraft:enderman");
//All ID's before 50 are not mobs
CREEPER(50, "minecraft:creeper"),
SKELETON(51, "minecraft:skeleton"),
SPIDER(52, "minecraft:spider"),
GIANT(53, "minecraft:giant"),
ZOMBIE(54, "minecraft:zombie"),
SLIME(55, "minecraft:slime"),
GHAST(56, "minecraft:ghast"),
PIG_ZOMBIE(57, "minecraft:pigzombie"),
ENDERMAN(58, "minecraft:enderman"),
CAVE_SPIDER(59, "minecraft:cavespider"),
SILVERFISH(60, "minecraft:silverfish"),
BLAZE(61, "minecraft:blaze"),
MAGMA_CUBE(62, "minecraft:magmacube"),
ENDER_DRAGON(63, "minecraft:enderdragon"),
WITHER(64, "minecraft:wither"),
BAT(65, "minecraft:bat"),
WITCH(66, "minecraft:witch"),
//TODO: Uncomment when ready ENDERMITE(67, "minecraft:endermite"),
//TODO: Uncomment when ready GUARDIAN(68, "minecraft:guardian"),
PIG(90, "minecraft:pig"),
SHEEP(91, "minecraft:sheep"),
COW(92, "minecraft:cow"),
CHICKEN(93, "minecraft:chicken"),
SQUID(94, "minecraft:squid"),
WOLF(95, "minecraft:wolf"),
MOOSHROOM(96, "minecraft:mushroomcow"),
SNOW_GOLEM(97, "minecraft:snowgolem"),
OCELOT(98, "minecraft:ocelot"),
IRON_GOLEM(99, "minecraft:irongolem"),
HORSE(100, "minecraft:horse"),
//TODO: Uncomment when ready RABBIT(101, "minecraft:rabbit"),
VILLAGER(120, "minecraft:villager")
;

private final int id;
private final String model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@
* Gives the "position" attribute.
*/
public interface Position extends Component {

/**
* Gets the position of an {@link Entity} in {@link Vector3i}.
*
* @return position
*/
Vector3f getPosition();

/**
* Sets the position of an {@link Entity} in {@link Vector3i}.
*
* @param position The position to set the entity to
*/
void setPosition(Vector3f position);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.component.attribute;

import org.spongepowered.api.component.Component;

/**
* Gives the "removable" attribute.
* </p>
* Examples of "removable" entities: ItemStack, Arrows, Boat, Painting, etc.
*/
public interface Removable extends Component {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.component.attribute;

import org.spongepowered.api.component.Component;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.math.Vector3f;

/**
* Gives the "rotation" attribute.
*/
public interface Rotation extends Component {

/**
* Gets the rotation of an {@link Entity} in {@link Vector3f}.
*
* @return rotation
*/
Vector3f getRotation();

/**
* Sets the rotation of an {@link Entity} in {@link Vector3f}.
*
* @param rotation The rotation to set the entity to
*/
void setRotation(Vector3f rotation);
}