mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 19:39:37 +00:00
Update buildscript & spotlessApply
This commit is contained in:
1 parent
e4329e2b8f
commit
8683a345c3
818 files changed
+51123
-49403
No files matched your search
@@ -3,6 +3,7 @@ package binnie.extratrees;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import java.lang.reflect.Constructor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -15,117 +16,113 @@ import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
public class FakeWorld extends World {
|
||||
public static FakeWorld instance = SilentObjectCreator.create(FakeWorld.class);
|
||||
public static FakeWorld instance = SilentObjectCreator.create(FakeWorld.class);
|
||||
|
||||
protected Block block;
|
||||
protected int metadata;
|
||||
protected TileEntity te;
|
||||
protected Block block;
|
||||
protected int metadata;
|
||||
protected TileEntity te;
|
||||
|
||||
//It is never called.
|
||||
private FakeWorld() {
|
||||
super(null, "", null, new WorldSettings(Long.MAX_VALUE, GameType.NOT_SET, false, false, WorldType.FLAT), null);
|
||||
}
|
||||
// It is never called.
|
||||
private FakeWorld() {
|
||||
super(null, "", null, new WorldSettings(Long.MAX_VALUE, GameType.NOT_SET, false, false, WorldType.FLAT), null);
|
||||
}
|
||||
|
||||
public ItemStack getWooLog() {
|
||||
if (te instanceof TileWood) {
|
||||
return TileWood.getPickBlock(block, this, 0, 0, 0);
|
||||
} else if (te instanceof TileEntityMetadata) {
|
||||
return new ItemStack(block, 1, ((TileEntityMetadata) te).getTileMetadata());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemStack getWooLog() {
|
||||
if (te instanceof TileWood) {
|
||||
return TileWood.getPickBlock(block, this, 0, 0, 0);
|
||||
} else if (te instanceof TileEntityMetadata) {
|
||||
return new ItemStack(block, 1, ((TileEntityMetadata) te).getTileMetadata());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, Block block) {
|
||||
this.block = block;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, Block block) {
|
||||
this.block = block;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, Block block, int metadata, int update) {
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
if (block.hasTileEntity(metadata)) {
|
||||
te = block.createTileEntity(this, metadata);
|
||||
} else {
|
||||
TileWood wood = new TileWood();
|
||||
wood.setWoodType(EnumWoodType.VALUES[metadata]);
|
||||
te = wood;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, Block block, int metadata, int update) {
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
if (block.hasTileEntity(metadata)) {
|
||||
te = block.createTileEntity(this, metadata);
|
||||
} else {
|
||||
TileWood wood = new TileWood();
|
||||
wood.setWoodType(EnumWoodType.VALUES[metadata]);
|
||||
te = wood;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlockToAir(int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean setBlockToAir(int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(int x, int y, int z) {
|
||||
return te;
|
||||
}
|
||||
@Override
|
||||
public TileEntity getTileEntity(int x, int y, int z) {
|
||||
return te;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTileEntity(int x, int y, int z, TileEntity tileEntity) {
|
||||
@Override
|
||||
public void setTileEntity(int x, int y, int z, TileEntity tileEntity) {}
|
||||
|
||||
}
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
return block != null ? block : Blocks.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
return block != null ? block : Blocks.air;
|
||||
}
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockMetadata(int x, int y, int z) {
|
||||
return metadata;
|
||||
}
|
||||
@Override
|
||||
public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int delay) {
|
||||
this.metadata = metadata;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int delay) {
|
||||
this.metadata = metadata;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected IChunkProvider createChunkProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IChunkProvider createChunkProvider() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected int func_152379_p() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int func_152379_p() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public Entity getEntityByID(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getEntityByID(int id) {
|
||||
return null;
|
||||
}
|
||||
public static class SilentObjectCreator {
|
||||
/**
|
||||
* Creating objects without calling constructors.
|
||||
*/
|
||||
public static <T> T create(Class<T> clazz) {
|
||||
return create(clazz, Object.class);
|
||||
}
|
||||
|
||||
public static class SilentObjectCreator {
|
||||
/**
|
||||
* Creating objects without calling constructors.
|
||||
*/
|
||||
public static <T> T create(Class<T> clazz) {
|
||||
return create(clazz, Object.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creating objects without calling constructors.
|
||||
*/
|
||||
public static <T> T create(Class<T> clazz, Class<? super T> parent) {
|
||||
try {
|
||||
ReflectionFactory rf = ReflectionFactory.getReflectionFactory();
|
||||
Constructor objDef = parent.getDeclaredConstructor();
|
||||
Constructor intConstr = rf.newConstructorForSerialization(clazz, objDef);
|
||||
return clazz.cast(intConstr.newInstance());
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Cannot create object", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creating objects without calling constructors.
|
||||
*/
|
||||
public static <T> T create(Class<T> clazz, Class<? super T> parent) {
|
||||
try {
|
||||
ReflectionFactory rf = ReflectionFactory.getReflectionFactory();
|
||||
Constructor objDef = parent.getDeclaredConstructor();
|
||||
Constructor intConstr = rf.newConstructorForSerialization(clazz, objDef);
|
||||
return clazz.cast(intConstr.newInstance());
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Cannot create object", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user