Added to github

This commit is contained in:
avlad171 2019-11-15 10:48:21 +02:00
commit c68bf53923
61 changed files with 2127 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# Ender-Quarry-Mod

78
build.gradle Normal file
View File

@ -0,0 +1,78 @@
buildscript {
repositories {
jcenter()
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
version = "1.0.5"
group = "com.yourname.enderquarrymod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "enderquarrymod"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2824"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20171003"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G

View File

@ -0,0 +1,110 @@
package com.myuki69.enderquarry;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EnderMarker extends Block
{
public static int[] dx = { 0, 0, 1, -1 };
public static int[] dz = { 1, -1, 0, 0 };
public static final PropertyInteger META = PropertyInteger.create("meta", 0, 32);
protected static final AxisAlignedBB STANDING_AABB = new AxisAlignedBB(0.4000000059604645D, 0.0D, 0.4000000059604645D, 0.6000000238418579D, 0.8D, 0.6000000238418579D);
private static final String UNLOCALIZED_NAME = "endermarker";
public int meta;
public EnderMarker()
{
super(Material.ROCK);
this.setUnlocalizedName(UNLOCALIZED_NAME);
this.setRegistryName(UNLOCALIZED_NAME);
this.setDefaultState(this.blockState.getBaseState().withProperty(META, 0));
this.setTickRandomly(true);
this.setCreativeTab(CreativeTabs.REDSTONE);
this.setHardness(2.0F);
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return STANDING_AABB;
}
@Override
public boolean hasTileEntity(IBlockState state)
{
return true;
}
@Override
public TileEntity createTileEntity(World world, IBlockState state)
{
return new TileEnderMarker();
}
@Override
protected BlockStateContainer createBlockState ()
{
return new BlockStateContainer(this, new IProperty[] { META });
}
@Override
public int getMetaFromState (IBlockState state)
{
return 0;
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
meta = state.getValue(META);
//System.out.println("Meta = " + meta);
for (int i = 0; i < 4; i++)
{
if ((meta & 1 << i) != 0)
{
for (int l = 0; l < 3; l++)
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + dx[i] * rand.nextDouble() * rand.nextDouble(), pos.getY() + 0.5D, pos.getZ() + 0.5D + dz[i] * rand.nextDouble() * rand.nextDouble(), 0.501D, 0.0D, 1.0D);
}
}
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public boolean isOpaqueCube(IBlockState iState)
{
return false;
}
@Override
public boolean isFullCube(IBlockState iState)
{
return false;
}
}

View File

@ -0,0 +1,110 @@
package com.myuki69.enderquarry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EnderQuarry extends Block {
private static final String UNLOCALIZED_NAME = "enderquarry";
public EnderQuarry() {
super(Material.ROCK);
this.setUnlocalizedName(UNLOCALIZED_NAME);
this.setRegistryName(UNLOCALIZED_NAME);
this.setHardness(5.0F);
this.setCreativeTab(CreativeTabs.REDSTONE);
}
@Override
public boolean hasTileEntity(IBlockState state)
{
return true;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEnderQuarry)
{
TileEnderQuarry quarry = (TileEnderQuarry) tile;
if(quarry.finished)
{
player.sendMessage(new TextComponentString("Quarry has finished"));
return true;
}
if(quarry.started)
{
int x = (quarry.chunk_x << 4) + quarry.dx;
int z = (quarry.chunk_z << 4) + quarry.dz;
int y = quarry.dy;
if(quarry.hasRedstoneSignal())
{
player.sendMessage(new TextComponentString("Quarry stopped due to redstone signal!"));
}
player.sendMessage(new TextComponentString("Stored energy: " + quarry.energy.getEnergyStored() + "/" + quarry.energy.getMaxEnergyStored()));
player.sendMessage(new TextComponentString("Mining at: " + x + ", " + y + ", " + z));
player.sendMessage(new TextComponentString("" + quarry.progress + " blocks scanned."));
if(quarry.tank.getFluid() != null && quarry.tank.getFluidAmount() > 0)
{
player.sendMessage(new TextComponentString("Stored liquid: " + quarry.tank.getFluid().getLocalizedName() + ": " + quarry.tank.getFluidAmount() + "/" + quarry.tank.getCapacity()));
}
else
{
player.sendMessage(new TextComponentString("Tank empty"));
}
}
else
{
player.sendMessage(new TextComponentString("Analyzing Fence boundary"));
if(!quarry.checkForMarkers(player))
{
player.sendMessage(new TextComponentString("Failed to set up quarry"));
}
}
}
}
return true;
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
TileEntity tile;
if ((tile = worldIn.getTileEntity(pos)) instanceof TileEnderQuarry)
((TileEnderQuarry)tile).checkSurroundings();
}
@Override
public TileEntity createTileEntity(World world, IBlockState state)
{
return new TileEnderQuarry();
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.SOLID;
}
}

View File

