From 65adbce39164302f0c77c43767ad9a492576ada2 Mon Sep 17 00:00:00 2001
From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
Date: Sat, 23 Jun 2018 08:30:00 +0200
Subject: [PATCH 1/3] =?UTF-8?q?Fix=20compiler=20warnings=20in=20NOVA?=
=?UTF-8?q?=E2=80=91Core?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../nova/core/component/ComponentManager.java | 4 ++
.../nova/core/component/ComponentMap.java | 22 +++++----
.../core/component/SidedComponentMap.java | 13 ++++++
.../java/nova/core/component/Updater.java | 2 +-
.../java/nova/core/component/fluid/Fluid.java | 1 +
.../nova/core/component/fluid/FluidBlock.java | 3 +-
.../inventory/InventoryException.java | 2 +
.../core/component/inventory/ItemFilter.java | 14 +++---
.../nova/core/component/misc/Collider.java | 4 +-
.../core/component/transform/Orientation.java | 9 +++-
.../nova/core/config/ConfigException.java | 2 +
.../nova/core/deps/DependencyException.java | 2 +
.../nova/core/entity/component/RigidBody.java | 45 ++++++++++++++++++-
.../java/nova/core/event/bus/EventBus.java | 1 +
.../core/event/bus/EventCancelException.java | 2 +
.../nova/core/event/bus/EventException.java | 2 +
.../java/nova/core/game/InputManager.java | 3 +-
src/main/java/nova/core/item/Item.java | 1 +
.../core/nativewrapper/NativeManager.java | 2 +
.../nova/core/network/NetworkException.java | 3 ++
.../nova/core/network/NetworkManager.java | 6 ++-
.../java/nova/core/network/NetworkTarget.java | 5 ++-
src/main/java/nova/core/network/Packet.java | 22 ++++++---
.../recipes/ingredient/ItemIngredient.java | 4 +-
.../nova/core/render/RenderException.java | 2 +
.../render/pipeline/BlockRenderPipeline.java | 2 +-
.../render/pipeline/ItemRenderPipeline.java | 4 +-
src/main/java/nova/core/retention/Data.java | 5 ++-
.../java/nova/core/retention/Storable.java | 2 +-
.../java/nova/core/util/ClassLoaderUtil.java | 2 +
.../java/nova/core/util/EnumSelector.java | 2 +
src/main/java/nova/core/util/Pipeline.java | 2 +
src/main/java/nova/core/util/ProgressBar.java | 2 +
src/main/java/nova/core/util/RayTracer.java | 3 ++
.../java/nova/core/util/ReflectionUtil.java | 7 ++-
.../core/util/collection/EvictingList.java | 2 +
.../nova/core/util/collection/TreeNode.java | 5 ++-
.../util/exception/RegistrationException.java | 2 +
.../java/nova/core/util/math/MatrixStack.java | 2 +-
.../java/nova/core/util/math/MatrixUtil.java | 2 +
.../nova/core/util/math/RotationUtil.java | 17 +++++--
src/main/java/nova/core/world/World.java | 16 +++++++
src/main/java/nova/internal/core/Game.java | 12 +++--
.../nova/internal/core/di/DICoreModule.java | 6 +--
.../nova/internal/core/di/SupplierModule.java | 36 +++++++++------
.../core/launch/InitializationException.java | 2 +
.../internal/core/util/InjectionUtil.java | 12 ++---
.../internal/core/util/TopologicalSort.java | 4 +-
48 files changed, 247 insertions(+), 78 deletions(-)
diff --git a/src/main/java/nova/core/component/ComponentManager.java b/src/main/java/nova/core/component/ComponentManager.java
index b0913a538..9d6722c80 100755
--- a/src/main/java/nova/core/component/ComponentManager.java
+++ b/src/main/java/nova/core/component/ComponentManager.java
@@ -70,6 +70,10 @@ public void registerNativePassthrough(Class extends Component> componentClass)
/**
* Internal
+ *
+ * @deprecated Internal
+ * @param nativeObject The native object
+ * @return The pass-through components
*/
@Deprecated
public Set> getPassthroughtComponents(Object nativeObject) {
diff --git a/src/main/java/nova/core/component/ComponentMap.java b/src/main/java/nova/core/component/ComponentMap.java
index 5058094a0..58e751642 100644
--- a/src/main/java/nova/core/component/ComponentMap.java
+++ b/src/main/java/nova/core/component/ComponentMap.java
@@ -46,9 +46,9 @@ public ComponentMap(ComponentProvider> provider) {
/**
* Adds a new component based on its superclass or interface using dependency injection.
+ * @param The component type.
* @param componentType The interface or abstract class associated with the new component.
- * @param The node type.
- * @return A new node of N type.
+ * @return The added component.
*/
public final C add(Class componentType) {
return add(Game.injector().resolve(Dependency.dependency(componentType)));
@@ -56,8 +56,9 @@ public final C add(Class componentType) {
/**
* Adds a component to the provider.
+ * @param The component type.
* @param component The component to add.
- * @return the component.
+ * @return The added component.
* @throws ComponentException when the component already exists on the block.
*/
@SuppressWarnings("unchecked")
@@ -79,16 +80,14 @@ public final C add(C component) {
/**
* Adds a component to the block if it is not present.
+ * @param The component type.
* @param component The component to add.
- * @return the component.
+ * @return The component present on this interface
*/
@SuppressWarnings("unchecked")
public final C getOrAdd(C component) {
- if (has(component.getClass())) {
- return get((Class) component.getClass());
- }
-
- return add(component);
+ return getOp((Class) component.getClass())
+ .orElseGet(() -> add(component));
}
/**
@@ -102,6 +101,7 @@ public final boolean has(Class> componentType) {
/**
* Removes a component from the block.
+ * @param The component type.
* @param component The component to remove.
* @return the component removed.
* @throws ComponentException when the component does not exist.
@@ -120,6 +120,7 @@ public final C remove(C component) {
/**
* Removes the component from the provider.
+ * @param The component type.
* @param componentType the component type.
* @return the component removed.
* @throws ComponentException when the component does not exist.
@@ -142,6 +143,7 @@ public final C remove(Class componentType) {
/**
* Gets an optional of the component with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @return the optional of the component found or {@code Optional.empty()}.
* if the component was not found.
@@ -166,6 +168,7 @@ public final Optional getOp(Class componentType) {
/**
* Gets the component with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @return the component.
* @throws ComponentException if the component doesn't exist.
@@ -176,6 +179,7 @@ public final C get(Class componentType) {
/**
* Gets the set of the components with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @return the set of the components.
*/
diff --git a/src/main/java/nova/core/component/SidedComponentMap.java b/src/main/java/nova/core/component/SidedComponentMap.java
index 1d5412ca7..27ab4f214 100644
--- a/src/main/java/nova/core/component/SidedComponentMap.java
+++ b/src/main/java/nova/core/component/SidedComponentMap.java
@@ -34,6 +34,11 @@
/**
* A class that contains all sided components.
+ *
+ * This was implemented horribly poorly, so I intend to re‑implement
+ * it in a better way, which will also break backwards compatibility
+ * for the most part.
+ *
* @author ExE Boss
*/
public class SidedComponentMap extends ComponentMap {
@@ -102,6 +107,7 @@ public final C add(Class componentType, Direction... di
/**
* Adds a component to the provider.
+ * @param The component type.
* @param direction The direction to add the component to.
* @param component The component to add.
* @return the component.
@@ -113,6 +119,7 @@ public final C add(C component, Direction direction) {
/**
* Adds a component to the provider.
+ * @param The component type.
* @param component The component to add.
* @param directions The directions to add the component to.
* @return the component.
@@ -126,6 +133,7 @@ public final C add(C component, Direction... directions) {
/**
* Adds a component to the block if it is not present.
+ * @param The component type.
* @param component The component to add.
* @param direction The direction to get or add the component to.
* @return the component.
@@ -156,6 +164,7 @@ public final boolean canRemove(Class> componentType, Direction direction) {
/**
* Removes the component from the block.
+ * @param The component type.
* @param component the component type.
* @param direction The direction to remove the component from.
* @return the component removed.
@@ -167,6 +176,7 @@ public final C remove(C component, Direction direction) {
/**
* Removes the component from the provider.
+ * @param The component type.
* @param componentType the component type.
* @param direction The direction to remove the component from.
* @return the component removed.
@@ -179,6 +189,7 @@ public final C remove(Class componentType, Direction di
/**
* Gets an optional of the component with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @param direction The direction to get the component from.
* @return the optional of the component found or {@code Optional.empty()}.
@@ -194,6 +205,7 @@ public final Optional getOp(Class componentType, Direction direction)
/**
* Gets the component with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @param direction The direction to get the component from.
* @return the component.
@@ -205,6 +217,7 @@ public final C get(Class componentType, Direction direction) {
/**
* Gets the set of the components with the specified type.
+ * @param The component type.
* @param componentType the type to get.
* @param direction The direction to get the component from.
* @return the set of the components.
diff --git a/src/main/java/nova/core/component/Updater.java b/src/main/java/nova/core/component/Updater.java
index 8700da3a5..4aa0a5008 100644
--- a/src/main/java/nova/core/component/Updater.java
+++ b/src/main/java/nova/core/component/Updater.java
@@ -33,7 +33,7 @@ default void update(double deltaTime) {
* Update components
*/
if (this instanceof ComponentProvider) {
- ((ComponentProvider) this).components()
+ ((ComponentProvider>) this).components()
.stream()
.filter(component -> component instanceof Updater)
.forEach(component -> ((Updater) component).update(deltaTime));
diff --git a/src/main/java/nova/core/component/fluid/Fluid.java b/src/main/java/nova/core/component/fluid/Fluid.java
index 809e968ca..65b850919 100644
--- a/src/main/java/nova/core/component/fluid/Fluid.java
+++ b/src/main/java/nova/core/component/fluid/Fluid.java
@@ -54,6 +54,7 @@ public int amount() {
* Sets new size of this FluidStack
* Note that there can never be fluid with "zero" amount. Use Optional.empty() instead.
* @param amount New size
+ * @return {@code this} instance
*/
public Fluid setAmount(int amount) {
this.amount = Math.max(amount, 1);
diff --git a/src/main/java/nova/core/component/fluid/FluidBlock.java b/src/main/java/nova/core/component/fluid/FluidBlock.java
index f9113d0aa..cae374ab4 100644
--- a/src/main/java/nova/core/component/fluid/FluidBlock.java
+++ b/src/main/java/nova/core/component/fluid/FluidBlock.java
@@ -29,6 +29,7 @@ public interface FluidBlock {
/**
* Returns the Fluid associated with this Block.
+ * @return The Fluid associated with this Block.
*/
Optional getFluid();
@@ -38,7 +39,7 @@ public interface FluidBlock {
* NOTE: The block is intended to handle its own state changes.
*
* @param doDrain If false, the drain will only be simulated.
- * @return
+ * @return The drained fluid amount.
*/
Optional drain(boolean doDrain);
}
diff --git a/src/main/java/nova/core/component/inventory/InventoryException.java b/src/main/java/nova/core/component/inventory/InventoryException.java
index eb81bb8e3..6ce95f9ee 100644
--- a/src/main/java/nova/core/component/inventory/InventoryException.java
+++ b/src/main/java/nova/core/component/inventory/InventoryException.java
@@ -23,6 +23,8 @@
import nova.core.util.exception.NovaException;
public class InventoryException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public InventoryException() {
super();
}
diff --git a/src/main/java/nova/core/component/inventory/ItemFilter.java b/src/main/java/nova/core/component/inventory/ItemFilter.java
index 02447c66c..6569a73ec 100644
--- a/src/main/java/nova/core/component/inventory/ItemFilter.java
+++ b/src/main/java/nova/core/component/inventory/ItemFilter.java
@@ -34,10 +34,10 @@ public interface ItemFilter extends Predicate {
/**
* Returns an {@link ItemFilter} that accepts an {@link Item} of the same
- * type as the provided.
+ * type as provided.
*
- * @param item
- * @return ItemFilter
+ * @param item The item type
+ * @return The ItemFilter instance checking the item type
*/
static ItemFilter of(Item item) {
return item::sameItemType;
@@ -47,8 +47,8 @@ static ItemFilter of(Item item) {
* Returns an {@link ItemFilter} that accepts an {@link Item} of the same
* type as provided.
*
- * @param id
- * @return ItemFilter
+ * @param id The item ID
+ * @return The ItemFilter instance checking the item ID
*/
static ItemFilter of(String id) {
return (other) -> id.equals(other.getID());
@@ -57,8 +57,8 @@ static ItemFilter of(String id) {
/**
* Accepts any {@link Item} that has a >= stack size than provided.
*
- * @param amount
- * @return
+ * @param amount The amount
+ * @return The ItemFilter instance checking the amount
*/
static ItemFilter of(int amount) {
return (other) -> other.count() >= amount;
diff --git a/src/main/java/nova/core/component/misc/Collider.java b/src/main/java/nova/core/component/misc/Collider.java
index af7c1fd18..c84314a5b 100644
--- a/src/main/java/nova/core/component/misc/Collider.java
+++ b/src/main/java/nova/core/component/misc/Collider.java
@@ -40,7 +40,7 @@
@UnsidedComponent
public class Collider extends Component {
- public final ComponentProvider provider;
+ public final ComponentProvider> provider;
/**
* A general cuboid that represents the bounds of this object.
@@ -66,7 +66,7 @@ public class Collider extends Component {
*/
public Supplier isOpaqueCube = isCube;
- public Collider(ComponentProvider provider) {
+ public Collider(ComponentProvider> provider) {
this.provider = provider;
}
diff --git a/src/main/java/nova/core/component/transform/Orientation.java b/src/main/java/nova/core/component/transform/Orientation.java
index 1d9f21ab2..adf9ba132 100644
--- a/src/main/java/nova/core/component/transform/Orientation.java
+++ b/src/main/java/nova/core/component/transform/Orientation.java
@@ -43,7 +43,6 @@
import org.apache.commons.math3.util.FastMath;
import java.util.Arrays;
-import java.util.Optional;
import java.util.function.Predicate;
/**
@@ -259,6 +258,10 @@ public boolean canRotate(Direction side) {
/**
* Rotatable Block
+ *
+ * @param side The hit side
+ * @param hit The hit vector
+ * @return If rotation is possible from this side
*/
public boolean rotate(int side, Vector3D hit) {
int result = getSideToRotate(side, hit);
@@ -274,6 +277,10 @@ public boolean rotate(int side, Vector3D hit) {
/**
* Determines the side to rotate based on the hit vector on the block.
+ *
+ * @param hitSide The hit side
+ * @param hit The hit vector
+ * @return The rotation axis
*/
public int getSideToRotate(int hitSide, Vector3D hit) {
int tBack = hitSide ^ 1;
diff --git a/src/main/java/nova/core/config/ConfigException.java b/src/main/java/nova/core/config/ConfigException.java
index c8828caed..7fdee443a 100644
--- a/src/main/java/nova/core/config/ConfigException.java
+++ b/src/main/java/nova/core/config/ConfigException.java
@@ -23,6 +23,8 @@
import nova.core.util.exception.NovaException;
public class ConfigException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public ConfigException() {
super();
}
diff --git a/src/main/java/nova/core/deps/DependencyException.java b/src/main/java/nova/core/deps/DependencyException.java
index f6df616b5..f5f399288 100644
--- a/src/main/java/nova/core/deps/DependencyException.java
+++ b/src/main/java/nova/core/deps/DependencyException.java
@@ -23,6 +23,8 @@
import nova.core.util.exception.NovaException;
public class DependencyException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public DependencyException() {
super();
}
diff --git a/src/main/java/nova/core/entity/component/RigidBody.java b/src/main/java/nova/core/entity/component/RigidBody.java
index a7ca3817e..89e1e69ac 100644
--- a/src/main/java/nova/core/entity/component/RigidBody.java
+++ b/src/main/java/nova/core/entity/component/RigidBody.java
@@ -34,6 +34,8 @@
public abstract class RigidBody extends Component implements Updater {
/**
* Mass in kilograms. Default is 1 kg.
+ *
+ * @return The mass of this rigid body.
*/
public abstract double getMass();
@@ -41,6 +43,8 @@ public abstract class RigidBody extends Component implements Updater {
/**
* Velocity is how fast the body is moving
+ *
+ * @return The velocity vector of this rigid body.
*/
public abstract Vector3D getVelocity();
@@ -52,6 +56,8 @@ public abstract class RigidBody extends Component implements Updater {
/**
* Gravity is an acceleration.
+ *
+ * @return The gravity vector of this rigid body.
*/
public abstract Vector3D getGravity();
@@ -59,6 +65,8 @@ public abstract class RigidBody extends Component implements Updater {
/**
* Rotation Methods
+ *
+ * @return The angular drag of this rigid body.
*/
public abstract double getAngularDrag();
@@ -70,6 +78,8 @@ public abstract class RigidBody extends Component implements Updater {
/**
* Forces
+ *
+ * @param force The force to apply.
*/
public abstract void addForce(Vector3D force);
@@ -78,28 +88,61 @@ public abstract class RigidBody extends Component implements Updater {
public abstract void addTorque(Vector3D torque);
/**
- * Scala sugar coating
+ * Alias for {@link #getMass()}.
+ *
+ * @return The mass of this rigid body.
+ * @see #getMass()
*/
public final double mass() {
return getMass();
}
+ /**
+ * Alias for {@link #getVelocity()}.
+ *
+ * @return The velocity vector of this rigid body.
+ * @see #getVelocity()
+ */
public final Vector3D velocity() {
return getVelocity();
}
+ /**
+ * Alias for {@link #getDrag()}.
+ *
+ * @return The drag of this rigid body.
+ * @see #getDrag()
+ */
public final double drag() {
return getDrag();
}
+ /**
+ * Alias for {@link #getGravity()}.
+ *
+ * @return The gravity vector of this rigid body.
+ * @see #getGravity()
+ */
public final Vector3D gravity() {
return getGravity();
}
+ /**
+ * Alias for {@link #getAngularDrag()}.
+ *
+ * @return The angular drag of this rigid body.
+ * @see #getAngularDrag()
+ */
public final double angularDrag() {
return getAngularDrag();
}
+ /**
+ * Alias for {@link #getAngularVelocity()}.
+ *
+ * @return The angular velocity of this rigid body.
+ * @see #getAngularVelocity()
+ */
public final Rotation angularVelocity() {
return getAngularVelocity();
}
diff --git a/src/main/java/nova/core/event/bus/EventBus.java b/src/main/java/nova/core/event/bus/EventBus.java
index 41688decc..b399f2c7b 100644
--- a/src/main/java/nova/core/event/bus/EventBus.java
+++ b/src/main/java/nova/core/event/bus/EventBus.java
@@ -216,6 +216,7 @@ public EventBinder after(String name) {
* @return The event handler
*/
public synchronized EventListenerHandle bind(EventListener list) {
+ @SuppressWarnings("unchecked")
EventListener listener = clazz.isPresent() ? new TypedEventListener<>(list, clazz.get()) : (EventListener) list;
if (name != null && unsortedListeners.stream().filter(node -> node.name != null).anyMatch(node -> node.name.equals(name))) {
diff --git a/src/main/java/nova/core/event/bus/EventCancelException.java b/src/main/java/nova/core/event/bus/EventCancelException.java
index 0a2be6967..234c0394f 100644
--- a/src/main/java/nova/core/event/bus/EventCancelException.java
+++ b/src/main/java/nova/core/event/bus/EventCancelException.java
@@ -21,6 +21,8 @@
package nova.core.event.bus;
public class EventCancelException extends EventException {
+ private static final long serialVersionUID = 1L;
+
public EventCancelException(String message, Class extends Event> event) {
super(message, event);
}
diff --git a/src/main/java/nova/core/event/bus/EventException.java b/src/main/java/nova/core/event/bus/EventException.java
index 34e6a97e1..9cc423ebe 100644
--- a/src/main/java/nova/core/event/bus/EventException.java
+++ b/src/main/java/nova/core/event/bus/EventException.java
@@ -23,6 +23,8 @@
import nova.core.util.exception.NovaException;
public class EventException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public EventException() {
super();
}
diff --git a/src/main/java/nova/core/game/InputManager.java b/src/main/java/nova/core/game/InputManager.java
index 80920b29a..66aace24b 100644
--- a/src/main/java/nova/core/game/InputManager.java
+++ b/src/main/java/nova/core/game/InputManager.java
@@ -57,7 +57,8 @@ public int getNativeKeyCode(Key key) {
/**
* Is the key current down?
*
- * @return
+ * @param key The {@link Key key} to check.
+ * @return The pressed state of the key.
*/
public abstract boolean isKeyDown(Key key);
diff --git a/src/main/java/nova/core/item/Item.java b/src/main/java/nova/core/item/Item.java
index f3770a9a8..5fe194840 100644
--- a/src/main/java/nova/core/item/Item.java
+++ b/src/main/java/nova/core/item/Item.java
@@ -81,6 +81,7 @@ public int count() {
/**
* Sets new size of this ItemStack
* @param size New size
+ * @return {@code this} instance
*/
public Item setCount(int size) {
count = Math.max(Math.min(getMaxCount(), size), 0);
diff --git a/src/main/java/nova/core/nativewrapper/NativeManager.java b/src/main/java/nova/core/nativewrapper/NativeManager.java
index df844740f..3cb100f8f 100644
--- a/src/main/java/nova/core/nativewrapper/NativeManager.java
+++ b/src/main/java/nova/core/nativewrapper/NativeManager.java
@@ -113,6 +113,7 @@ private > CONVERTE
* Converts a native object to a nova object. This method has autocast, is DANGEROUS and may crash.
*
* @param nativeObject A game implementation object.
+ * @param The NOVA equivalent type.
* @return The NOVA equivalent object.
*/
public T toNova(Object nativeObject) {
@@ -129,6 +130,7 @@ public T toNova(Object nativeObject) {
* Converts a nova object to a native object. This method has autocast, is DANGEROUS and may crash.
*
* @param novaObject A NOVA implementation object.
+ * @param The game equivalent type.
* @return The game equivalent object.
*/
public T toNative(Object novaObject) {
diff --git a/src/main/java/nova/core/network/NetworkException.java b/src/main/java/nova/core/network/NetworkException.java
index d96aca679..96ba9a71f 100644
--- a/src/main/java/nova/core/network/NetworkException.java
+++ b/src/main/java/nova/core/network/NetworkException.java
@@ -22,7 +22,10 @@
import nova.core.util.exception.NovaException;
+
public class NetworkException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public NetworkException() {
super();
}
diff --git a/src/main/java/nova/core/network/NetworkManager.java b/src/main/java/nova/core/network/NetworkManager.java
index 4adb356ce..86c663f7d 100644
--- a/src/main/java/nova/core/network/NetworkManager.java
+++ b/src/main/java/nova/core/network/NetworkManager.java
@@ -46,7 +46,8 @@ public NetworkManager() {
* Register a packet type. A packet type handles
* a specific packet handler type.
*
- * @param type An ID is assigned to the packet handler
+ * @param type The packet handler to register
+ * @return The ID of the packet handler
*/
public int register(PacketHandler> type) {
handlers.add(type);
@@ -104,11 +105,12 @@ public void sendPacket(Object sender, Packet packet) {
*/
public abstract void sendPacket(Packet packet);
+ @SuppressWarnings("unchecked")
public Packet writePacket(Object sender, Packet packet) {
int packetTypeID = getPacketTypeID(getPacketType(sender));
packet.writeInt(packetTypeID);
packet.writeInt(packet.getID());
- ((PacketHandler) getPacketType(sender)).write(sender, packet);
+ ((PacketHandler
*
*
@@ -195,7 +196,7 @@ public Side reduce() {
/**
* Shorthand for {@code Side.assertSide(this)}
*
- * @see #assertSide(Side)
+ * @see #assertSide(nova.core.network.NetworkTarget.Side)
*/
public void assertSide() {
Side current = get();
diff --git a/src/main/java/nova/core/network/Packet.java b/src/main/java/nova/core/network/Packet.java
index 2ad0c0484..16bf40ec1 100644
--- a/src/main/java/nova/core/network/Packet.java
+++ b/src/main/java/nova/core/network/Packet.java
@@ -47,12 +47,14 @@ public interface Packet {
/**
* Sets the ID of this packet, allowing it to be sent accordingly.
+ * @param id The packet ID
* @return The packet itself.
*/
Packet setID(int id);
/**
* The player sending the packet
+ * @return The player sending the packet
*/
Player player();
@@ -193,7 +195,7 @@ default Packet write(Object data) {
Packet writeString(String value);
//TODO: Packet handler is bad at reading/writing enums for unknown reasons
- default Packet writeEnum(Enum data) {
+ default Packet writeEnum(Enum> data) {
writeString(data.getClass().getName());
writeString(data.name());
return this;
@@ -232,7 +234,7 @@ default Packet writeStorable(Storable storable) {
return this;
}
- default Packet writeCollection(Collection col) {
+ default Packet writeCollection(Collection> col) {
writeInt(col.size());
col.forEach(obj -> {
writeShort(getType(obj.getClass()));
@@ -241,7 +243,7 @@ default Packet writeCollection(Collection col) {
return this;
}
- default Packet writeOptional(Optional optional) {
+ default Packet writeOptional(Optional> optional) {
if (optional.isPresent()) {
writeShort(getType(optional.get().getClass()));
write(optional.get());
@@ -337,17 +339,18 @@ default Packet writeOptional(Optional optional) {
String readString();
- default Enum readEnum() {
+ default > E readEnum() {
try {
String enumClassName = readString();
- Class extends Enum> className = (Class) Class.forName(enumClassName);
+ @SuppressWarnings("unchecked")
+ Class className = (Class) Class.forName(enumClassName);
return readEnum(className);
} catch (Exception e) {
throw new NetworkException("Failed to read enum.", e);
}
}
- default Enum readEnum(Class extends Enum> type) {
+ default > E readEnum(Class type) {
return Enum.valueOf(type, readString());
}
@@ -358,6 +361,7 @@ default Syncable readPacketHandler(Syncable handler) {
/**
* Reads a {@link Data} type.
+ * @return The data type
*/
default Data readData() {
Data readData = new Data();
@@ -380,13 +384,14 @@ default Object readStorable() {
}
default List readList() {
- ArrayList arrayList = new ArrayList();
+ ArrayList arrayList = new ArrayList<>();
int size = readInt();
IntStream
.range(0, size)
.forEach(i -> {
short type = readShort();
+ @SuppressWarnings("unchecked")
T value = (T) read(Data.dataTypes[type]);
arrayList.add(value);
});
@@ -402,6 +407,7 @@ default Set readSet() {
.range(0, size)
.forEach(i -> {
short type = readShort();
+ @SuppressWarnings("unchecked")
T value = (T) read(Data.dataTypes[type]);
set.add(value);
});
@@ -409,6 +415,7 @@ default Set readSet() {
return set;
}
+ @SuppressWarnings("unchecked")
default Optional readOptional() {
short type = readShort();
if (type != -1) {
@@ -426,6 +433,7 @@ default Vector3D readVector3D() {
return new Vector3D(readDouble(), readDouble(), readDouble());
}
+ @SuppressWarnings("unchecked")
default T read(Class clazz) {
if (clazz == Boolean.class || clazz == boolean.class) {
return (T) Boolean.valueOf(readBoolean());
diff --git a/src/main/java/nova/core/recipes/ingredient/ItemIngredient.java b/src/main/java/nova/core/recipes/ingredient/ItemIngredient.java
index 9c37547f1..a86c320d4 100755
--- a/src/main/java/nova/core/recipes/ingredient/ItemIngredient.java
+++ b/src/main/java/nova/core/recipes/ingredient/ItemIngredient.java
@@ -118,8 +118,10 @@ static ItemIngredient forDictionary(String id) {
Optional getTag();
/**
- * Sets the ingredient tag. Ingredients can be tagged to make them easy to read from recipe functions.
+ * Sets the ingredient tag. Ingredients can be tagged to make them
+ * easy to read from recipe functions.
*
+ * @param tag The ingredient tag
* @return this instance
*/
public ItemIngredient withTag(String tag);
diff --git a/src/main/java/nova/core/render/RenderException.java b/src/main/java/nova/core/render/RenderException.java
index 8c6302c5e..a2c02138e 100644
--- a/src/main/java/nova/core/render/RenderException.java
+++ b/src/main/java/nova/core/render/RenderException.java
@@ -23,6 +23,8 @@
import nova.core.util.exception.NovaException;
public class RenderException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public RenderException() {
super();
}
diff --git a/src/main/java/nova/core/render/pipeline/BlockRenderPipeline.java b/src/main/java/nova/core/render/pipeline/BlockRenderPipeline.java
index 2873a8909..a6f4f7d6a 100644
--- a/src/main/java/nova/core/render/pipeline/BlockRenderPipeline.java
+++ b/src/main/java/nova/core/render/pipeline/BlockRenderPipeline.java
@@ -138,7 +138,7 @@ public BlockRenderPipeline withBounds(Cuboid bounds) {
*
* @param renderSide A predicate that takes a {@link nova.core.util.Direction}
* and returns a boolean specifying whether or not the side should render.
- * @return
+ * @return this
*/
public BlockRenderPipeline filter(Predicate renderSide) {
this.renderSide = renderSide;
diff --git a/src/main/java/nova/core/render/pipeline/ItemRenderPipeline.java b/src/main/java/nova/core/render/pipeline/ItemRenderPipeline.java
index a1f915d4e..9af5a1ee4 100644
--- a/src/main/java/nova/core/render/pipeline/ItemRenderPipeline.java
+++ b/src/main/java/nova/core/render/pipeline/ItemRenderPipeline.java
@@ -43,7 +43,7 @@
*/
public class ItemRenderPipeline extends RenderPipeline {
- public final ComponentProvider componentProvider;
+ public final ComponentProvider> componentProvider;
/**
* Called to get the texture of this item.
@@ -64,7 +64,7 @@ public class ItemRenderPipeline extends RenderPipeline {
*/
public Supplier colorMultiplier = () -> Color.white;
- public ItemRenderPipeline(ComponentProvider componentProvider) {
+ public ItemRenderPipeline(ComponentProvider> componentProvider) {
this.componentProvider = componentProvider;
size = () -> new Vector2D(1, 1);
consumer = model -> model.addChild(draw(new MeshModel()));
diff --git a/src/main/java/nova/core/retention/Data.java b/src/main/java/nova/core/retention/Data.java
index 1429771ff..a93fbeb02 100755
--- a/src/main/java/nova/core/retention/Data.java
+++ b/src/main/java/nova/core/retention/Data.java
@@ -219,11 +219,12 @@ public static T unserialize(Data data) {
* Loads an object from its stored data, given its class.
* @param clazz - The class to load
* @param data - The data
+ * @param - The type
* @return The object loaded with given data.
*/
public static T unserialize(Class clazz, Data data) {
try {
- T storable = clazz.newInstance();
+ T storable = clazz.getDeclaredConstructor().newInstance();
storable.load(data);
return storable;
} catch (Exception e) {
@@ -324,7 +325,7 @@ public T getStorable(String key) {
try {
@SuppressWarnings("unchecked")
Class storableClass = (Class) Class.forName(storableData.className);
- T obj = storableClass.newInstance();
+ T obj = storableClass.getDeclaredConstructor().newInstance();
obj.load(storableData);
return obj;
} catch (Exception e) {
diff --git a/src/main/java/nova/core/retention/Storable.java b/src/main/java/nova/core/retention/Storable.java
index 3efa05639..28a0e3a7a 100644
--- a/src/main/java/nova/core/retention/Storable.java
+++ b/src/main/java/nova/core/retention/Storable.java
@@ -88,7 +88,7 @@ default void load(Data data) {
if (List.class.isAssignableFrom(type)) {
field.set(this, Data.unserialize((Data) value));
} else {
- Collection> collection = (Collection) type.newInstance();
+ Collection> collection = (Collection) type.getDeclaredConstructor().newInstance();
field.set(this, collection.addAll(Data.unserialize((Data) value)));
}
} else {
diff --git a/src/main/java/nova/core/util/ClassLoaderUtil.java b/src/main/java/nova/core/util/ClassLoaderUtil.java
index c3e4a8e1b..b9dffb23a 100644
--- a/src/main/java/nova/core/util/ClassLoaderUtil.java
+++ b/src/main/java/nova/core/util/ClassLoaderUtil.java
@@ -61,6 +61,8 @@ private static synchronized void setAddURL() {
}
public static class ClassLoaderException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public ClassLoaderException() {
super();
}
diff --git a/src/main/java/nova/core/util/EnumSelector.java b/src/main/java/nova/core/util/EnumSelector.java
index a557110b8..40ca597b2 100644
--- a/src/main/java/nova/core/util/EnumSelector.java
+++ b/src/main/java/nova/core/util/EnumSelector.java
@@ -52,6 +52,8 @@ private EnumSelector(Class enumClass) {
/**
* Creates a new instance of EnumSelector for the given type.
*
+ * @param The enum type
+ * @param enumClass The enum class for which to create an EnumSelector.
* @return an instance of EnumSelector for the given type.
*/
public static > EnumSelector of(Class enumClass) {
diff --git a/src/main/java/nova/core/util/Pipeline.java b/src/main/java/nova/core/util/Pipeline.java
index dd8da422e..18cfc390a 100644
--- a/src/main/java/nova/core/util/Pipeline.java
+++ b/src/main/java/nova/core/util/Pipeline.java
@@ -6,6 +6,7 @@
/**
* A series of methods that transform an object as it is passed through the {@link Pipeline}.
* @author Calclavia
+ * @param The pipeline type.
*/
public class Pipeline {
protected Optional> prev = Optional.empty();
@@ -29,6 +30,7 @@ public Pipeline(Consumer consumer) {
/**
* Sets the given pipeline to be piped after this render stream.
* This method essentially allow you to switch between processes in the pipeline.
+ * @param The new pipeline type.
* @param stream The stream to apply.
* @return The new RenderStream
*/
diff --git a/src/main/java/nova/core/util/ProgressBar.java b/src/main/java/nova/core/util/ProgressBar.java
index 6d5b68c9e..12239f69a 100644
--- a/src/main/java/nova/core/util/ProgressBar.java
+++ b/src/main/java/nova/core/util/ProgressBar.java
@@ -58,6 +58,8 @@ protected void stepImpl(String message) {}
/**
* Check if the progress bar has been finished.
+ *
+ * @return If the progress bar has finished.
*/
boolean isFinished();
diff --git a/src/main/java/nova/core/util/RayTracer.java b/src/main/java/nova/core/util/RayTracer.java
index 79ac4d66e..69e4312f5 100644
--- a/src/main/java/nova/core/util/RayTracer.java
+++ b/src/main/java/nova/core/util/RayTracer.java
@@ -89,6 +89,7 @@ public Stream rayTraceAll(World world) {
/**
* Check all blocks that are in a line
+ * @param world The world to perform the ray trace in.
* @return The blocks ray traced in the order from closest to furthest.
*/
public Stream rayTraceBlocks(World world) {
@@ -171,7 +172,9 @@ public Optional rayTrace(Cuboid cuboid) {
/**
* Ray traces a cuboid
+ * @param the result type
* @param cuboid The cuboid in absolute world coordinates
+ * @param resultMapper the {@link RayTraceResult} converter
* @return The ray trace result if the ray intersects the cuboid
*/
public Optional rayTrace(Cuboid cuboid, BiFunction resultMapper) {
diff --git a/src/main/java/nova/core/util/ReflectionUtil.java b/src/main/java/nova/core/util/ReflectionUtil.java
index 4ffb81317..47c7a104c 100644
--- a/src/main/java/nova/core/util/ReflectionUtil.java
+++ b/src/main/java/nova/core/util/ReflectionUtil.java
@@ -267,7 +267,7 @@ public static T newInstanceMatching(Class clazz, Object... args) {
if (args != null && args.length > 0) {
return newInstanceMatching(findMatchingConstructor(clazz, types(args)).get(), args);
} else {
- return clazz.newInstance();
+ return clazz.getDeclaredConstructor().newInstance();
}
} catch (Exception e) {
throw new ReflectionException(e);
@@ -279,7 +279,7 @@ public static T newInstance(Class clazz, Object... args) {
if (args != null && args.length > 0) {
return clazz.getConstructor(types(args)).newInstance(args);
}
- return clazz.newInstance();
+ return clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new ReflectionException(e);
}
@@ -304,6 +304,7 @@ public static void forEachAnnotatedField(Class extends
* Gets all the annotated fields of this class, including all the parents
* classes in the order of hierarchy.
*
+ * @param The annotation type
* @param annotation Your annotation class.
* @param clazz Class to search through.
* @return An ordered map of annotated fields and their annotations from the
@@ -329,6 +330,8 @@ public static void forEachRecursiveAnnotatedField(Class Type contained in the list
*/
public class EvictingList extends LinkedList {
+ private static final long serialVersionUID = 1L;
+
private final int limit;
/**
diff --git a/src/main/java/nova/core/util/collection/TreeNode.java b/src/main/java/nova/core/util/collection/TreeNode.java
index 3a7b610cd..b63839889 100644
--- a/src/main/java/nova/core/util/collection/TreeNode.java
+++ b/src/main/java/nova/core/util/collection/TreeNode.java
@@ -36,7 +36,7 @@
*
* @param - Self type
*/
-public class TreeNode implements Iterable {
+public class TreeNode> implements Iterable {
/**
* The children of the node.
@@ -71,9 +71,10 @@ public void setParent(Optional parent) {
* @param node The childnode to add
* @return The merged node
*/
+ @SuppressWarnings("unchecked")
public S addChild(S node) {
children.add(node);
- node.parent = Optional.of(this);
+ node.parent = Optional.of((S) this);
return node;
}
diff --git a/src/main/java/nova/core/util/exception/RegistrationException.java b/src/main/java/nova/core/util/exception/RegistrationException.java
index 320470054..6daa8bc63 100644
--- a/src/main/java/nova/core/util/exception/RegistrationException.java
+++ b/src/main/java/nova/core/util/exception/RegistrationException.java
@@ -24,6 +24,8 @@
* An exception thrown when registration in a manager, dictionary or registry fails.
*/
public class RegistrationException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public RegistrationException() {
super();
}
diff --git a/src/main/java/nova/core/util/math/MatrixStack.java b/src/main/java/nova/core/util/math/MatrixStack.java
index de9db256f..addd37d89 100755
--- a/src/main/java/nova/core/util/math/MatrixStack.java
+++ b/src/main/java/nova/core/util/math/MatrixStack.java
@@ -42,8 +42,8 @@ public MatrixStack() {
* Clone construcotr of MatrixStack
* @param clone instance to be cloned
*/
+ @SuppressWarnings("unchecked")
public MatrixStack(MatrixStack clone) {
- //noinspection unchecked
this.stack = (Stack) clone.stack.clone();
this.current = clone.current.copy();
}
diff --git a/src/main/java/nova/core/util/math/MatrixUtil.java b/src/main/java/nova/core/util/math/MatrixUtil.java
index a4fbbeea7..8bf86032e 100755
--- a/src/main/java/nova/core/util/math/MatrixUtil.java
+++ b/src/main/java/nova/core/util/math/MatrixUtil.java
@@ -55,6 +55,8 @@ public static RealMatrix augmentWithIdentity(RealMatrix matrix, int dimensions)
// Little cheat.
private static Localizable of(String string) {
return new Localizable() {
+ private static final long serialVersionUID = 1L;
+
@Override
public String getSourceString() {
return string;
diff --git a/src/main/java/nova/core/util/math/RotationUtil.java b/src/main/java/nova/core/util/math/RotationUtil.java
index eac0e92b4..45e9b1359 100755
--- a/src/main/java/nova/core/util/math/RotationUtil.java
+++ b/src/main/java/nova/core/util/math/RotationUtil.java
@@ -79,7 +79,10 @@ public static int rotateSide(int s, int r) {
}
/**
- * Reverse of rotateSide
+ * Rotates a Direction global size into a relative side.
+ * @param s1 Side 1
+ * @param s2 Side 2
+ * @return The Direction ordinal from 0-5.
*/
public static int rotationTo(int s1, int s2) {
if ((s1 & 6) == (s2 & 6)) {
@@ -106,6 +109,11 @@ public static Direction getRelativeSide(Direction front, Direction side) {
* Wrapper function that simply calls {@code slerp(a, b, t, true)}.
*
* See {@link #slerp(Rotation, Rotation, double, boolean)} for details.
+ *
+ * @param a the first Rotation
+ * @param b the second Rotation
+ * @param t the temporal interpolation parameter
+ * @return The slerp interpolation of Rotations {@code a} and {@code b}, at time {@code t}.
*/
public static Rotation slerp(Rotation a, Rotation b, double t) {
return slerp(a, b, t, true);
@@ -123,11 +131,12 @@ public static Rotation slerp(Rotation a, Rotation b, double t) {
* "flipping" the source Rotation if needed.
* @param a the first Rotation
* @param b the second Rotation
- * @param t the t interpolation parameter
+ * @param t the temporal interpolation parameter
* @param allowFlip tells whether or not the interpolation allows axis flip
+ * @return The slerp interpolation of Rotations {@code a} and {@code b}, at time {@code t}.
*/
public static Rotation slerp(Rotation a, Rotation b, double t, boolean allowFlip) {
- // Warning: this method should not normalize the Rotation
+ // TODO: this method should not normalize the Rotation
double cosAngle = dotProduct(a, b);
double c1, c2;
@@ -156,7 +165,9 @@ public static Rotation slerp(Rotation a, Rotation b, double t, boolean allowFlip
* Returns the "dot" product of this Quaternion and {@code b}:
*
* {@code this.x * b.x + this.y * b.y + this.z * b.z + this.w * b.w}
+ * @param a This
* @param b the Quaternion
+ * @return The dot product
*/
public static double dotProduct(Rotation a, Rotation b) {
return a.getQ0() * b.getQ0() + a.getQ1() * b.getQ1() + a.getQ2() * b.getQ2() + a.getQ3() * b.getQ3();
diff --git a/src/main/java/nova/core/world/World.java b/src/main/java/nova/core/world/World.java
index d89565221..8b551f576 100644
--- a/src/main/java/nova/core/world/World.java
+++ b/src/main/java/nova/core/world/World.java
@@ -77,29 +77,45 @@ public boolean removeBlock(Vector3D position) {
/**
* Creates an entity
* @param factory The entity factory
+ * @return The added entity
*/
public abstract Entity addEntity(EntityFactory factory);
/**
* Creates an entity that holds an item
+ * @param position The position to add the item to
* @param item The item
+ * @return The added entity
*/
public abstract Entity addEntity(Vector3D position, Item item);
/**
* Creates an entity only on the client side.
* For example, particle effects.
+ *
+ * TODO: Replace this with an actual particle system.
+ *
+ * @param factory The entity factory
+ * @return The added entity
*/
public abstract Entity addClientEntity(EntityFactory factory);
/**
* Creates an entity only on the client side.
* For example, particle effects.
+ *
+ * TODO: Replace this with an actual particle system.
+ *
+ * @param The entity type
+ * @param entity The entity to add
+ * @return The added entity
*/
public abstract T addClientEntity(T entity);
/**
* Destroys an entity, removing it from the world.
+ *
+ * @param entity The entity to remove
*/
public abstract void removeEntity(Entity entity);
diff --git a/src/main/java/nova/internal/core/Game.java b/src/main/java/nova/internal/core/Game.java
index 68485291f..e2abc6b5d 100644
--- a/src/main/java/nova/internal/core/Game.java
+++ b/src/main/java/nova/internal/core/Game.java
@@ -75,15 +75,11 @@ public class Game {
/**
* The synchronized ticker that uses the same thread as the game.
- *
- * This is @deprecated, use syncTicker() instead.
*/
private final UpdateTicker.SynchronizedTicker syncTicker;
/**
* The thread ticker that runs on NOVA's thread.
- *
- * This is @deprecated, use threadTicker() instead.
*/
private final UpdateTicker.ThreadTicker threadTicker;
@@ -224,6 +220,11 @@ public static FluidManager fluids() {
/**
* The synchronized ticker that uses the same thread as the game.
+ *
+ * @return The synchronous game ticker, which is synchronized
+ * with the game’s tick speed.
+ *
+ * For Minecraft, this is 20hz.
*/
public static UpdateTicker.SynchronizedTicker syncTicker() {
return instance.syncTicker;
@@ -231,6 +232,9 @@ public static UpdateTicker.SynchronizedTicker syncTicker() {
/**
* The thread ticker that runs on NOVA's thread.
+ *
+ * @return The asynchronous NOVA ticker,
+ * which runs as fast as possible.
*/
public static UpdateTicker.ThreadTicker threadTicker() {
return instance.threadTicker;
diff --git a/src/main/java/nova/internal/core/di/DICoreModule.java b/src/main/java/nova/internal/core/di/DICoreModule.java
index 0ecefbfc9..fb8a77d82 100644
--- a/src/main/java/nova/internal/core/di/DICoreModule.java
+++ b/src/main/java/nova/internal/core/di/DICoreModule.java
@@ -25,13 +25,9 @@
import java.util.function.Supplier;
public class DICoreModule extends BinderModule {
-
-
@Override
protected void declare() {
-
//install(BuildinBundle.PROVIDER); //To allow injection of providers
- starbind(Supplier.class).to(new SupplierSupplier());
+ starbind(Supplier.class).to(new SupplierModule.SupplierSupplier());
}
-
}
diff --git a/src/main/java/nova/internal/core/di/SupplierModule.java b/src/main/java/nova/internal/core/di/SupplierModule.java
index 8887984b0..0ebcd1b89 100644
--- a/src/main/java/nova/internal/core/di/SupplierModule.java
+++ b/src/main/java/nova/internal/core/di/SupplierModule.java
@@ -16,7 +16,9 @@
*
* You should have received a copy of the GNU General Public License
* along with NOVA. If not, see .
- */package nova.internal.core.di;
+ */
+
+package nova.internal.core.di;
import se.jbee.inject.Dependency;
import se.jbee.inject.Injector;
@@ -25,20 +27,28 @@
import static se.jbee.inject.util.ToString.describe;
-final class SupplierSupplier implements Supplier> {
+/**
+ * A dummy class containing the {@link SupplierSupplier} to match
+ * the rest of the NOVA Dependency Injection setup.
+ *
+ * @author ExE Boss
+ */
+public final class SupplierModule {
- @Override
- public java.util.function.Supplier> supply( Dependency super java.util.function.Supplier>> dependency, Injector injector ) {
- Dependency> providedType = dependency.onTypeParameter();
- if ( !dependency.getName().isDefault() ) {
- providedType = providedType.named( dependency.getName() );
+ public static final class SupplierSupplier implements Supplier> {
+ @Override
+ public java.util.function.Supplier> supply(Dependency super java.util.function.Supplier>> dependency, Injector injector) {
+ Dependency> providedType = dependency.onTypeParameter();
+ if (!dependency.getName().isDefault()) {
+ providedType = providedType.named(dependency.getName());
+ }
+ final Dependency> finalProvidedType = providedType;
+ return () -> SuppliedBy.lazyProvider(finalProvidedType.uninject().ignoredExpiry(), injector).provide();
}
- final Dependency> finalProvidedType = providedType;
- return () -> SuppliedBy.lazyProvider(finalProvidedType.uninject().ignoredExpiry(), injector).provide();
- }
- @Override
- public String toString() {
- return describe( "supplies", java.util.function.Supplier.class );
+ @Override
+ public String toString() {
+ return describe("supplies", java.util.function.Supplier.class);
+ }
}
}
diff --git a/src/main/java/nova/internal/core/launch/InitializationException.java b/src/main/java/nova/internal/core/launch/InitializationException.java
index 5c5676315..abc80a853 100644
--- a/src/main/java/nova/internal/core/launch/InitializationException.java
+++ b/src/main/java/nova/internal/core/launch/InitializationException.java
@@ -21,6 +21,8 @@
import nova.core.util.exception.NovaException;
public class InitializationException extends NovaException {
+ private static final long serialVersionUID = 1L;
+
public InitializationException() {
super();
}
diff --git a/src/main/java/nova/internal/core/util/InjectionUtil.java b/src/main/java/nova/internal/core/util/InjectionUtil.java
index 2340f891a..3deaea4ad 100644
--- a/src/main/java/nova/internal/core/util/InjectionUtil.java
+++ b/src/main/java/nova/internal/core/util/InjectionUtil.java
@@ -185,9 +185,9 @@ public static T newInstance(Class classToConstruct, boolean printStackTra
* @param The object type
* @param classToConstruct The class to construct
* @return A new instance of the class
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws InvocationTargetException
+ * @throws InstantiationException If an {@link InstantiationException} occurs
+ * @throws IllegalAccessException If an {@link IllegalAccessException} occurs
+ * @throws InvocationTargetException If an {@link InvocationTargetException} occurs
* @see Constructor#newInstance(java.lang.Object...)
*/
@SuppressWarnings("unchecked")
@@ -204,9 +204,9 @@ public static T newInstanceOrThrow(Class classToConstruct) throws Instant
* @param classToConstruct The class to construct
* @param mapping Custom DI mapping
* @return A new instance of the class
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws InvocationTargetException
+ * @throws InstantiationException If an {@link InstantiationException} occurs
+ * @throws IllegalAccessException If an {@link IllegalAccessException} occurs
+ * @throws InvocationTargetException If an {@link InvocationTargetException} occurs
* @see Constructor#newInstance(java.lang.Object...)
*/
@SuppressWarnings("unchecked")
diff --git a/src/main/java/nova/internal/core/util/TopologicalSort.java b/src/main/java/nova/internal/core/util/TopologicalSort.java
index e1c65c78a..d6abcffe9 100644
--- a/src/main/java/nova/internal/core/util/TopologicalSort.java
+++ b/src/main/java/nova/internal/core/util/TopologicalSort.java
@@ -21,7 +21,8 @@ public class TopologicalSort {
* Sort the input graph into a topologically sorted list
*
* Uses the reverse depth first search as outlined in ...
- * @param graph
+ * @param The type
+ * @param graph The graph to sort
* @return The sorted list.
*/
public static List topologicalSort(DirectedGraph graph) {
@@ -64,6 +65,7 @@ public static void explore(T node, DirectedGraph graph, List sortedRes
}
throw new NovaException("There was a cycle detected in the input graph, sorting is not possible", node) {
+ private static final long serialVersionUID = 1L;
};
}
From add94f587b0051cdf6197d21115fbad7bacef5c8 Mon Sep 17 00:00:00 2001
From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
Date: Sat, 23 Jun 2018 09:30:00 +0200
Subject: [PATCH 2/3] =?UTF-8?q?Fix=20compiler=20warnings=20in=20NOVA?=
=?UTF-8?q?=E2=80=91Core=E2=80=91Wrapper=E2=80=91MC1.8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mc/forge/v18/asm/StaticForwarder.java | 8 ++---
.../mc/forge/v18/asm/lib/ASMHelper.java | 6 ++--
.../v18/asm/lib/ClassHeirachyManager.java | 4 +--
.../forge/v18/asm/lib/ComponentInjector.java | 2 +-
.../mc/forge/v18/asm/lib/InsnListPrinter.java | 1 +
.../mc/forge/v18/asm/lib/ObfMapping.java | 2 ++
.../forge/v18/asm/lib/TemplateInjector.java | 6 ++--
.../mc/forge/v18/launcher/ClientProxy.java | 34 +++++++-----------
.../mc/forge/v18/launcher/FMLProgressBar.java | 7 ++--
.../mc/forge/v18/launcher/ForgeLoadable.java | 16 ++++++++-
.../mc/forge/v18/launcher/NovaMinecraft.java | 36 ++++++++++++-------
.../mc/forge/v18/util/ReflectionUtil.java | 6 ++--
.../v18/wrapper/block/BlockConverter.java | 2 +-
.../v18/wrapper/block/world/BWWorld.java | 4 +--
.../mc/forge/v18/wrapper/item/FWItem.java | 5 +--
.../forge/v18/wrapper/item/FWItemBlock.java | 5 +--
.../v18/wrapper/item/FWNBTTagCompound.java | 3 +-
.../forge/v18/wrapper/item/ItemConverter.java | 8 ++++-
.../v18/wrapper/item/ItemWrapperMethods.java | 14 +++++---
.../mc/forge/v18/wrapper/render/BWModel.java | 3 ++
.../v18/wrapper/render/FWSmartBlockModel.java | 11 +++---
.../v18/wrapper/render/FWSmartItemModel.java | 15 ++++----
.../v18/wrapper/render/FWSmartModel.java | 6 ++--
.../wrapper/render/backward/BWBakedModel.java | 7 ++--
24 files changed, 126 insertions(+), 85 deletions(-)
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/StaticForwarder.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/StaticForwarder.java
index 8f814952b..7b097d675 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/StaticForwarder.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/StaticForwarder.java
@@ -79,10 +79,10 @@ public static void chunkSetBlockEvent(Chunk chunk, BlockPos pos, IBlockState old
/**
* Used to inject forwarded TileEntites
- * @param data
- * @param clazz
- * @return
- * @throws Exception
+ * @param data The TileEntity data
+ * @param clazz The TileEntity class
+ * @return The new TileEntity instance
+ * @throws Exception If an exception occurred
*/
public static TileEntity loadTileEntityHook(NBTTagCompound data, Class extends TileEntity> clazz) throws Exception {
if (FWTile.class.isAssignableFrom(clazz)) {
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ASMHelper.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ASMHelper.java
index da08b6d3b..4772928ba 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ASMHelper.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ASMHelper.java
@@ -64,8 +64,8 @@ public class ASMHelper {
static {
try {
- defineClass1 = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, byte[].class, int.class, int.class });
- defineClass2 = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, byte[].class, int.class, int.class, ProtectionDomain.class });
+ defineClass1 = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
+ defineClass2 = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -314,6 +314,7 @@ public static Class defineClass(ClassNode cn, int flags) {
try {
byte[] bytes = createBytes(cn, flags);
defineClass1.setAccessible(true);
+ @SuppressWarnings("unchecked")
Class clazz = (Class) defineClass1.invoke(Thread.currentThread().getContextClassLoader(), cn.name.replaceAll("/", "."), bytes, 0, bytes.length);
defineClass1.setAccessible(false);
return clazz;
@@ -329,6 +330,7 @@ public static Class defineClass(ClassNode cn, int flags, ProtectionDomain
try {
byte[] bytes = createBytes(cn, flags);
defineClass2.setAccessible(true);
+ @SuppressWarnings("unchecked")
Class clazz = (Class) defineClass2.invoke(Thread.currentThread().getContextClassLoader(), cn.name.replaceAll("/", "."), bytes, 0, bytes.length, domain);
defineClass2.setAccessible(false);
return clazz;
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ClassHeirachyManager.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ClassHeirachyManager.java
index f3c50cba2..a1a2e4008 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ClassHeirachyManager.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ClassHeirachyManager.java
@@ -59,10 +59,10 @@ public static String unKey(String name) {
}
/**
- * Returns true if clazz extends, either directly or indirectly, superclass.
+ * Returns true if the class extends, either directly or indirectly, the superclass.
* @param name The class in question
* @param superclass The class being extended
- * @return
+ * @return If the class extends or not
*/
public static boolean classExtends(String name, String superclass) {
name = toKey(name);
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ComponentInjector.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ComponentInjector.java
index ff63f377e..1fd3a1bb3 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ComponentInjector.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ComponentInjector.java
@@ -46,7 +46,7 @@
* The ComponentInjector is capable of creating dynamic classes that implement a
* specified super class and implement the interfaces specified by
* {@link Component} and {@link Passthrough}.
- * @param
+ * @param The component type
* @author Vic Nightfall
*/
public class ComponentInjector implements Opcodes {
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/InsnListPrinter.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/InsnListPrinter.java
index 2de57f630..53227aa5c 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/InsnListPrinter.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/InsnListPrinter.java
@@ -123,6 +123,7 @@ public void visitInsn(AbstractInsnNode insn) {
_visitInsn(insn);
}
+ @SuppressWarnings("deprecation")
private void _visitInsn(AbstractInsnNode insn) {
switch (insn.getType()) {
case 0:
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ObfMapping.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ObfMapping.java
index 164afd384..6aac4be25 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ObfMapping.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/ObfMapping.java
@@ -118,6 +118,7 @@ public boolean matches(MethodInsnNode node) {
return s_owner.equals(node.owner) && s_name.equals(node.name) && s_desc.equals(node.desc);
}
+ @SuppressWarnings("deprecation")
public AbstractInsnNode toInsn(int opcode) {
if (isClass()) {
return new TypeInsnNode(opcode, s_owner);
@@ -132,6 +133,7 @@ public void visitTypeInsn(MethodVisitor mv, int opcode) {
mv.visitTypeInsn(opcode, s_owner);
}
+ @SuppressWarnings("deprecation")
public void visitMethodInsn(MethodVisitor mv, int opcode) {
mv.visitMethodInsn(opcode, s_owner, s_name, s_desc);
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/TemplateInjector.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/TemplateInjector.java
index d06fe6e8a..4c79fa9d7 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/TemplateInjector.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/asm/lib/TemplateInjector.java
@@ -44,7 +44,7 @@ public class TemplateInjector {
* @param className - Class that will be injected
* @param template - Default interface used as a template to inject in the templateName
*/
- public void registerTemplate(String className, Class template) {
+ public void registerTemplate(String className, Class> template) {
templates.put(className, new InjectionTemplate(template.getName()));
}
@@ -83,8 +83,8 @@ public InjectionTemplate(String templateName) {
/**
* Patches the cnode withPriority the methods from this template.
- * @param cnode
- * @return
+ * @param cnode The ClassNode instance
+ * @return If the class node was modified
*/
public boolean inject(ClassNode cnode) {
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ClientProxy.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ClientProxy.java
index e647cdef3..2d5b7a8a2 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ClientProxy.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ClientProxy.java
@@ -23,20 +23,17 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.particle.EntityFX;
-import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.Language;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
-import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import nova.core.entity.Entity;
@@ -82,8 +79,9 @@ public void init(FMLInitializationEvent evt) {
@SuppressWarnings({"unchecked", "deprecation"})
public void loadLanguage(LanguageManager languageManager) {
super.loadLanguage(languageManager);
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Loading NOVA language files",
- NovaMinecraftPreloader.novaResourcePacks.size() + 1);
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar =
+ net.minecraftforge.fml.common.ProgressManager.push("Loading NOVA language files",
+ NovaMinecraftPreloader.novaResourcePacks.size() + 1);
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
fmlProgressBar.step("nova");
SortedSet languages = Minecraft.getMinecraft().getLanguageManager().getLanguages();
@@ -116,7 +114,7 @@ public void loadLanguage(LanguageManager languageManager) {
});
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
}
private void loadLanguage(LanguageManager languageManager, String langName, InputStream stream) {
@@ -133,14 +131,10 @@ public void registerItem(FWItem item) {
super.registerItem(item);
//Hacks to inject custom item definition
- ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
- @Override
- public ModelResourceLocation getModelLocation(ItemStack stack) {
- ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(item);
- return new ModelResourceLocation(itemRL, "inventory");
- }
- }
- );
+ ModelLoader.setCustomMeshDefinition(item, stack -> {
+ ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(item);
+ return new ModelResourceLocation(itemRL, "inventory");
+ });
}
@Override
@@ -150,14 +144,10 @@ public void postRegisterBlock(FWBlock block) {
//Hack to inject custom itemblock definition
Item itemFromBlock = Item.getItemFromBlock(block);
- ModelLoader.setCustomMeshDefinition(itemFromBlock, new ItemMeshDefinition() {
- @Override
- public ModelResourceLocation getModelLocation(ItemStack stack) {
- ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(itemFromBlock);
- return new ModelResourceLocation(itemRL, "inventory");
- }
- }
- );
+ ModelLoader.setCustomMeshDefinition(itemFromBlock, stack -> {
+ ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(itemFromBlock);
+ return new ModelResourceLocation(itemRL, "inventory");
+ });
}
@Override
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/FMLProgressBar.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/FMLProgressBar.java
index 1927fc6cf..345b1daeb 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/FMLProgressBar.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/FMLProgressBar.java
@@ -20,7 +20,6 @@
package nova.core.wrapper.mc.forge.v18.launcher;
-import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
import nova.core.util.AbstractProgressBar;
/**
@@ -30,9 +29,11 @@
*/
public class FMLProgressBar extends AbstractProgressBar {
- private final ProgressBar progressBar;
+ @SuppressWarnings("deprecation")
+ private final net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar;
- public FMLProgressBar(ProgressBar progressBar) {
+ public FMLProgressBar(@SuppressWarnings("deprecation")
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar) {
this.progressBar = progressBar;
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ForgeLoadable.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ForgeLoadable.java
index a76ddcbe7..d0c365319 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ForgeLoadable.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/ForgeLoadable.java
@@ -29,15 +29,29 @@
*
* @author ExE Boss
*/
-// TODO Maybe replace with wrapper events.
public interface ForgeLoadable {
+ /**
+ * Pre‑initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge pre-initialization event
+ */
default void preInit(FMLPreInitializationEvent evt) {
}
+ /**
+ * Initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge initialization event
+ */
default void init(FMLInitializationEvent evt) {
}
+ /**
+ * Post-initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge post-initialization event
+ */
default void postInit(FMLPostInitializationEvent evt) {
}
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/NovaMinecraft.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/NovaMinecraft.java
index cec978b33..b0867754c 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/NovaMinecraft.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/launcher/NovaMinecraft.java
@@ -20,11 +20,9 @@
package nova.core.wrapper.mc.forge.v18.launcher;
-import com.typesafe.config.Config;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@@ -36,7 +34,6 @@
import nova.core.config.Configuration;
import nova.core.deps.MavenDependency;
import nova.core.event.ServerEvent;
-import nova.core.event.bus.GlobalEvents;
import nova.core.wrapper.mc.forge.v18.NovaMinecraftPreloader;
import nova.core.wrapper.mc.forge.v18.depmodules.ClientModule;
import nova.core.wrapper.mc.forge.v18.depmodules.ComponentModule;
@@ -69,7 +66,6 @@
import java.io.File;
import java.util.HashSet;
import java.util.List;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -78,7 +74,7 @@
* @author Calclavia
*/
@Mod(modid = NovaMinecraft.id, name = NovaMinecraft.name, version = NovaMinecraftPreloader.version, acceptableRemoteVersions = "*")
-public class NovaMinecraft {
+public class NovaMinecraft implements ForgeLoadable {
public static final String id = "nova";
public static final String name = "NOVA";
@@ -102,8 +98,12 @@ public static void registerWrapper(ForgeLoadable wrapper) {
* ORDER OF LOADING.
*
* 1. Native Loaders 2. Native Converters 3. Mods
+ *
+ * @param evt {@inheritDoc}
*/
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void preInit(FMLPreInitializationEvent evt) {
try {
/**
@@ -163,9 +163,10 @@ public void preInit(FMLPreInitializationEvent evt) {
e.printStackTrace();
}
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Loading NOVA mods", modClasses.isEmpty() ? 1 : modClasses.size());
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar
+ = net.minecraftforge.fml.common.ProgressManager.push("Loading NOVA mods", modClasses.isEmpty() ? 1 : modClasses.size());
launcher.load(new FMLProgressBar(progressBar));
- ProgressManager.pop(progressBar);
+ net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
novaModWrappers = launcher.getOrdererdMods().stream().filter(mod -> mod instanceof ForgeLoadable).map(mod -> (ForgeLoadable) mod).collect(Collectors.toList());
novaWrappers.removeAll(novaModWrappers);
@@ -187,7 +188,8 @@ public void preInit(FMLPreInitializationEvent evt) {
Game.entities().init();
//Load preInit
- progressBar = ProgressManager.push("Pre-initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ progressBar = net.minecraftforge.fml.common.ProgressManager.push("Pre-initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -198,7 +200,7 @@ public void preInit(FMLPreInitializationEvent evt) {
wrapper.preInit(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
proxy.preInit(evt);
@@ -216,11 +218,15 @@ public void preInit(FMLPreInitializationEvent evt) {
}
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void init(FMLInitializationEvent evt) {
try {
proxy.init(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar
+ = net.minecraftforge.fml.common.ProgressManager.push("Initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -231,7 +237,7 @@ public void init(FMLInitializationEvent evt) {
wrapper.init(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during init", e);
e.printStackTrace();
@@ -240,12 +246,16 @@ public void init(FMLInitializationEvent evt) {
}
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void postInit(FMLPostInitializationEvent evt) {
try {
proxy.postInit(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.postInit(evt));
Game.recipes().init();
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Post-initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar progressBar
+ = net.minecraftforge.fml.common.ProgressManager.push("Post-initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -256,7 +266,7 @@ public void postInit(FMLPostInitializationEvent evt) {
wrapper.postInit(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ net.minecraftforge.fml.common.ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during postInit", e);
e.printStackTrace();
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/util/ReflectionUtil.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/util/ReflectionUtil.java
index 420b96808..d526afb11 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/util/ReflectionUtil.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/util/ReflectionUtil.java
@@ -57,6 +57,7 @@
* adjustment - as such, those have been collected here.
* @author Stan Hebben
*/
+@SuppressWarnings("unchecked")
public class ReflectionUtil {
private static final Field NBTTAGLIST_TAGLIST;
private static final Field OREDICTIONARY_IDTOSTACK;
@@ -129,6 +130,7 @@ public static List getTagList(NBTTagList list) {
}
}
+ @SuppressWarnings("rawtypes")
public static List getSeeds() {
return getPrivateStaticObject(ForgeHooks.class, "seedList");
}
@@ -137,7 +139,7 @@ public static Map getChestLoot() {
return getPrivateStaticObject(ChestGenHooks.class, "chestInfo");
}
- public static Map getTranslations() {
+ public static Map getTranslations() {
return getPrivateObject(
getPrivateStaticObject(StatCollector.class, "localizedName", "field_74839_a"),
"languageList",
@@ -308,7 +310,7 @@ public static boolean setPrivateObject(Object object, Object value, String... na
// ### Private Methods ###
// #######################
- private static Field getField(Class cls, String... names) {
+ private static Field getField(Class> cls, String... names) {
for (String name : names) {
try {
Field field = cls.getDeclaredField(name);
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/BlockConverter.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/BlockConverter.java
index f40bef205..c85731b92 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/BlockConverter.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/BlockConverter.java
@@ -97,7 +97,7 @@ public net.minecraft.block.Block toNative(BlockFactory blockFactory) {
/**
* Register all Nova blocks
*
- * @param evt The Minecraft Forge pre-initialization event
+ * @param evt {@inheritDoc}
*/
@Override
public void preInit(FMLPreInitializationEvent evt) {
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/world/BWWorld.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/world/BWWorld.java
index 766fbac7e..b0695e41a 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/world/BWWorld.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/block/world/BWWorld.java
@@ -129,8 +129,8 @@ public Entity addClientEntity(EntityFactory factory) {
@Override
@SuppressWarnings("unchecked")
- public Entity addClientEntity(Entity entity) {
- return NovaMinecraft.proxy.spawnParticle(world(), entity);
+ public T addClientEntity(T entity) {
+ return (T) NovaMinecraft.proxy.spawnParticle(world(), entity);
}
@Override
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItem.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItem.java
index 98959ee54..9112cc6ec 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItem.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItem.java
@@ -47,8 +47,9 @@ public ItemFactory getItemFactory() {
}
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
- ItemWrapperMethods.super.addInformation(itemStack, player, list, p_77624_4_);
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
+ ItemWrapperMethods.super.addInformation(itemStack, player, tooltip, advanced);
}
@Override
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItemBlock.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItemBlock.java
index 8c35f97e3..e6a57cdb4 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItemBlock.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWItemBlock.java
@@ -45,8 +45,9 @@ public ItemFactory getItemFactory() {
}
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
- ItemWrapperMethods.super.addInformation(itemStack, player, list, p_77624_4_);
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
+ ItemWrapperMethods.super.addInformation(itemStack, player, tooltip, advanced);
}
@Override
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWNBTTagCompound.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWNBTTagCompound.java
index 477ed78cc..c58f61be8 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWNBTTagCompound.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/FWNBTTagCompound.java
@@ -41,9 +41,10 @@ public Item getItem() {
}
@Override
+ @SuppressWarnings("unchecked")
public NBTBase copy() {
FWNBTTagCompound result = new FWNBTTagCompound(item);
- getKeySet().forEach(s -> result.setTag((String) s, getTag((String) s).copy()));
+ ((Iterable) getKeySet()).forEach(s -> result.setTag(s, getTag(s).copy()));
return result;
}
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemConverter.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemConverter.java
index c070f49f7..0b98d34ea 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemConverter.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemConverter.java
@@ -150,6 +150,10 @@ public ItemFactory get(MinecraftItemMapping minecraftItem) {
/**
* Saves NOVA item into a Minecraft ItemStack.
+ *
+ * @param itemStack the Minecraft ItemStack instance
+ * @param item The NOVA item.
+ * @return The updated ItemStack instance
*/
public ItemStack updateMCItemStack(ItemStack itemStack, Item item) {
itemStack.stackSize = item.count();
@@ -164,7 +168,9 @@ public ItemStack updateMCItemStack(ItemStack itemStack, Item item) {
}
/**
- * Register all Nova blocks
+ * Register all Nova items
+ *
+ * @param evt {@inheritDoc}
*/
@Override
public void preInit(FMLPreInitializationEvent evt) {
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemWrapperMethods.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemWrapperMethods.java
index 62434be0b..959634123 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemWrapperMethods.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/item/ItemWrapperMethods.java
@@ -27,7 +27,6 @@
import nova.core.item.ItemFactory;
import nova.core.util.Direction;
import nova.core.wrapper.mc.forge.v18.wrapper.entity.backward.BWEntity;
-import nova.internal.core.Game;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import java.util.List;
@@ -41,10 +40,17 @@ public interface ItemWrapperMethods {
ItemFactory getItemFactory();
- @SuppressWarnings({"unchecked", "rawtypes"})
- default void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ /**
+ * Allows items to add custom lines of information to the mouseover description
+ *
+ * @param itemStack The ItemStack instance
+ * @param player The player entity
+ * @param tooltip All lines to display in the Item's tooltip. This is a List of Strings.
+ * @param advanced Whether the setting "Advanced tooltips" is enabled
+ */
+ default void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
Item item = ItemConverter.instance().toNova(itemStack);
- item.setCount(itemStack.stackSize).events.publish(new Item.TooltipEvent(Optional.of(new BWEntity(player)), list));
+ item.setCount(itemStack.stackSize).events.publish(new Item.TooltipEvent(Optional.of(new BWEntity(player)), tooltip));
getItemFactory().save(item);
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/BWModel.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/BWModel.java
index d8abf65f4..c7dc41c87 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/BWModel.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/BWModel.java
@@ -42,6 +42,9 @@ public class BWModel extends MeshModel {
/**
* Completes this rendering for a block.
+ *
+ * @param blockAccess The {@link IBlockAccess} instance.
+ * @throws NullPointerException If {@code blockAccess} is {@code null}
*/
public void render(IBlockAccess blockAccess) {
render(Optional.of(blockAccess), Optional.empty());
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartBlockModel.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartBlockModel.java
index 0c9da02c2..4730e6ba0 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartBlockModel.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartBlockModel.java
@@ -22,8 +22,6 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
-import net.minecraft.client.renderer.block.model.ItemTransformVec3f;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.ISmartBlockModel;
@@ -63,9 +61,12 @@ public FWSmartBlockModel(Block block, Optional item) {
this.block = block;
this.item = item;
// Change the default transforms to the default full Block transforms
- this.itemCameraTransforms = new ItemCameraTransforms(
- new ItemTransformVec3f(new Vector3f(10, -45, 170), new Vector3f(0, 0.09375f, -0.171875f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person
- ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT);
+ this.itemCameraTransforms = new net.minecraft.client.renderer.block.model.ItemCameraTransforms(
+ new net.minecraft.client.renderer.block.model.ItemTransformVec3f(
+ new Vector3f(10, -45, 170), new Vector3f(0, 0.09375f, -0.171875f), new Vector3f(0.375f, 0.375f, 0.375f)), // Third Person
+ net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT,
+ net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT,
+ net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT);
}
//Block rendering
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartItemModel.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartItemModel.java
index 4c7108957..ee00f753c 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartItemModel.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartItemModel.java
@@ -21,8 +21,6 @@
package nova.core.wrapper.mc.forge.v18.wrapper.render;
import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
-import net.minecraft.client.renderer.block.model.ItemTransformVec3f;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.ISmartItemModel;
@@ -46,11 +44,14 @@ public FWSmartItemModel(Item item) {
super();
this.item = item;
// Change the default transforms to the default Item transforms
- this.itemCameraTransforms = new ItemCameraTransforms(
- new ItemTransformVec3f(new Vector3f(0, -90, 130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person
- new ItemTransformVec3f(new Vector3f(0, -135, 25/*-135/*-25*/), new Vector3f(0, 0.25f, 0.125f/*0.5f, 0.25f*/), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person
- ItemTransformVec3f.DEFAULT, // Head
- new ItemTransformVec3f(new Vector3f(-30, 135, 0), new Vector3f(), new Vector3f(1.6F, 1.6F, 1.6F))); // GUI
+ this.itemCameraTransforms = new net.minecraft.client.renderer.block.model.ItemCameraTransforms(
+ new net.minecraft.client.renderer.block.model.ItemTransformVec3f(
+ new Vector3f(0, -90, 130), new Vector3f(0, 1f / 24f, -2.75f / 16f), new Vector3f(0.9f, 0.9f, 0.9f)), // Third Person
+ new net.minecraft.client.renderer.block.model.ItemTransformVec3f(
+ new Vector3f(0, -135, 25/*-135/*-25*/), new Vector3f(0, 0.25f, 0.125f/*0.5f, 0.25f*/), new Vector3f(1.7f, 1.7f, 1.7f)), // First Person
+ net.minecraft.client.renderer.block.model.ItemTransformVec3f.DEFAULT, // Head
+ new net.minecraft.client.renderer.block.model.ItemTransformVec3f(
+ new Vector3f(-30, 135, 0), new Vector3f(), new Vector3f(1.6F, 1.6F, 1.6F))); // GUI
}
//Item rendering
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartModel.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartModel.java
index f69d0f247..03dc58fed 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartModel.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/FWSmartModel.java
@@ -23,7 +23,6 @@
import com.google.common.primitives.Ints;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -55,7 +54,8 @@ public abstract class FWSmartModel implements IFlexibleBakedModel {
protected final VertexFormat format;
// Default item transforms. Can be changed in subclasses.
@SuppressWarnings("deprecation")
- protected ItemCameraTransforms itemCameraTransforms = ItemCameraTransforms.DEFAULT;
+ protected net.minecraft.client.renderer.block.model.ItemCameraTransforms itemCameraTransforms
+ = net.minecraft.client.renderer.block.model.ItemCameraTransforms.DEFAULT;
protected FWSmartModel(VertexFormat format) {
this.format = format;
@@ -153,7 +153,7 @@ public TextureAtlasSprite getTexture() {
@Override
@SuppressWarnings("deprecation")
- public ItemCameraTransforms getItemCameraTransforms() {
+ public net.minecraft.client.renderer.block.model.ItemCameraTransforms getItemCameraTransforms() {
return itemCameraTransforms;
}
}
diff --git a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/backward/BWBakedModel.java b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/backward/BWBakedModel.java
index 38e89a224..2d3fc9781 100644
--- a/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/backward/BWBakedModel.java
+++ b/minecraft/1.8/src/main/java/nova/core/wrapper/mc/forge/v18/wrapper/render/backward/BWBakedModel.java
@@ -25,7 +25,6 @@
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
-import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import nova.core.render.Color;
@@ -59,16 +58,16 @@
public class BWBakedModel extends MeshModel {
@SuppressWarnings("deprecation")
- public final IBakedModel wrapped;
+ public final net.minecraft.client.resources.model.IBakedModel wrapped;
public final VertexFormat format;
- public BWBakedModel(@SuppressWarnings("deprecation") IBakedModel wrapped) {
+ public BWBakedModel(@SuppressWarnings("deprecation") net.minecraft.client.resources.model.IBakedModel wrapped) {
this(wrapped, DefaultVertexFormats.ITEM);
}
@SuppressWarnings("unchecked")
- public BWBakedModel(@SuppressWarnings("deprecation") IBakedModel wrapped, VertexFormat format) {
+ public BWBakedModel(@SuppressWarnings("deprecation") net.minecraft.client.resources.model.IBakedModel wrapped, VertexFormat format) {
this.wrapped = wrapped;
this.format = format;
this.matrix.translate(-0.5, -0.5, -0.5);
From bc6f1c9ecac6de5cc2ddd44c8f7e660ff6feb7bb Mon Sep 17 00:00:00 2001
From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
Date: Sat, 23 Jun 2018 10:30:00 +0200
Subject: [PATCH 3/3] =?UTF-8?q?Fix=20compiler=20warnings=20in=20NOVA?=
=?UTF-8?q?=E2=80=91Core=E2=80=91Wrapper=E2=80=91MC1.7.10?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mc/forge/v17/asm/StaticForwarder.java | 8 ++---
.../mc/forge/v17/asm/lib/ASMHelper.java | 8 +++--
.../v17/asm/lib/ClassHeirachyManager.java | 4 +--
.../forge/v17/asm/lib/ComponentInjector.java | 2 +-
.../mc/forge/v17/asm/lib/InsnListPrinter.java | 1 +
.../mc/forge/v17/asm/lib/ObfMapping.java | 2 ++
.../forge/v17/asm/lib/TemplateInjector.java | 6 ++--
.../mc/forge/v17/launcher/ClientProxy.java | 8 ++---
.../mc/forge/v17/launcher/FMLProgressBar.java | 7 ++--
.../mc/forge/v17/launcher/ForgeLoadable.java | 22 ++++++++++---
.../mc/forge/v17/launcher/NovaMinecraft.java | 33 +++++++++++++------
.../v17/manager/config/NovaGuiConfig.java | 3 +-
.../mc/forge/v17/util/ReflectionUtil.java | 6 ++--
.../v17/wrapper/block/BlockConverter.java | 2 +-
.../wrapper/block/forward/FWTileLoader.java | 4 +--
.../v17/wrapper/block/world/BWWorld.java | 4 +--
.../mc/forge/v17/wrapper/item/FWItem.java | 5 +--
.../forge/v17/wrapper/item/FWItemBlock.java | 5 +--
.../v17/wrapper/item/FWNBTTagCompound.java | 11 ++-----
.../forge/v17/wrapper/item/ItemConverter.java | 13 ++++++--
.../v17/wrapper/item/ItemWrapperMethods.java | 17 ++++++----
.../mc/forge/v17/wrapper/render/BWModel.java | 4 +++
.../v17/wrapper/DirectionConverterTest.java | 2 +-
23 files changed, 111 insertions(+), 66 deletions(-)
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/StaticForwarder.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/StaticForwarder.java
index 932c004db..f065f0124 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/StaticForwarder.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/StaticForwarder.java
@@ -75,10 +75,10 @@ public static void chunkSetBlockEvent(Chunk chunk, int x, int y, int z, Block ol
/**
* Used to inject forwarded TileEntites
- * @param data
- * @param clazz
- * @return
- * @throws Exception
+ * @param data The TileEntity data
+ * @param clazz The TileEntity class
+ * @return The new TileEntity instance
+ * @throws Exception If an exception occurred
*/
public static TileEntity loadTileEntityHook(NBTTagCompound data, Class extends TileEntity> clazz) throws Exception {
if (clazz.equals(FWTile.class)) {
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ASMHelper.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ASMHelper.java
index fbf351a39..4867340b9 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ASMHelper.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ASMHelper.java
@@ -64,8 +64,8 @@ public class ASMHelper {
static {
try {
- defineClass1 = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, byte[].class, int.class, int.class });
- defineClass2 = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, byte[].class, int.class, int.class, ProtectionDomain.class });
+ defineClass1 = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
+ defineClass2 = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -135,7 +135,7 @@ public static byte[] injectMethods(String name, byte[] bytes, Multimap callNodes;
if (injector.before) {
@@ -314,6 +314,7 @@ public static Class defineClass(ClassNode cn, int flags) {
try {
byte[] bytes = createBytes(cn, flags);
defineClass1.setAccessible(true);
+ @SuppressWarnings("unchecked")
Class clazz = (Class) defineClass1.invoke(Thread.currentThread().getContextClassLoader(), cn.name.replaceAll("/", "."), bytes, 0, bytes.length);
defineClass1.setAccessible(false);
return clazz;
@@ -329,6 +330,7 @@ public static Class defineClass(ClassNode cn, int flags, ProtectionDomain
try {
byte[] bytes = createBytes(cn, flags);
defineClass2.setAccessible(true);
+ @SuppressWarnings("unchecked")
Class clazz = (Class) defineClass2.invoke(Thread.currentThread().getContextClassLoader(), cn.name.replaceAll("/", "."), bytes, 0, bytes.length, domain);
defineClass2.setAccessible(false);
return clazz;
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ClassHeirachyManager.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ClassHeirachyManager.java
index b384852ba..0452ab788 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ClassHeirachyManager.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ClassHeirachyManager.java
@@ -59,10 +59,10 @@ public static String unKey(String name) {
}
/**
- * Returns true if clazz extends, either directly or indirectly, superclass.
+ * Returns true if the class extends, either directly or indirectly, the superclass.
* @param name The class in question
* @param superclass The class being extended
- * @return
+ * @return If the class extends or not
*/
public static boolean classExtends(String name, String superclass) {
name = toKey(name);
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ComponentInjector.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ComponentInjector.java
index 3ce2b8c00..d1e1ff1c7 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ComponentInjector.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ComponentInjector.java
@@ -46,7 +46,7 @@
* The ComponentInjector is capable of creating dynamic classes that implement a
* specified super class and implement the interfaces specified by
* {@link Component} and {@link Passthrough}.
- * @param
+ * @param The component type
* @author Vic Nightfall
*/
public class ComponentInjector implements Opcodes {
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/InsnListPrinter.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/InsnListPrinter.java
index 5add25c87..b6efb352d 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/InsnListPrinter.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/InsnListPrinter.java
@@ -123,6 +123,7 @@ public void visitInsn(AbstractInsnNode insn) {
_visitInsn(insn);
}
+ @SuppressWarnings("deprecation")
private void _visitInsn(AbstractInsnNode insn) {
switch (insn.getType()) {
case 0:
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ObfMapping.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ObfMapping.java
index 95ce7466e..3b09d749c 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ObfMapping.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/ObfMapping.java
@@ -118,6 +118,7 @@ public boolean matches(MethodInsnNode node) {
return s_owner.equals(node.owner) && s_name.equals(node.name) && s_desc.equals(node.desc);
}
+ @SuppressWarnings("deprecation")
public AbstractInsnNode toInsn(int opcode) {
if (isClass()) {
return new TypeInsnNode(opcode, s_owner);
@@ -132,6 +133,7 @@ public void visitTypeInsn(MethodVisitor mv, int opcode) {
mv.visitTypeInsn(opcode, s_owner);
}
+ @SuppressWarnings("deprecation")
public void visitMethodInsn(MethodVisitor mv, int opcode) {
mv.visitMethodInsn(opcode, s_owner, s_name, s_desc);
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/TemplateInjector.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/TemplateInjector.java
index a68b466c0..ca5696979 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/TemplateInjector.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/asm/lib/TemplateInjector.java
@@ -44,7 +44,7 @@ public class TemplateInjector {
* @param className - Class that will be injected
* @param template - Default interface used as a template to inject in the templateName
*/
- public void registerTemplate(String className, Class template) {
+ public void registerTemplate(String className, Class> template) {
templates.put(className, new InjectionTemplate(template.getName()));
}
@@ -83,8 +83,8 @@ public InjectionTemplate(String templateName) {
/**
* Patches the cnode withPriority the methods from this template.
- * @param cnode
- * @return
+ * @param cnode The ClassNode instance
+ * @return If the class node was modified
*/
public boolean inject(ClassNode cnode) {
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ClientProxy.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ClientProxy.java
index e282016a5..651a5a549 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ClientProxy.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ClientProxy.java
@@ -23,7 +23,6 @@
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
-import cpw.mods.fml.common.ProgressManager;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@@ -73,8 +72,9 @@ public void preInit(FMLPreInitializationEvent evt) {
@SuppressWarnings({"unchecked", "deprecation"})
public void loadLanguage(LanguageManager languageManager) {
super.loadLanguage(languageManager);
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Loading NOVA language files",
- NovaMinecraftPreloader.novaResourcePacks.size() + 1);
+ cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
+ = cpw.mods.fml.common.ProgressManager.push("Loading NOVA language files",
+ NovaMinecraftPreloader.novaResourcePacks.size() + 1);
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
fmlProgressBar.step("nova");
SortedSet languages = Minecraft.getMinecraft().getLanguageManager().getLanguages();
@@ -107,7 +107,7 @@ public void loadLanguage(LanguageManager languageManager) {
});
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ cpw.mods.fml.common.ProgressManager.pop(progressBar);
}
private void loadLanguage(LanguageManager languageManager, String langName, InputStream stream) {
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/FMLProgressBar.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/FMLProgressBar.java
index 92418942a..44ca91399 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/FMLProgressBar.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/FMLProgressBar.java
@@ -20,7 +20,6 @@
package nova.core.wrapper.mc.forge.v17.launcher;
-import cpw.mods.fml.common.ProgressManager.ProgressBar;
import nova.core.util.AbstractProgressBar;
/**
@@ -30,9 +29,11 @@
*/
public class FMLProgressBar extends AbstractProgressBar {
- private final ProgressBar progressBar;
+ @SuppressWarnings("deprecation")
+ private final cpw.mods.fml.common.ProgressManager.ProgressBar progressBar;
- public FMLProgressBar(ProgressBar progressBar) {
+ public FMLProgressBar(@SuppressWarnings("deprecation")
+ cpw.mods.fml.common.ProgressManager.ProgressBar progressBar) {
this.progressBar = progressBar;
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ForgeLoadable.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ForgeLoadable.java
index 599caf259..d902a29b9 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ForgeLoadable.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/ForgeLoadable.java
@@ -29,15 +29,29 @@
*
* @author ExE Boss
*/
-// TODO Maybe replace with wrapper events.
public interface ForgeLoadable {
- default void preInit(FMLPreInitializationEvent event) {
+ /**
+ * Pre‑initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge pre-initialization event
+ */
+ default void preInit(FMLPreInitializationEvent evt) {
}
- default void init(FMLInitializationEvent event) {
+ /**
+ * Initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge initialization event
+ */
+ default void init(FMLInitializationEvent evt) {
}
- default void postInit(FMLPostInitializationEvent event) {
+ /**
+ * Post-initialize the wrapper code.
+ *
+ * @param evt The Minecraft Forge post-initialization event
+ */
+ default void postInit(FMLPostInitializationEvent evt) {
}
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/NovaMinecraft.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/NovaMinecraft.java
index 3e9c4f72c..7c12c6db6 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/NovaMinecraft.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/launcher/NovaMinecraft.java
@@ -22,7 +22,6 @@
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
-import cpw.mods.fml.common.ProgressManager;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -74,7 +73,7 @@
* @author Calclavia
*/
@Mod(modid = NovaMinecraft.id, name = NovaMinecraft.name, version = NovaMinecraftPreloader.version, acceptableRemoteVersions = "*")
-public class NovaMinecraft {
+public class NovaMinecraft implements ForgeLoadable {
public static final String id = "nova";
public static final String name = "NOVA";
@@ -98,8 +97,12 @@ public static void registerWrapper(ForgeLoadable wrapper) {
* ORDER OF LOADING.
*
* 1. Native Loaders 2. Native Converters 3. Mods
+ *
+ * @param evt {@inheritDoc}
*/
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void preInit(FMLPreInitializationEvent evt) {
try {
/**
@@ -158,9 +161,10 @@ public void preInit(FMLPreInitializationEvent evt) {
e.printStackTrace();
}
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Loading NOVA mods", modClasses.isEmpty() ? 1 : modClasses.size());
+ cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
+ = cpw.mods.fml.common.ProgressManager.push("Loading NOVA mods", modClasses.isEmpty() ? 1 : modClasses.size());
launcher.load(new FMLProgressBar(progressBar));
- ProgressManager.pop(progressBar);
+ cpw.mods.fml.common.ProgressManager.pop(progressBar);
novaModWrappers = launcher.getOrdererdMods().stream().filter(mod -> mod instanceof ForgeLoadable).map(mod -> (ForgeLoadable) mod).collect(Collectors.toList());
novaWrappers.removeAll(novaModWrappers);
@@ -182,7 +186,8 @@ public void preInit(FMLPreInitializationEvent evt) {
Game.entities().init();
//Load preInit
- progressBar = ProgressManager.push("Pre-initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ progressBar = cpw.mods.fml.common.ProgressManager.push("Pre-initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -193,7 +198,7 @@ public void preInit(FMLPreInitializationEvent evt) {
wrapper.preInit(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ cpw.mods.fml.common.ProgressManager.pop(progressBar);
proxy.preInit(evt);
@@ -211,11 +216,15 @@ public void preInit(FMLPreInitializationEvent evt) {
}
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void init(FMLInitializationEvent evt) {
try {
proxy.init(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
+ = cpw.mods.fml.common.ProgressManager.push("Initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -226,7 +235,7 @@ public void init(FMLInitializationEvent evt) {
wrapper.init(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ cpw.mods.fml.common.ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during init", e);
e.printStackTrace();
@@ -235,12 +244,16 @@ public void init(FMLInitializationEvent evt) {
}
@Mod.EventHandler
+ @Override
+ @SuppressWarnings("deprecation")
public void postInit(FMLPostInitializationEvent evt) {
try {
proxy.postInit(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.postInit(evt));
Game.recipes().init();
- ProgressManager.ProgressBar progressBar = ProgressManager.push("Post-initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
+ cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
+ = cpw.mods.fml.common.ProgressManager.push("Post-initializing NOVA wrappers",
+ (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
@@ -251,7 +264,7 @@ public void postInit(FMLPostInitializationEvent evt) {
wrapper.postInit(evt);
});
fmlProgressBar.finish();
- ProgressManager.pop(progressBar);
+ cpw.mods.fml.common.ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during postInit", e);
e.printStackTrace();
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/manager/config/NovaGuiConfig.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/manager/config/NovaGuiConfig.java
index d995fddbc..a99877c7e 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/manager/config/NovaGuiConfig.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/manager/config/NovaGuiConfig.java
@@ -30,6 +30,7 @@
*/
public class NovaGuiConfig extends GuiConfig {
public NovaGuiConfig(GuiScreen parentScreen, Configuration config, String modID) {
- super(parentScreen, new ConfigElement(config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), modID, false, false, GuiConfig.getAbridgedConfigPath(config.toString()));
+ super(parentScreen, new ConfigElement<>(config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
+ modID, false, false, GuiConfig.getAbridgedConfigPath(config.toString()));
}
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/util/ReflectionUtil.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/util/ReflectionUtil.java
index a58f132de..b33de7543 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/util/ReflectionUtil.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/util/ReflectionUtil.java
@@ -57,6 +57,7 @@
* adjustment - as such, those have been collected here.
* @author Stan Hebben
*/
+@SuppressWarnings("unchecked")
public class ReflectionUtil {
private static final Field NBTTAGLIST_TAGLIST;
private static final Field OREDICTIONARY_IDTOSTACK;
@@ -129,6 +130,7 @@ public static List getTagList(NBTTagList list) {
}
}
+ @SuppressWarnings("rawtypes")
public static List getSeeds() {
return getPrivateStaticObject(ForgeHooks.class, "seedList");
}
@@ -137,7 +139,7 @@ public static Map getChestLoot() {
return getPrivateStaticObject(ChestGenHooks.class, "chestInfo");
}
- public static Map getTranslations() {
+ public static Map getTranslations() {
return getPrivateObject(
getPrivateStaticObject(StatCollector.class, "localizedName", "field_74839_a"),
"languageList",
@@ -308,7 +310,7 @@ public static boolean setPrivateObject(Object object, Object value, String... na
// ### Private Methods ###
// #######################
- private static Field getField(Class cls, String... names) {
+ private static Field getField(Class> cls, String... names) {
for (String name : names) {
try {
Field field = cls.getDeclaredField(name);
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/BlockConverter.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/BlockConverter.java
index 33f91ceeb..39c3276ab 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/BlockConverter.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/BlockConverter.java
@@ -97,7 +97,7 @@ public net.minecraft.block.Block toNative(BlockFactory blockFactory) {
/**
* Register all Nova blocks
*
- * @param evt The Minecraft Forge pre-initialization event
+ * @param evt {@inheritDoc}
*/
@Override
public void preInit(FMLPreInitializationEvent evt) {
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWTileLoader.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWTileLoader.java
index 8a25e7b0a..c76ec20c8 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWTileLoader.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/forward/FWTileLoader.java
@@ -43,7 +43,7 @@ public static FWTile loadTile(NBTTagCompound data) {
try {
String blockID = data.getString("novaID");
Block block = createBlock(blockID);
- FWTile tile = injector.inject(block, new Class[0], new Object[0]);
+ FWTile tile = injector.inject(block, new Class>[0], new Object[0]);
tile.setBlock(block);
WrapperEvent.FWTileCreate event = new WrapperEvent.FWTileCreate(block, tile);
Game.events().publish(event);
@@ -56,7 +56,7 @@ public static FWTile loadTile(NBTTagCompound data) {
public static FWTile loadTile(String blockID) {
try {
Block block = createBlock(blockID);
- FWTile tile = injector.inject(block, new Class[] { String.class }, new Object[] { blockID });
+ FWTile tile = injector.inject(block, new Class>[] { String.class }, new Object[] { blockID });
tile.setBlock(block);
WrapperEvent.FWTileCreate event = new WrapperEvent.FWTileCreate(block, tile);
Game.events().publish(event);
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/world/BWWorld.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/world/BWWorld.java
index 67945f0dc..311456757 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/world/BWWorld.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/block/world/BWWorld.java
@@ -121,8 +121,8 @@ public Entity addClientEntity(EntityFactory factory) {
@Override
@SuppressWarnings("unchecked")
- public Entity addClientEntity(Entity entity) {
- return NovaMinecraft.proxy.spawnParticle(world(), entity);
+ public T addClientEntity(T entity) {
+ return (T) NovaMinecraft.proxy.spawnParticle(world(), entity);
}
@Override
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItem.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItem.java
index 3fe40567e..4e515ef46 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItem.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItem.java
@@ -47,8 +47,9 @@ public ItemFactory getItemFactory() {
}
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
- ItemWrapperMethods.super.addInformation(itemStack, player, list, p_77624_4_);
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
+ ItemWrapperMethods.super.addInformation(itemStack, player, tooltip, advanced);
}
@Override
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItemBlock.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItemBlock.java
index 66ade96cd..ba7750ab8 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItemBlock.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWItemBlock.java
@@ -45,8 +45,9 @@ public ItemFactory getItemFactory() {
}
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
- ItemWrapperMethods.super.addInformation(itemStack, player, list, p_77624_4_);
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
+ ItemWrapperMethods.super.addInformation(itemStack, player, tooltip, advanced);
}
@Override
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWNBTTagCompound.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWNBTTagCompound.java
index 9bce8e09a..5b4fb7964 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWNBTTagCompound.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/FWNBTTagCompound.java
@@ -24,8 +24,6 @@
import net.minecraft.nbt.NBTTagCompound;
import nova.core.item.Item;
-import java.util.Iterator;
-
/**
* A wrapped NBTTagCompound object that references the item instance
* @author Stan
@@ -43,15 +41,10 @@ public Item getItem() {
}
@Override
+ @SuppressWarnings("unchecked")
public NBTBase copy() {
FWNBTTagCompound result = new FWNBTTagCompound(item);
- Iterator iterator = this.func_150296_c().iterator();
-
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
- result.setTag(s, getTag(s).copy());
- }
-
+ ((Iterable) func_150296_c()).forEach(s -> result.setTag(s, getTag(s).copy()));
return result;
}
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemConverter.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemConverter.java
index c37c9f7cd..384424462 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemConverter.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemConverter.java
@@ -149,8 +149,12 @@ public ItemFactory get(MinecraftItemMapping minecraftItem) {
/**
* Saves NOVA item into a Minecraft ItemStack.
+ *
+ * @param itemStack the Minecraft ItemStack instance
+ * @param item The NOVA item.
+ * @return The updated ItemStack instance
*/
- public net.minecraft.item.ItemStack updateMCItemStack(ItemStack itemStack, nova.core.item.Item item) {
+ public ItemStack updateMCItemStack(ItemStack itemStack, Item item) {
itemStack.stackSize = item.count();
if (itemStack.stackSize <= 0) {
return null;
@@ -162,7 +166,9 @@ public net.minecraft.item.ItemStack updateMCItemStack(ItemStack itemStack, nova.
}
/**
- * Register all Nova blocks
+ * Register all Nova items
+ *
+ * @param evt {@inheritDoc}
*/
@Override
public void preInit(FMLPreInitializationEvent evt) {
@@ -223,7 +229,8 @@ private void registerNOVAItem(ItemFactory itemFactory) {
}
private void registerMinecraftItemsToNOVA() {
- Set itemIDs = (Set) net.minecraft.item.Item.itemRegistry.getKeys();
+ @SuppressWarnings("unchecked")
+ Set itemIDs = net.minecraft.item.Item.itemRegistry.getKeys();
itemIDs.forEach(itemID -> {
net.minecraft.item.Item item = (net.minecraft.item.Item) net.minecraft.item.Item.itemRegistry.getObject(itemID);
registerMinecraftMapping(item, 0);
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemWrapperMethods.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemWrapperMethods.java
index 7d043b9ce..20e088877 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemWrapperMethods.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/item/ItemWrapperMethods.java
@@ -26,16 +26,12 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
-import nova.core.component.renderer.DynamicRenderer;
import nova.core.component.renderer.Renderer;
-import nova.core.component.renderer.StaticRenderer;
import nova.core.item.Item;
import nova.core.item.ItemFactory;
import nova.core.util.Direction;
-import nova.core.wrapper.mc.forge.v17.render.RenderUtility;
import nova.core.wrapper.mc.forge.v17.wrapper.entity.backward.BWEntity;
import nova.core.wrapper.mc.forge.v17.wrapper.render.BWModel;
-import nova.internal.core.Game;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -53,10 +49,17 @@ public interface ItemWrapperMethods extends IItemRenderer {
ItemFactory getItemFactory();
- @SuppressWarnings({"unchecked", "rawtypes"})
- default void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean p_77624_4_) {
+ /**
+ * Allows items to add custom lines of information to the mouseover description
+ *
+ * @param itemStack The ItemStack instance
+ * @param player The player entity
+ * @param tooltip All lines to display in the Item's tooltip. This is a List of Strings.
+ * @param advanced Whether the setting "Advanced tooltips" is enabled
+ */
+ default void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
Item item = ItemConverter.instance().toNova(itemStack);
- item.setCount(itemStack.stackSize).events.publish(new Item.TooltipEvent(Optional.of(new BWEntity(player)), list));
+ item.setCount(itemStack.stackSize).events.publish(new Item.TooltipEvent(Optional.of(new BWEntity(player)), tooltip));
getItemFactory().save(item);
}
diff --git a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/render/BWModel.java b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/render/BWModel.java
index a8cd9c070..84aeac31d 100644
--- a/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/render/BWModel.java
+++ b/minecraft/1.7/src/main/java/nova/core/wrapper/mc/forge/v17/wrapper/render/BWModel.java
@@ -37,12 +37,16 @@
import java.util.Optional;
/**
+ * BWModel for dynamic rendering
* @author Calclavia
*/
public class BWModel extends MeshModel {
/**
* Completes this rendering for a block.
+ *
+ * @param blockAccess The {@link IBlockAccess} instance.
+ * @throws NullPointerException If {@code blockAccess} is {@code null}
*/
public void render(IBlockAccess blockAccess) {
render(Optional.of(blockAccess), Optional.empty());
diff --git a/minecraft/1.7/src/test/java/nova/core/wrapper/mc/forge/v17/wrapper/DirectionConverterTest.java b/minecraft/1.7/src/test/java/nova/core/wrapper/mc/forge/v17/wrapper/DirectionConverterTest.java
index 0a08fa08f..232142c66 100644
--- a/minecraft/1.7/src/test/java/nova/core/wrapper/mc/forge/v17/wrapper/DirectionConverterTest.java
+++ b/minecraft/1.7/src/test/java/nova/core/wrapper/mc/forge/v17/wrapper/DirectionConverterTest.java
@@ -22,7 +22,6 @@
import net.minecraft.util.EnumFacing;
import nova.core.util.Direction;
-import nova.internal.core.Game;
import org.junit.Before;
import org.junit.Test;
@@ -60,6 +59,7 @@ public void testToNova() {
}
@Test
+ @SuppressWarnings("unchecked")
public void testToNative() {
assertThat(converter.toNative(Direction.DOWN)).isEqualTo(EnumFacing.DOWN);
assertThat(converter.toNative(Direction.UP)).isEqualTo(EnumFacing.UP);