mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-10-27 14:53:33 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9432a6038 | ||
|
|
62fdfa7bc2 | ||
|
|
ad35b20f8c |
No files matched your search
@@ -89,6 +89,22 @@ public class ReflectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a field of the object {@code instance} of type {@code class1} to {@code value}.
|
||||
*
|
||||
* @deprecated According to {@link Class#getDeclaredFields()}, the array of fields has no defined order, therefore
|
||||
* selecting a field based on its index will result in JVM-specific behaviour. Use
|
||||
* {@link #setField(Class, Object, String, Object)} instead.
|
||||
*
|
||||
* @param class1 The class which defines the field in question.
|
||||
* @param instance The object being altered - must be an instance of {@code class1}
|
||||
* @param fieldindex The index of the field being set.
|
||||
* @param value The value to set the field to.
|
||||
* @throws IllegalArgumentException If {@code instance} is not an instance of {@code class1}, or if {@code value}
|
||||
* doesn't match the type of the field.
|
||||
* @throws IllegalAccessException If unable to write to the field.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setField(Class<?> class1, Object instance, int fieldindex, Object value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
Field field = class1.getDeclaredFields()[fieldindex];
|
||||
@@ -179,6 +195,21 @@ public class ReflectionManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a field of the object {@code instance} of type {@code class1}.
|
||||
*
|
||||
* @deprecated According to {@link Class#getDeclaredFields()}, the array of fields has no defined order, therefore
|
||||
* selecting a field based on its index will result in JVM-specific behaviour. Use
|
||||
* {@link #getField(Class, Class, Object, String)} instead.
|
||||
*
|
||||
* @param class1 The class which defines the field in question.
|
||||
* @param fieldType The type of the field being read.
|
||||
* @param instance The object being read from - must be an instance of {@code class1}
|
||||
* @param fieldIndex The index of the field being read.
|
||||
* @throws IllegalArgumentException If {@code instance} is not an instance of {@code class1}.
|
||||
* @throws IllegalAccessException If unable to read from the field.
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T getField(Class<?> class1, Class<T> fieldType, Object instance, int fieldIndex)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
Field field = class1.getDeclaredFields()[fieldIndex];
|
||||
|
||||
@@ -466,7 +466,7 @@ public final class PacketCustom implements MCDataInput, MCDataOutput {
|
||||
|
||||
public FluidStack readFluidStack() {
|
||||
Fluid fluid = FluidRegistry.getFluid(readShort());
|
||||
if (fluid == null) return null;
|
||||
if (fluid == null) fluid = FluidRegistry.WATER;
|
||||
|
||||
return new FluidStack(fluid, readVarInt(), readNBTTagCompound());
|
||||
}
|
||||
|
||||
@@ -55,10 +55,7 @@ public class WorldExtensionManager {
|
||||
public void onChunkUnLoad(ChunkEvent.Unload event) {
|
||||
if (event.getChunk() instanceof EmptyChunk) return;
|
||||
|
||||
WorldExtension[] extensions = worldMap.get(event.world);
|
||||
if (extensions == null) return;
|
||||
|
||||
for (WorldExtension extension : extensions) extension.unloadChunk(event.getChunk());
|
||||
for (WorldExtension extension : worldMap.get(event.world)) extension.unloadChunk(event.getChunk());
|
||||
|
||||
if (event.world.isRemote) removeChunk(event.world, event.getChunk());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user