@ -0,0 +1,106 @@
package com.myuki69.enderquarry;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
@Mod(modid = EnderQuarryMod.MODID, name = EnderQuarryMod.NAME, version = EnderQuarryMod.VERSION)
public class EnderQuarryMod
{
@Mod.Instance("enderquarrymod")
public static EnderQuarryMod instance;
public static final String MODID = "enderquarrymod";
public static final String NAME = "Ender Quarry Mod";
public static final String VERSION = "1.0.0";
public static EnderQuarry enderQuarry;
public static EnderMarker enderMarker;
public static UpgradeBlock upgradeVoid;
public static UpgradeBlock upgradeSilk;
public static UpgradeBlock upgradeFortune1;
public static UpgradeBlock upgradeFortune2;
public static UpgradeBlock upgradeFortune3;
public static UpgradeBlock upgradeSpeed1;
public static UpgradeBlock upgradeSpeed2;
public static UpgradeBlock upgradeSpeed3;
public static UpgradeBlock upgradePump;
public static ItemBlock itemEnderQuarry;
public static ItemBlock itemEnderMarker;
public static ItemBlock itemUpgradeVoid;
public static ItemBlock itemUpgradeSilk;
public static ItemBlock itemUpgradeFortune1;
public static ItemBlock itemUpgradeFortune2;
public static ItemBlock itemUpgradeFortune3;
public static ItemBlock itemUpgradeSpeed1;
public static ItemBlock itemUpgradeSpeed2;
public static ItemBlock itemUpgradeSpeed3;
public static ItemBlock itemUpgradePump;
private void registerUpgrade(UpgradeBlock block, ItemBlock itemblock, String name, int type)
{
block = new UpgradeBlock(name, type);
ForgeRegistries.BLOCKS.register(block);
itemblock = new ItemBlock(block);
itemblock.setRegistryName(block.getRegistryName());
ForgeRegistries.ITEMS.register(itemblock);
ModelLoader.setCustomModelResourceLocation(itemblock, 0, new ModelResourceLocation(itemblock.getRegistryName(), "inventory"));
}
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
enderQuarry = new EnderQuarry();
ForgeRegistries.BLOCKS.register(enderQuarry);
itemEnderQuarry = new ItemBlock(enderQuarry);
itemEnderQuarry.setRegistryName(enderQuarry.getRegistryName());
ForgeRegistries.ITEMS.register(itemEnderQuarry);
ModelLoader.setCustomModelResourceLocation(itemEnderQuarry, 0, new ModelResourceLocation(itemEnderQuarry.getRegistryName(), "inventory"));
GameRegistry.registerTileEntity(TileEnderQuarry.class, enderQuarry.getRegistryName().toString());
enderMarker = new EnderMarker();
ForgeRegistries.BLOCKS.register(enderMarker);
itemEnderMarker = new ItemBlock(enderMarker);
itemEnderMarker.setRegistryName(enderMarker.getRegistryName());
ForgeRegistries.ITEMS.register(itemEnderMarker);
ModelLoader.setCustomModelResourceLocation(itemEnderMarker, 0, new ModelResourceLocation(itemEnderMarker.getRegistryName(), "inventory"));
GameRegistry.registerTileEntity(TileEnderMarker.class, enderMarker.getRegistryName().toString());
registerUpgrade(upgradeVoid, itemUpgradeVoid, "upgradevoid", 1);
registerUpgrade(upgradeSilk, itemUpgradeSilk, "upgradesilk", 2);
registerUpgrade(upgradeFortune1, itemUpgradeFortune1, "upgradefortunei", 3);
registerUpgrade(upgradeFortune2, itemUpgradeFortune2, "upgradefortuneii", 4);
registerUpgrade(upgradeFortune3, itemUpgradeFortune3, "upgradefortuneiii", 5);
registerUpgrade(upgradeSpeed1, itemUpgradeSpeed1, "upgradespeedi", 6);
registerUpgrade(upgradeSpeed2, itemUpgradeSpeed2, "upgradespeedii", 7);
registerUpgrade(upgradeSpeed3, itemUpgradeSpeed3, "upgradespeediii", 8);
registerUpgrade(upgradePump, itemUpgradePump, "upgradepump", 9);
}
@EventHandler
public void init(FMLInitializationEvent event)
{
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new QuarryChunkLoadingCallback());
}
}

View File

@ -0,0 +1,44 @@
package com.myuki69.enderquarry;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import com.google.common.collect.Lists;
public class QuarryChunkLoadingCallback implements ForgeChunkManager.OrderedLoadingCallback
{
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
}
@Override
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount)
{
List<Ticket> validTickets = Lists.newArrayList();
for(Ticket ticket: tickets)
{
String type = ticket.getModData().getString("id");
if(type == "quarry")
{
int blockX = ticket.getModData().getInteger("x");
int blockY = ticket.getModData().getInteger("y");
int blockZ = ticket.getModData().getInteger("z");
BlockPos quarryPos = new BlockPos(blockX, blockY, blockZ);
TileEntity te1 = world.getTileEntity(quarryPos);
if(te1 instanceof TileEnderQuarry)
validTickets.add(ticket);
}
}
return validTickets;
}
}

View File

