mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Fix pump rendering, pool cart rendering. Made pool cart spawn particles
This commit is contained in:
6 files changed
+28
-106
No files matched your search
@@ -38,7 +38,6 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
|
||||
|
||||
// Overrides for when we call this TESR without an actual pool
|
||||
public static PoolVariant forceVariant = PoolVariant.DEFAULT;
|
||||
public static boolean forceMana = false;
|
||||
public static int forceManaNumber = -1;
|
||||
|
||||
@Override
|
||||
@@ -63,16 +62,20 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
|
||||
boolean fab = pool == null ? forceVariant == PoolVariant.FABULOUS : pool.getWorld().getBlockState(pool.getPos()).getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
int color = 0xFFFFFF;
|
||||
|
||||
if (fab) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
if(pool != null)
|
||||
time += new Random(pool.getPos().getX() ^ pool.getPos().getY() ^ pool.getPos().getZ()).nextInt(100000);
|
||||
int color = Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
|
||||
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(pool == null ? ModBlocks.pool.getDefaultState().withProperty(BotaniaStateProps.POOL_VARIANT, forceVariant) : pool.getWorld().getBlockState(pool.getPos()));
|
||||
color = Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
|
||||
}
|
||||
|
||||
if (fab || forceManaNumber > -1) {
|
||||
int red = (color & 0xFF0000) >> 16;
|
||||
int green = (color & 0xFF00) >> 8;
|
||||
int blue = (color & 0xFF);
|
||||
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(pool == null ? ModBlocks.pool.getDefaultState().withProperty(BotaniaStateProps.POOL_VARIANT, forceVariant) : pool.getWorld().getBlockState(pool.getPos()));
|
||||
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(model, 1.0F, red / 255F, green / 255F, blue / 255F);
|
||||
}
|
||||
|
||||
@@ -86,8 +89,6 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
|
||||
cap = TilePool.MAX_MANA;
|
||||
|
||||
float waterLevel = (float) mana / (float) cap * 0.4F;
|
||||
if(forceMana)
|
||||
waterLevel = 0.4F;
|
||||
|
||||
float s = 1F / 16F;
|
||||
float v = 1F / 8F;
|
||||
@@ -138,7 +139,6 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
forceVariant = PoolVariant.DEFAULT;
|
||||
forceMana = false;
|
||||
forceManaNumber = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ import java.util.List;
|
||||
|
||||
public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAttachable, IThrottledPacket {
|
||||
|
||||
public static final Color PARTICLE_COLOR = new Color(0x00C6FF);
|
||||
public static final int MAX_MANA = 1000000;
|
||||
public static final int MAX_MANA_DILLUTED = 10000;
|
||||
|
||||
@@ -205,9 +206,8 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
double particleChance = 1F - (double) getCurrentMana() / (double) manaCap * 0.1;
|
||||
Color color = new Color(0x00C6FF);
|
||||
if(Math.random() > particleChance)
|
||||
Botania.proxy.wispFX(worldObj, pos.getX() + 0.3 + Math.random() * 0.5, pos.getY() + 0.6 + Math.random() * 0.25, pos.getZ() + Math.random(), color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F, 2F);
|
||||
Botania.proxy.wispFX(worldObj, pos.getX() + 0.3 + Math.random() * 0.5, pos.getY() + 0.6 + Math.random() * 0.25, pos.getZ() + Math.random(), PARTICLE_COLOR.getRed() / 255F, PARTICLE_COLOR.getGreen() / 255F, PARTICLE_COLOR.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F, 2F);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class TilePump extends TileMod {
|
||||
active = cmp.getBoolean(TAG_ACTIVE);
|
||||
if(worldObj != null && worldObj.isRemote)
|
||||
if(prevActive != active)
|
||||
;//asm.transition(active ? "moving" : "default");
|
||||
asm.transition(active ? "moving" : "default");
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
@@ -139,9 +139,4 @@ public class TilePump extends TileMod {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public IAnimationStateMachine asm() {
|
||||
// return asm;
|
||||
// }
|
||||
}
|
||||
@@ -23,15 +23,19 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.block.tile.mana.TilePump;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class EntityPoolMinecart extends EntityMinecart {
|
||||
|
||||
private static final int TRANSFER_RATE = 10000;
|
||||
@@ -83,6 +87,21 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
double particleChance = 1F - (double) getMana() / (double) TilePool.MAX_MANA * 0.1;
|
||||
Color color = TilePool.PARTICLE_COLOR;
|
||||
double x = MathHelper.floor_double(posX);
|
||||
double y = MathHelper.floor_double(posY);
|
||||
double z = MathHelper.floor_double(posZ);
|
||||
if(Math.random() > particleChance)
|
||||
Botania.proxy.wispFX(worldObj, x + 0.3 + Math.random() * 0.5, y + 0.85 + Math.random() * 0.25, z + Math.random(), color.getRed(), color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F, 2F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveMinecartOnRail(BlockPos pos) {
|
||||
super.moveMinecartOnRail(pos);
|
||||
|
||||
Reference in new issue
Block a user