mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 11:49:37 +00:00
Move spreader magic-numbers into the enum (#3200)
This commit is contained in:
1 parent
f91dd3873f
commit
a534f041f5
2 files changed
+26
-22
No files matched your search
@@ -51,10 +51,28 @@ import java.util.List;
|
||||
public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWireframeAABBProvider {
|
||||
private static final VoxelShape RENDER_SHAPE = makeCuboidShape(1, 1, 1, 15, 15, 15);
|
||||
public enum Variant {
|
||||
MANA,
|
||||
REDSTONE,
|
||||
ELVEN,
|
||||
GAIA
|
||||
MANA (160, 1000, 0x20FF20, 0x00FF00, 60, 4f, 1f),
|
||||
REDSTONE (160, 1000, 0xFF2020, 0xFF0000, 60, 4f, 1f),
|
||||
ELVEN (240, 1000, 0xFF45C4, 0xFF00AE, 80, 4f, 1.25f),
|
||||
GAIA (640, 6400, 0x20FF20, 0x00FF00, 120, 20f, 2f);
|
||||
|
||||
public final int burstMana;
|
||||
public final int manaCapacity;
|
||||
public final int color;
|
||||
public final int hudColor;
|
||||
public final int preLossTicks;
|
||||
public final float lossPerTick;
|
||||
public final float motionModifier;
|
||||
|
||||
private Variant(int bm, int mc, int c, int hc, int plt, float lpt, float mm) {
|
||||
burstMana = bm;
|
||||
manaCapacity = mc;
|
||||
color = c;
|
||||
hudColor = hc;
|
||||
preLossTicks = plt;
|
||||
lossPerTick = lpt;
|
||||
motionModifier = mm;
|
||||
}
|
||||
}
|
||||
|
||||
public final Variant variant;
|
||||
|
||||
@@ -78,8 +78,6 @@ import java.util.UUID;
|
||||
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IDirectioned, ITickableTileEntity {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.SPREADER)
|
||||
public static TileEntityType<TileSpreader> TYPE;
|
||||
private static final int MAX_MANA = 1000;
|
||||
private static final int ULTRA_MAX_MANA = 6400;
|
||||
private static final int TICKS_ALLOWED_WITHOUT_PINGBACK = 20;
|
||||
private static final double PINGBACK_EXPIRED_SEARCH_DISTANCE = 0.5;
|
||||
|
||||
@@ -490,16 +488,9 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
}
|
||||
|
||||
private EntityManaBurst getBurst(boolean fake) {
|
||||
boolean dreamwood = getVariant() == BlockSpreader.Variant.ELVEN;
|
||||
boolean ultra = getVariant() == BlockSpreader.Variant.GAIA;
|
||||
boolean redstone = getVariant() == BlockSpreader.Variant.REDSTONE;
|
||||
int maxMana = ultra ? 640 : dreamwood ? 240 : 160;
|
||||
int color = redstone ? 0xFF2020 : dreamwood ? 0xFF45C4 : 0x20FF20;
|
||||
int ticksBeforeManaLoss = ultra ? 120 : dreamwood ? 80 : 60;
|
||||
float manaLossPerTick = ultra ? 20F : 4F;
|
||||
float motionModifier = ultra ? 2F : dreamwood ? 1.25F : 1F;
|
||||
BlockSpreader.Variant variant = getVariant();
|
||||
float gravity = 0F;
|
||||
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
|
||||
BurstProperties props = new BurstProperties(variant.burstMana, variant.preLossTicks, variant.lossPerTick, gravity, variant.motionModifier, variant.color);
|
||||
|
||||
ItemStack lens = itemHandler.getStackInSlot(0);
|
||||
if(!lens.isEmpty() && lens.getItem() instanceof ILensEffect)
|
||||
@@ -545,12 +536,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc) {
|
||||
String name = new ItemStack(getBlockState().getBlock()).getDisplayName().getString();
|
||||
int color;
|
||||
switch (getVariant()) {
|
||||
case REDSTONE: color = 0xFF0000; break;
|
||||
case ELVEN: color = 0xFF00AE; break;
|
||||
default: color = 0x00FF00; break;
|
||||
}
|
||||
int color = getVariant().hudColor;
|
||||
HUDHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name);
|
||||
|
||||
ItemStack lens = itemHandler.getStackInSlot(0);
|
||||
@@ -637,7 +623,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return getVariant() == BlockSpreader.Variant.GAIA ? ULTRA_MAX_MANA : MAX_MANA;
|
||||
return getVariant().manaCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user