@ -0,0 +1,130 @@
package com.myuki69.enderquarry;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
public class TileEnderMarker extends TileEntity implements ITickable
{
public static List<int[]> markers = new ArrayList();
public boolean init = false;
private int cnt = 0;
public static int[] getCoord(TileEntity tile)
{
BlockPos thisBlockPos = tile.getPos();
return new int[] { tile.getWorld().provider.getDimension(), thisBlockPos.getX(), thisBlockPos.getY(), thisBlockPos.getZ() };
}
public int[] getCoord()
{
return getCoord(this);
}
@Override
public void update()
{
if (!init)
onChunkLoad();
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
{
return oldState.getBlock() != newSate.getBlock();
}
@Override
public void invalidate()
{
super.invalidate();
if (world.isRemote)
return;
//System.out.println("Invalidated tile at: " + this.getPos().getX() + " " + this.getPos().getZ());
int[] myCoord = getCoord();
List<int[]> toUpdate = new ArrayList();
for (int i = 0; i < markers.size(); i++)
{
int[] coord = (int[])markers.get(i);
if ((myCoord[0] == coord[0]) && (myCoord[2] == coord[2]))
{
if ((myCoord[3] == coord[3]) && (myCoord[1] == coord[1]))
{
markers.remove(i);
i--;
}
else if ((myCoord[3] == coord[3]) || (myCoord[1] == coord[1]))
{
toUpdate.add(coord);
}
}
}
for (int[] coord : toUpdate)
{
TileEntity tile = world.getTileEntity(new BlockPos(coord[1], coord[2], coord[3]));
if ((tile instanceof TileEnderMarker))
((TileEnderMarker)tile).recheck();
}
}
public void recheck() //this func updates block info for the game to know which particles to spawn later
{
//System.out.println("Rechecking at " + this.getPos().getX() + " " + this.getPos().getZ());
int[] myCoord = getCoord();
int flag = 0;
for (int[] coord : markers)
{
if ((myCoord[0] == coord[0]) && (myCoord[2] == coord[2]) && ((myCoord[1] != coord[1]) || (myCoord[3] != coord[3])))
{
if (myCoord[1] == coord[1])
flag |= (myCoord[3] < coord[3] ? 1 : 2);
else if (myCoord[3] == coord[3])
flag |= (myCoord[1] < coord[1] ? 4 : 8);
}
}
IBlockState state = world.getBlockState(this.getPos());
world.setBlockState(this.getPos(), state.withProperty(EnderMarker.META, flag));
}
public void onChunkLoad()
{
if (init)
return;
init = true;
if ((world == null) || (world.isRemote))
return;
int[] myCoord = getCoord();
List<int[]> toUpdate = new ArrayList();
for (int[] coord : markers)
{
if ((myCoord[0] == coord[0]) && (myCoord[2] == coord[2]))
{
if ((myCoord[3] == coord[3]) && (myCoord[1] == coord[1]))
return;
if ((myCoord[3] == coord[3]) || (myCoord[1] == coord[1]))
toUpdate.add(coord);
}
}
markers.add(myCoord);
recheck();
for (int[] coord : toUpdate)
{
TileEntity tile = world.getTileEntity(new BlockPos(coord[1], coord[2], coord[3]));
if ((tile instanceof TileEnderMarker))
((TileEnderMarker)tile).recheck();
}
}
}

View File

@ -0,0 +1,867 @@
package com.myuki69.enderquarry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.wrappers.BlockLiquidWrapper;
import net.minecraftforge.fluids.capability.wrappers.FluidBlockWrapper;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.ItemHandlerHelper;
public class TileEnderQuarry
extends TileEntity
implements ITickable, IItemHandler
{
private static final Random rand = new Random();
public static int baseDrain = 1800;
public static float hardnessDrain = 200.0F;
public ArrayList<ItemStack> items = new ArrayList();
public FluidTank tank = new FluidTank(32000);
public EnergyStorage energy = new EnergyStorage(10000000);
public int neededEnergy = -1;
public int config = -1;
public long progress = 0L;
public boolean started = false;
public boolean finished = false;
public int dx = 1;
public int dy = 0;
public int dz = 0;
int chunk_x = 0;
int chunk_z = 0;
int chunk_y = 0;
int xCoord;
int yCoord;
int zCoord;
int min_x;
int max_x;
int min_z;
int max_z;
private ForgeChunkManager.Ticket chunkTicket;
private EntityPlayer owner;
public static double[] powerMultipliers = { 1.0D, 1.0D, 1.5D, 5.0D, 20.0D, 80.0D, 1.0D, 1.5D, 2.0D, 1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D };
public boolean[] upgrades = new boolean[16];
public static final int UPGRADE_BLANK = 0;
public static final int UPGRADE_VOID = 1;
public static final int UPGRADE_SILK = 2;
public static final int UPGRADE_FORTUNE1 = 3;
public static final int UPGRADE_FORTUNE2 = 4;
public static final int UPGRADE_FORTUNE3 = 5;
public static final int UPGRADE_SPEED1 = 6;
public static final int UPGRADE_SPEED2 = 7;
public static final int UPGRADE_SPEED3 = 8;
public static final int UPGRADE_FLUID = 9;
public TileEnderQuarry()
{
tank.setCanFill(false);
}
@Override
public void readFromNBT(NBTTagCompound tags)
{
this.energy.receiveEnergy(tags.getInteger("energy"), false);
int n = tags.getInteger("item_no");
this.items.clear();
for (int i = 0; i < n; i++)
{
NBTTagCompound t = tags.getCompoundTag("item_" + i);
this.items.add(new ItemStack(t));
}
if (tags.hasKey("fluid"))
tank.fillInternal(FluidStack.loadFluidStackFromNBT(tags.getCompoundTag("fluid")), true);
this.finished = tags.getBoolean("finished");
if (this.finished)
return;
this.started = tags.getBoolean("started");
if (!this.started)
return;
min_x = tags.getInteger("min_x");
min_z = tags.getInteger("min_z");
max_x = tags.getInteger("max_x");
max_z = tags.getInteger("max_z");
chunk_x = tags.getInteger("chunk_x");
chunk_y = tags.getInteger("chunk_y");
chunk_z = tags.getInteger("chunk_z");
dx = tags.getInteger("dx");
dy = tags.getInteger("dy");
dz = tags.getInteger("dz");
progress = tags.getLong("progress");
super.readFromNBT(tags);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tags)
{
tags.setInteger("energy", energy.getEnergyStored());
for (int i = 0; i < items.size(); i++)
{
while (i < items.size() && items.get(i) == null)
items.remove(i);
if (i < items.size())
{
NBTTagCompound t = new NBTTagCompound();
((ItemStack)items.get(i)).writeToNBT(t);
tags.setTag("item_" + i, t);
}
}
tags.setInteger("item_no", items.size());
if (tank.getFluid() != null)
{
NBTTagCompound t = new NBTTagCompound();
tank.getFluid().writeToNBT(t);
tags.setTag("fluid", t);
}
if (finished)
{
tags.setBoolean("finished", true);
}
else if (started)
{
tags.setBoolean("started", true);
tags.setInteger("min_x", min_x);
tags.setInteger("max_x", max_x);
tags.setInteger("min_z", min_z);
tags.setInteger("max_z", max_z);
tags.setInteger("chunk_x", chunk_x);
tags.setInteger("chunk_y", chunk_y);
tags.setInteger("chunk_z", chunk_z);
tags.setInteger("dx", dx);
tags.setInteger("dy", dy);
tags.setInteger("dz", dz);
tags.setLong("progress", progress);
}
return super.writeToNBT(tags);
}
public boolean checkForMarkers(EntityPlayer player)
{
BlockPos thisBlockPos = this.getPos();
System.out.println("Quarry checking at: " + thisBlockPos.getX() + " " + thisBlockPos.getY() + " " + thisBlockPos.getZ());
for (EnumFacing face : EnumFacing.HORIZONTALS)
{
BlockPos vecin = thisBlockPos.offset(face);
int offsetX = vecin.getX() - thisBlockPos.getX();
int offsetZ = vecin.getZ() - thisBlockPos.getZ();
int[] test = { this.world.provider.getDimension(), vecin.getX(), vecin.getY(), vecin.getZ() };
int[] test_forward = null;
int[] test_side = null;
boolean foundAttached = false;
for (int[] a : TileEnderMarker.markers)
{
if (isIntEqual(a, test))
{
foundAttached = true;
break;
}
}
if (foundAttached)
{
player.sendMessage(new TextComponentString("Found attached ender-marker"));
for (int[] a : TileEnderMarker.markers)
{
if ((a[0] == test[0]) && (a[2] == test[2]) && ((a[1] != test[1]) || (a[3] != test[3])))
{
if ((sign(a[1] - test[1]) == offsetX) && (sign(a[3] - test[3]) == offsetZ))
{
if (test_forward == null)
test_forward = a;
else if (!isIntEqual(a, test_forward))
player.sendMessage(new TextComponentString("Quarry marker square is ambiguous - multiple markers found at (" + a[1] + "," + a[3] + ") and (" + test_forward[1] + "," + test_forward[3] + ")"));
}
if (((offsetX == 0) && (a[3] == test[3])) || ((offsetZ == 0) && (a[1] == test[1])))
{
if (test_side == null)
test_side = a;
else if (!isIntEqual(a, test_side))
player.sendMessage(new TextComponentString("Quarry marker square is ambiguous - multiple markers found at (" + a[1] + "," + a[3] + ") and (" + test_side[1] + "," + test_side[3] + ")"));
}
}
}
if (test_forward == null)
{
player.sendMessage(new TextComponentString("Quarry marker square is incomplete"));
return false;
}
if (test_side == null)
{
player.sendMessage(new TextComponentString("Quarry marker square is incomplete"));
return false;
}
int amin_x = Math.min(Math.min(test[1], test_forward[1]), test_side[1]);
int amax_x = Math.max(Math.max(test[1], test_forward[1]), test_side[1]);
int amin_z = Math.min(Math.min(test[3], test_forward[3]), test_side[3]);
int amax_z = Math.max(Math.max(test[3], test_forward[3]), test_side[3]);
if ((amax_x - amin_x <= 2) || (amax_z - amin_z <= 2))
{
player.sendMessage(new TextComponentString("Region created by ender markers is too small"));
return false;
}
player.sendMessage(new TextComponentString("Sucessfully established boundary"));
chunk_y = this.getPos().getY();
min_x = amin_x;
max_x = amax_x;
min_z = amin_z;
max_z = amax_z;
startDig();
return true;
}
}
return false;
}
public static boolean isIntEqual(int[] a, int[] b)
{
if (a == b)
return true;
for (int i = 0; i < 4; i++)
{
if (a[i] != b[i])
return false;
}
return true;
}
public static int sign(int d)
{
if (d == 0)
return 0;
if (d > 0)
return 1;
return -1;
}
public void startDig()
{
System.out.println("Ender quarry started digging at (" + min_x + ", " + min_z + "), (" + max_x + ", " + max_z + ")");
this.started = true;
//this.chunk_y = yCoord;
this.chunk_x = (this.min_x + 1 >> 4);
this.chunk_z = (this.min_z + 1 >> 4);
this.dx = Math.max(0, this.min_x + 1 - (this.chunk_x << 4));
this.dy = this.chunk_y;
this.dz = Math.max(0, this.min_z + 1 - (this.chunk_z << 4));
if (!stopHere())
nextBlock();
}
@Override
public void update()
{
xCoord = this.getPos().getX();
yCoord = this.getPos().getY();
zCoord = this.getPos().getZ();
if(this.world.isRemote)
return;
if(config == -1)
checkSurroundings();
if (!started || finished)
return;
if (chunkTicket == null)
{
chunkTicket = ForgeChunkManager.requestTicket(EnderQuarryMod.instance, this.world, ForgeChunkManager.Type.NORMAL);
if (chunkTicket == null)
{
if (owner != null)
owner.sendMessage(new TextComponentString("Problem registering chunk-preserving method"));
this.finished = true;
return;
}
chunkTicket.getModData().setString("id", "quarry");
chunkTicket.getModData().setInteger("x", xCoord);
chunkTicket.getModData().setInteger("y", yCoord);
chunkTicket.getModData().setInteger("z", zCoord);
ForgeChunkManager.forceChunk(chunkTicket, new ChunkPos(xCoord, zCoord));
loadChunk();
}
int nr = getSpeedStack(); //operations per tick
for (int k = 0; k < nr; k++)
{
if (hasRedstoneSignal() || (!items.isEmpty()) || (tank.getFluid() != null && tank.getFluidAmount() > 31000))
{
}
else if (energy.getEnergyStored() >= neededEnergy && energy.extractEnergy(baseDrain, true) == baseDrain)
{
int x = (chunk_x << 4) + dx;
int z = (chunk_z << 4) + dz;
int y = dy;
if (y >= 0)
{
if (mineBlock(x, y, z, upgrades[1] == false))
{
this.neededEnergy = -1;
nextBlock();
}
}
else
{
nextBlock();
}
}
if (!items.isEmpty() && config > 0)
{
int side_id = 0;
BlockPos thisBlockPos = this.getPos();
for (EnumFacing face : EnumFacing.values())
{
BlockPos vecin = thisBlockPos.offset(face);
TileEntity tile = this.world.getTileEntity(vecin);
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face.getOpposite())) //am gasit un cufar sau cv
{
//System.out.println("Trying to put item at: " + vecin.getX() + ", " + vecin.getY() + ", " + vecin.getZ());
IItemHandler itemhandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face.getOpposite());
for(int i = 0; i < items.size(); ++i)
{
ItemStack remainder = ItemHandlerHelper.insertItemStacked(itemhandler, (ItemStack)items.get(i), false);
if(remainder.isEmpty())
{
items.remove(i);
--i;
}
}
}
}
}
if (tank.getFluid() != null && tank.getFluidAmount() > 0 && config > 0)
{
BlockPos thisBlockPos = this.getPos();
for (EnumFacing face : EnumFacing.values())
{
BlockPos vecin = thisBlockPos.offset(face);
TileEntity tile = this.world.getTileEntity(vecin);
if(tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face.getOpposite()))
{
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, face.getOpposite());
int transfer = tank.getFluidAmount();
tank.drain(handler.fill(tank.getFluid(), true), true);
}
}
}
}
}
public boolean mineBlock(int x, int y, int z, boolean replaceWithDirt)
{
BlockPos miningPos = new BlockPos (x, y, z);
IFluidHandler handler = null;
IBlockState toBeMinedState = this.world.getBlockState(miningPos);
Block toBeMined = toBeMinedState.getBlock();
if (this.world.isAirBlock(miningPos))
return true;
if (toBeMined instanceof BlockLiquid)
handler = new BlockLiquidWrapper((BlockLiquid) toBeMined, this.world, miningPos);
else if (toBeMined instanceof IFluidBlock) {
handler = new FluidBlockWrapper((IFluidBlock) toBeMined, this.world, miningPos);
}
if (handler != null) //fluid block
{
if(upgrades[9])
{
FluidStack drained = handler.drain(16000, false);
if (drained != null && tank.fillInternal(drained, false) == drained.amount)
{
tank.fillInternal(handler.drain(16000, true), true);
world.setBlockState(miningPos, Blocks.AIR.getDefaultState());
//System.out.println("Draining " + drained.amount + " from " + x + ", " + y + ", " + z);
return true;
}
//if(drained != null)
//System.out.println("DEBUG: draining failed: " + toBeMined.getLocalizedName() + " " + drained.getLocalizedName() + " " + drained.amount);
//else
if(drained == null)
{
System.out.println("WARNING: Draining block at " + x + ", " + y + ", " + z + " - " + toBeMined.getLocalizedName() + " returned null! Skipping!");
return true;
}
return false;
}
else
return true;
}
if(toBeMined == Blocks.BEDROCK)
return true;
if (replaceWithDirt && (toBeMined.isLeaves(toBeMinedState, this.world, miningPos) || toBeMined.isFoliage(this.world, miningPos) || toBeMined.isWood(this.world, miningPos) || (toBeMined instanceof IPlantable) || (toBeMined instanceof IGrowable)))
{
return true;
}
int meta = toBeMined.getMetaFromState(toBeMinedState);
float hardness = toBeMinedState.getBlockHardness(this.world, miningPos);
if (hardness < 0.0F)
{
return true;
}
int amount = (int)Math.ceil(baseDrain + hardness * hardnessDrain * getPowerMultiplier()); //cat RF o sa consume pentru acest block
if (amount > this.energy.getMaxEnergyStored())
{
amount = this.energy.getMaxEnergyStored();
}
if (this.energy.extractEnergy(amount, true) < amount)
{
this.neededEnergy = amount;
return false;
}
this.energy.extractEnergy(amount, false);
if(toBeMined == Blocks.GRASS && this.world.canSeeSky(miningPos))
{
return true;
}
return harvestBlock(toBeMinedState, miningPos, meta, replaceWithDirt, getDigType());
}
public boolean harvestBlock(IBlockState toBeMinedState, BlockPos miningPos, int meta, boolean replaceWithDirt, DigType digType)
{
Block toBeMined = toBeMinedState.getBlock();
boolean isOpaque = toBeMinedState.isOpaqueCube();
FakePlayer fakePlayer = FakePlayerFactory.getMinecraft((WorldServer) this.world);
fakePlayer.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, digType.newStack(Items.DIAMOND_PICKAXE));
try
{
boolean flag;
Object i = new ArrayList();
if ((digType.isSilkTouch()) && (toBeMined.canSilkHarvest(this.world, miningPos, toBeMinedState, fakePlayer)))
{
int j = 0;
Item item = Item.getItemFromBlock(toBeMined);
if (item != null)
{
if (item.getHasSubtypes())
j = meta;
ItemStack itemstack = new ItemStack(item, 1, j);
((ArrayList)i).add(itemstack);
}
}
else
{
((ArrayList)i).addAll(toBeMined.getDrops(this.world, miningPos, toBeMinedState, digType.getFortuneModifier()));
}
float p = ForgeEventFactory.fireBlockHarvesting((ArrayList)i, this.world, miningPos, toBeMinedState, digType.getFortuneModifier(), 1.0F, digType.isSilkTouch(), fakePlayer);
if ((p > 0.0F) && (!((ArrayList)i).isEmpty()) && ((p == 1.0F) || (rand.nextFloat() < p)))
this.items.addAll((Collection)i);
if(replaceWithDirt)
{
if(toBeMined != Blocks.DIRT)
flag = this.world.setBlockState(miningPos, Blocks.DIRT.getDefaultState());
else
return true;
}
else
flag = this.world.setBlockState(miningPos, Blocks.AIR.getDefaultState());
if (!flag)
{
System.out.println("Error in setting block at mining pos!");
return false;
}
return true;
}
finally
{
fakePlayer.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Blocks.DIRT));
}
}
private DigType getDigType()
{
if (this.upgrades[2] == true)
return DigType.SILK;
if (this.upgrades[3] == true)
return DigType.FORTUNE;
if (this.upgrades[4] == true)
return DigType.FORTUNE2;
if (this.upgrades[5] == true)
return DigType.FORTUNE3;
return DigType.NORMAL;
}
public void nextBlock()
{
nextSubBlock();
while (!stopHere())
nextSubBlock();
}
public void nextSubBlock()
{
this.progress += 1L;
this.dy -= 1;
if (this.dy <= 0)
{
this.dx += 1;
if ((this.dx >= 16) || ((this.chunk_x << 4) + this.dx >= this.max_x))
{
this.dx = Math.max(0, this.min_x + 1 - (this.chunk_x << 4));
this.dz += 1;
if ((this.dz >= 16) || ((this.chunk_z << 4) + this.dz >= this.max_z))
{
nextChunk();
this.dx = Math.max(0, this.min_x + 1 - (this.chunk_x << 4));
this.dz = Math.max(0, this.min_z + 1 - (this.chunk_z << 4));
}
}
this.dy = this.chunk_y;
}
}
public void nextChunk()
{
unloadChunk();
this.chunk_x += 1;
if (this.chunk_x << 4 >= this.max_x)
{
this.chunk_x = (this.min_x + 1 >> 4);
this.chunk_z += 1;
if (this.chunk_z << 4 >= this.max_z)
{
this.finished = true;
//this.world.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 2, 2);
ForgeChunkManager.releaseTicket(this.chunkTicket);
return;
}
}
this.dy = this.chunk_y;
loadChunk();
}
public boolean stopHere()
{
return (this.finished) || (isValid((this.chunk_x << 4) + this.dx, (this.chunk_z << 4) + this.dz));
}
private boolean isValid(int x, int z)
{
return (this.min_x < x) && (x < this.max_x) && (this.min_z < z) && (z < this.max_z);
}
private double getPowerMultiplier()
{
double multiplier = 1.0D;
for (int i = 0; i < 16; i++)
{
if (upgrades[i])
multiplier *= powerMultipliers[i];
}
return multiplier;
}
private int getSpeedStack()
{
if (upgrades[6])
return 1;
if (upgrades[7])
return 3;
if (upgrades[8])
return 9;
return 1;
}
private void loadChunk()
{
ChunkPos base = new ChunkPos(xCoord, zCoord);
if(base.x != chunk_x || base.z != chunk_z)
ForgeChunkManager.forceChunk(chunkTicket, new ChunkPos(chunk_x, chunk_z));
}
private void unloadChunk()
{
ChunkPos base = new ChunkPos(xCoord, zCoord);
if(base.x != chunk_x || base.z != chunk_z)
ForgeChunkManager.unforceChunk(chunkTicket, new ChunkPos(chunk_x, chunk_z)); //ne asiguram ca nu stergem din ram chunkul in care e ender quarry
}
public void checkSurroundings()
{
config = 1;
for(int i = 0; i <= 10; ++i)
upgrades[i] = false;
BlockPos thisBlockPos = this.getPos();
for (EnumFacing face : EnumFacing.values())
{
BlockPos vecin = thisBlockPos.offset(face);
if (world.getBlockState(vecin).getBlock() instanceof UpgradeBlock)
{
upgrades[((UpgradeBlock)world.getBlockState(vecin).getBlock()).upgradeType] = true;
//System.out.println("Found an upgrade of type " + ((UpgradeBlock)world.getBlockState(vecin).getBlock()).upgradeType);
}
}
}
public boolean hasRedstoneSignal()
{
for (EnumFacing enumfacing : EnumFacing.values())
{
if (world.isSidePowered(pos.offset(enumfacing), enumfacing))
{
return true;
}
}
if (world.isSidePowered(pos, EnumFacing.DOWN))
{
return true;
}
else
{
BlockPos blockpos = pos.up();
for (EnumFacing enumfacing1 : EnumFacing.values())
{
if (enumfacing1 != EnumFacing.DOWN && world.isSidePowered(blockpos.offset(enumfacing1), enumfacing1))
{
return true;
}
}
return false;
}
}
public int invInsert(IItemHandler itemhandler, ItemStack toBeInserted)
{
for(int i = 0; i < itemhandler.getSlots(); ++i)
{
ItemStack cur = itemhandler.getStackInSlot(i);
if(cur.isEmpty())
{
itemhandler.insertItem(i, toBeInserted, false);
return 1;
}
else
{
if(ItemStack.areItemsEqual(toBeInserted, cur))
{
if(cur.getCount() == cur.getMaxStackSize())
continue;
if(cur.getCount() + toBeInserted.getCount() <= cur.getMaxStackSize())
{
itemhandler.insertItem(i, toBeInserted, false);
return 1;
}
else
{
int ammount = cur.getMaxStackSize() - cur.getCount();
ItemStack remainder = toBeInserted;
remainder.shrink(ammount);
toBeInserted.setCount(ammount);
items.add(remainder);
}
}
}
}
return 0;
}
public static enum DigType
{
NORMAL(null, 0), SILK(Enchantments.SILK_TOUCH, 1), FORTUNE(Enchantments.FORTUNE, 1), FORTUNE2(Enchantments.FORTUNE, 2), FORTUNE3(Enchantments.FORTUNE, 3), SPEED(Enchantments.EFFICIENCY, 1), SPEED2(Enchantments.EFFICIENCY, 3), SPEED3(Enchantments.EFFICIENCY, 5);
public Enchantment ench;
public int level;
private DigType(Enchantment ench, int level)
{
this.ench = ench;
this.level = level;
}
public int getFortuneModifier()
{
if (this.ench == Enchantments.FORTUNE)
return this.level;
return 0;
}
public ItemStack newStack(Item pick)
{
ItemStack stack = new ItemStack(pick);
if (ench != null)
stack.addEnchantment(this.ench, this.level);
return stack;
}
public boolean isSilkTouch()
{
return this.ench == Enchantments.SILK_TOUCH;
}
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return true;
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
return true;
if(capability == CapabilityEnergy.ENERGY)
return true;
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return (T) this;
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
return (T) tank;
if (capability == CapabilityEnergy.ENERGY)
return (T) energy;
return super.getCapability(capability, facing);
}
//useless stuff so pipes connect to quarry
@Override
public int getSlots()
{
return 1;
}
@Override
public ItemStack getStackInSlot(int slot)
{
if(slot != 0)
return ItemStack.EMPTY;
for(int i = 0; i < items.size(); ++i)
return (ItemStack)items.get(i);
return ItemStack.EMPTY;
}
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
return stack;
}
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
ItemStack eject;
for(int i = 0; i < items.size(); ++i)
{
eject = (ItemStack)items.get(i);
if(simulate == false)
{
items.remove(i);
--i;
}
return eject;
}
return ItemStack.EMPTY;
}
@Override
public int getSlotLimit(int slot)
{
ItemStack firstStack;
for(int i = 0; i < items.size(); ++i)
{
firstStack = (ItemStack)items.get(i);
return firstStack.getMaxStackSize();
}
return 64;
}
}

