mirror of
https://github.com/GTNewHorizons/EnderCore.git
synced 2026-11-20 12:09:38 +00:00
Merge branch 'master' of https://github.com/SleepyTrousers/EnderCore.git
This commit is contained in:
commit
520595e6b5
4 files changed
+31
-7
No files matched your search
@@ -53,7 +53,7 @@ public class EnderCore implements IEnderMod {
|
||||
public static final Logger logger = LogManager.getLogger(NAME);
|
||||
public static final Lang lang = new Lang(MODID);
|
||||
|
||||
@Instance
|
||||
@Instance(MODID)
|
||||
public static EnderCore instance;
|
||||
|
||||
@SidedProxy(serverSide = "com.enderio.core.common.CommonProxy", clientSide = "com.enderio.core.client.ClientProxy")
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.api.common.util.ITankAccess;
|
||||
import com.enderio.core.common.interfaces.IComparatorOutput;
|
||||
import com.enderio.core.common.util.FluidUtil;
|
||||
import com.enderio.core.common.util.Log;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -29,6 +30,7 @@ public abstract class BlockEnder extends Block {
|
||||
|
||||
protected final Class<? extends TileEntityEnder> teClass;
|
||||
protected final String name;
|
||||
protected final boolean hasComparatorInputOverride;
|
||||
|
||||
protected BlockEnder(String name, Class<? extends TileEntityEnder> teClass) {
|
||||
this(name, teClass, new Material(MapColor.ironColor));
|
||||
@@ -42,6 +44,7 @@ public abstract class BlockEnder extends Block {
|
||||
setBlockName(name);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
hasComparatorInputOverride = teClass != null && IComparatorOutput.class.isAssignableFrom(teClass);
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
@@ -179,6 +182,22 @@ public abstract class BlockEnder extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return hasComparatorInputOverride;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World w, int x, int y, int z, int side) {
|
||||
if (hasComparatorInputOverride) {
|
||||
TileEntityEnder te = getTileEntityEio(w, x, y, z);
|
||||
if (te != null) {
|
||||
return ((IComparatorOutput) te).getComparatorOutput();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Because the vanilla method takes floats...
|
||||
public void setBlockBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
this.minX = minX;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.enderio.core.common.interfaces;
|
||||
|
||||
public interface IComparatorOutput {
|
||||
|
||||
int getComparatorOutput();
|
||||
}
|
||||
@@ -62,14 +62,13 @@ public class Util {
|
||||
}
|
||||
|
||||
public static void giveExperience(EntityPlayer thePlayer, float experience) {
|
||||
if (experience < 1.0F) {
|
||||
int rndRound = MathHelper.floor_float(experience);
|
||||
if (rndRound < MathHelper.ceiling_float_int(experience) && (float) Math.random() < experience) {
|
||||
++rndRound;
|
||||
int intExp = (int) experience;
|
||||
float fractional = experience - intExp;
|
||||
if (fractional > 0.0F) {
|
||||
if ((float) Math.random() < fractional) {
|
||||
++intExp;
|
||||
}
|
||||
experience = rndRound;
|
||||
}
|
||||
int intExp = Math.round(experience);
|
||||
while (intExp > 0) {
|
||||
int j = EntityXPOrb.getXPSplit(intExp);
|
||||
intExp -= j;
|
||||
|
||||
Reference in new issue
Block a user