View File

@ -0,0 +1,104 @@
package com.myuki69.enderquarry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class UpgradeBlock extends Block
{
public static final PropertyBool NORTH = PropertyBool.create("north");
public static final PropertyBool EAST = PropertyBool.create("east");
public static final PropertyBool SOUTH = PropertyBool.create("south");
public static final PropertyBool WEST = PropertyBool.create("west");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool DOWN = PropertyBool.create("down");
protected static final AxisAlignedBB CUSTOM_AABB = new AxisAlignedBB(0.0625D, 0.0625D, 0.0625D, 0.9375D, 0.9375D, 0.9375D);
public int upgradeType = 0;
public UpgradeBlock(String name, int type)
{
super(Material.ROCK);
this.setCreativeTab(CreativeTabs.REDSTONE);
this.setHardness(4.0F);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.upgradeType = type;
this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false).withProperty(UP, false).withProperty(DOWN, false));
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return CUSTOM_AABB;
}
public boolean canConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
{
IBlockState iblockstate = world.getBlockState(pos);
Block block = iblockstate.getBlock();
if(block instanceof EnderQuarry)
return true;
return false;
}
@Override
public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
{
return canConnectTo(world, pos.offset(facing), facing.getOpposite());
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return state.withProperty(NORTH, canBeConnectedTo(worldIn, pos, EnumFacing.NORTH))
.withProperty(EAST, canBeConnectedTo(worldIn, pos, EnumFacing.EAST))
.withProperty(SOUTH, canBeConnectedTo(worldIn, pos, EnumFacing.SOUTH))
.withProperty(WEST, canBeConnectedTo(worldIn, pos, EnumFacing.WEST))
.withProperty(UP, canBeConnectedTo(worldIn, pos, EnumFacing.UP))
.withProperty(DOWN, canBeConnectedTo(worldIn, pos, EnumFacing.DOWN));
}
@Override
protected BlockStateContainer createBlockState ()
{
return new BlockStateContainer(this, new IProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
}
@Override
public int getMetaFromState (IBlockState state)
{
return 0;
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public boolean isOpaqueCube(IBlockState iState)
{
return false;
}
@Override
public boolean isFullCube(IBlockState iState)
{
return false;
}
}

View File

@ -0,0 +1,8 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:endermarker" }
}
]
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"normal": [
{ "model": "enderquarrymod:enderquarry" }
]
}
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradefortunei" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradefortuneii" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradefortuneiii" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradepump" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradesilk" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradespeedi" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradespeedii" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradespeediii" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,25 @@
{
"multipart":
[
{
"apply": { "model": "enderquarrymod:upgradevoid" }},
{ "when": { "north": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "uvlock": true }
},
{ "when": { "east": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 90, "uvlock": true }
},
{ "when": { "south": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 180, "uvlock": true }
},
{ "when": { "west": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "y": 270, "uvlock": true }
},
{ "when": { "up": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 270, "uvlock": true }
},
{ "when": { "down": "true" },
"apply": { "model": "enderquarrymod:upgradeside", "x": 90, "uvlock": true }
}
]
}

View File

@ -0,0 +1,11 @@
tile.enderquarry.name=Ender Quarry
tile.upgradevoid.name=Ender Quarry World Hole Upgrade
tile.upgradesilk.name=Ender Quarry Silk Touch Upgrade
tile.upgradefortunei.name=Ender Quarry Fortune I Upgrade
tile.upgradefortuneii.name=Ender Quarry Fortune II Upgrade
tile.upgradefortuneiii.name=Ender Quarry Fortune III Upgrade
tile.upgradespeedi.name=Ender Quarry Speed I Upgrade
tile.upgradespeedii.name=Ender Quarry Speed II Upgrade
tile.upgradespeediii.name=Ender Quarry Speed III Upgrade
tile.upgradepump.name=Ender Quarry Pump Upgrade
tile.endermarker.name=Ender Marker

View File

@ -0,0 +1,54 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"particle": "enderquarrymod:blocks/endermarker",
"endermarker": "enderquarrymod:blocks/endermarker"
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.625, 0.625, 0.625 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 0 ],
"scale": [ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"elements": [
{
"name": "Cube",
"from": [ 7, 0, 7 ],
"to": [ 9, 13, 9 ],
"faces": {
"north": { "texture": "#endermarker", "uv": [ 7, 3, 9, 16 ] },
"east": { "texture": "#endermarker", "uv": [ 7, 3, 9, 16 ] },
"south": { "texture": "#endermarker", "uv": [ 7, 3, 9, 16 ] },
"west": { "texture": "#endermarker", "uv": [ 7, 3, 9, 16 ] },
"up": { "texture": "#endermarker", "uv": [ 7, 1, 9, 3 ] },
"down": { "texture": "#endermarker", "uv": [ 7, 14, 9, 16 ] }
}
}
]
}

View File

@ -0,0 +1,55 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"particle": "enderquarrymod:blocks/enderquarry",
"enderquarry": "enderquarrymod:blocks/enderquarry",
"enderquarrytop": "enderquarrymod:blocks/enderquarrytop"
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.625, 0.625, 0.625 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 0 ],
"scale": [ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"elements": [
{
"name": "Cube",
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"north": { "texture": "#enderquarry", "uv": [ 0, 0, 16, 16 ] },
"east": { "texture": "#enderquarry", "uv": [ 0, 0, 16, 16 ] },
"south": { "texture": "#enderquarry", "uv": [ 0, 0, 16, 16 ] },
"west": { "texture": "#enderquarry", "uv": [ 0, 0, 16, 16 ] },
"up": { "texture": "#enderquarrytop", "uv": [ 0, 0, 16, 16 ] },
"down": { "texture": "#enderquarrytop", "uv": [ 0, 0, 16, 16 ] }
}
}
]
}

View File

@ -0,0 +1,53 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"particle": "#texture"
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.625, 0.625, 0.625 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 0 ],
"scale": [ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"elements": [
{
"name": "Cube",
"from": [ 1, 1, 1 ],
"to": [ 15, 15, 15 ],
"faces": {
"north": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] },
"east": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] },
"south": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] },
"west": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] },
"up": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] },
"down": { "texture": "#texture", "uv": [ 1, 1, 15, 15 ] }
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradefortunei"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradefortuneii"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradefortuneiii"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradepump"
}
}

View File

@ -0,0 +1,51 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
"textures": {
"quarryupgradearm": "enderquarrymod:blocks/upgradearm"
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.625, 0.625, 0.625 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 0 ],
"scale": [ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"elements": [
{
"name": "Cube",
"from": [ 2, 2, 0 ],
"to": [ 14, 14, 1 ],
"faces": {
"east": { "texture": "#quarryupgradearm", "uv": [ 0, 2, 1, 14 ] },
"west": { "texture": "#quarryupgradearm", "uv": [ 15, 2, 16, 14 ] },
"up": { "texture": "#quarryupgradearm", "uv": [ 2, 0, 14, 1 ] },
"down": { "texture": "#quarryupgradearm", "uv": [ 2, 15, 14, 16 ] }
}
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradesilk"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradespeedi"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradespeedii"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradespeediii"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "enderquarrymod:block/upgradeblockbase",
"textures": {
"texture": "enderquarrymod:blocks/upgradevoid"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/endermarker"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/enderquarry"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradefortunei"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradefortuneii"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradefortuneiii"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradepump"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradesilk"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradespeedi"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradespeedii"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradespeediii"
}

View File

@ -0,0 +1,3 @@
{
"parent": "enderquarrymod:block/upgradevoid"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

View File

@ -0,0 +1,16 @@
[
{
"modid": "enderquarrymod",
"name": "Ender Quarry Mod",
"description": "Unofficial Ender Quarry port from ExU 1.7.10",
"version": "1.0.5",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["Vlad"],
"credits": "RWTema, Vlad",
"logoFile": "",
"screenshots": [],
"dependencies": []
}
]

View File

@ -0,0 +1,7 @@
{
"pack": {
"description": "enderquarrymod resources",
"pack_format": 3,
"_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)."
}
}