mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Misc rendering
This commit is contained in:
1 parent
fe16702db4
commit
a268149d73
13 files changed
+49
-79
No files matched your search
@@ -9,28 +9,17 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.model.IFlexibleBakedModel;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@@ -29,6 +29,7 @@ import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -44,8 +45,8 @@ public final class SubTileRadiusRenderHandler {
|
||||
return;
|
||||
BlockPos bPos = pos.getBlockPos();
|
||||
|
||||
ItemStack stackHeld = mc.thePlayer.getCurrentEquippedItem();
|
||||
if(stackHeld != null && stackHeld.getItem() == ModItems.twigWand && ItemTwigWand.getBindMode(stackHeld)) {
|
||||
ItemStack stackHeld = PlayerHelper.getFirstHeldItem(mc.thePlayer, ModItems.twigWand);
|
||||
if(stackHeld != null && ItemTwigWand.getBindMode(stackHeld)) {
|
||||
BlockPos coords = ItemTwigWand.getBoundTile(stackHeld);
|
||||
if(coords.getY() != -1) {
|
||||
bPos = coords;
|
||||
|
||||
@@ -458,10 +458,7 @@ public class ClientProxy extends CommonProxy {
|
||||
return;
|
||||
|
||||
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
|
||||
wisp.motionX = motionx;
|
||||
wisp.motionY = motiony;
|
||||
wisp.motionZ = motionz;
|
||||
|
||||
wisp.setSpeed(motionx, motiony, motionz);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ public class FXSparkle extends EntityFX {
|
||||
float f4;
|
||||
float f5;
|
||||
|
||||
public boolean noClip = false;
|
||||
|
||||
public FXSparkle(World world, double x, double y, double z, float size, float red, float green, float blue, int m) {
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
@@ -55,7 +57,7 @@ public class FXSparkle extends EntityFX {
|
||||
particleBlue = blue;
|
||||
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
|
||||
particleGravity = 0;
|
||||
motionX = motionY = motionZ = 0;
|
||||
xSpeed = ySpeed = zSpeed = 0;
|
||||
particleScale *= size;
|
||||
particleMaxAge = 3 * m;
|
||||
multiplier = m;
|
||||
@@ -135,30 +137,30 @@ public class FXSparkle extends EntityFX {
|
||||
prevPosZ = posZ;
|
||||
|
||||
if (particleAge++ >= particleMaxAge)
|
||||
setDead();
|
||||
setExpired();
|
||||
|
||||
motionY -= 0.04D * particleGravity;
|
||||
ySpeed -= 0.04D * particleGravity;
|
||||
|
||||
if (!noClip && !fake)
|
||||
pushOutOfBlocks(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
|
||||
|
||||
posX += motionX;
|
||||
posY += motionY;
|
||||
posZ += motionZ;
|
||||
posX += xSpeed;
|
||||
posY += ySpeed;
|
||||
posZ += zSpeed;
|
||||
|
||||
if (slowdown) {
|
||||
motionX *= 0.908000001907348633D;
|
||||
motionY *= 0.908000001907348633D;
|
||||
motionZ *= 0.908000001907348633D;
|
||||
xSpeed *= 0.908000001907348633D;
|
||||
ySpeed *= 0.908000001907348633D;
|
||||
zSpeed *= 0.908000001907348633D;
|
||||
|
||||
if (onGround) {
|
||||
motionX *= 0.69999998807907104D;
|
||||
motionZ *= 0.69999998807907104D;
|
||||
xSpeed *= 0.69999998807907104D;
|
||||
zSpeed *= 0.69999998807907104D;
|
||||
}
|
||||
}
|
||||
|
||||
if(fake && particleAge > 1)
|
||||
setDead();
|
||||
setExpired();
|
||||
}
|
||||
|
||||
public void setGravity(float value) {
|
||||
@@ -218,33 +220,33 @@ public class FXSparkle extends EntityFX {
|
||||
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
|
||||
if (var22 == 0) {
|
||||
motionX = -var25;
|
||||
motionY=motionZ=var26;
|
||||
xSpeed = -var25;
|
||||
ySpeed=zSpeed=var26;
|
||||
}
|
||||
|
||||
if (var22 == 1) {
|
||||
motionX = var25;
|
||||
motionY=motionZ=var26;
|
||||
xSpeed = var25;
|
||||
ySpeed=zSpeed=var26;
|
||||
}
|
||||
|
||||
if (var22 == 2) {
|
||||
motionY = -var25;
|
||||
motionX=motionZ=var26;
|
||||
ySpeed = -var25;
|
||||
xSpeed=zSpeed=var26;
|
||||
}
|
||||
|
||||
if (var22 == 3) {
|
||||
motionY = var25;
|
||||
motionX=motionZ=var26;
|
||||
ySpeed = var25;
|
||||
xSpeed=zSpeed=var26;
|
||||
}
|
||||
|
||||
if (var22 == 4) {
|
||||
motionZ = -var25;
|
||||
motionY=motionX=var26;
|
||||
zSpeed = -var25;
|
||||
ySpeed=xSpeed=var26;
|
||||
}
|
||||
|
||||
if (var22 == 5) {
|
||||
motionZ = var25;
|
||||
motionY=motionX=var26;
|
||||
zSpeed = var25;
|
||||
ySpeed=xSpeed=var26;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,7 +59,6 @@ public class FXWisp extends EntityFX {
|
||||
this.depthTest = depthTest;
|
||||
|
||||
moteHalfLife = particleMaxAge / 2;
|
||||
noClip = true;
|
||||
setSize(0.01F, 0.01F);
|
||||
Entity renderentity = FMLClientHandler.instance().getClient().getRenderViewEntity();
|
||||
|
||||
@@ -163,6 +162,12 @@ public class FXWisp extends EntityFX {
|
||||
particleGravity = value;
|
||||
}
|
||||
|
||||
public void setSpeed(float mx, float my, float mz) {
|
||||
xSpeed = mx;
|
||||
ySpeed = my;
|
||||
zSpeed = mz;
|
||||
}
|
||||
|
||||
boolean depthTest = true;
|
||||
public boolean distanceLimit = true;
|
||||
float moteParticleScale;
|
||||
|
||||
@@ -12,7 +12,6 @@ package vazkii.botania.client.render.entity;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderWither;
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
@@ -21,8 +20,6 @@ public class RenderPinkWither extends RenderWither {
|
||||
|
||||
private static final ResourceLocation resource = new ResourceLocation(LibResources.MODEL_PINK_WITHER);
|
||||
|
||||
int idk = -1;
|
||||
|
||||
public RenderPinkWither(RenderManager p_i46130_1_) {
|
||||
super(p_i46130_1_);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RenderPoolMinecart extends RenderMinecart<EntityPoolMinecart> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void func_180560_a(EntityPoolMinecart poolCart, float p_147910_2_, IBlockState state) {
|
||||
protected void func_188319_a(EntityPoolMinecart poolCart, float p_147910_2_, IBlockState state) {
|
||||
RenderTilePool.forceVariant = PoolVariant.DEFAULT;
|
||||
RenderTilePool.forceManaNumber = poolCart.getMana();
|
||||
TileEntityRendererDispatcher.instance.getSpecialRendererByClass(TilePool.class).renderTileEntityAt(null, poolCart.posX, poolCart.posY, poolCart.posZ, ClientTickHandler.partialTicks, -1);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
double time = ClientTickHandler.ticksInGame + par9;
|
||||
time += new Random(par1Entity.getEntityId()).nextInt();
|
||||
|
||||
float a = 0.1F + (1 - par1Entity.getDataWatcher().getWatchableObjectInt(EntitySpark.INVISIBILITY_DATA_WATCHER_KEY)) * 0.8F;
|
||||
float a = 0.1F + (1 - par1Entity.getDataManager().get(EntitySpark.INVSIBILITY)) * 0.8F;
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, (0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2) * a);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer<TileAvatar> {
|
||||
float s = 0.6F;
|
||||
GlStateManager.scale(s, s, s);
|
||||
GlStateManager.translate(-0.5F, 2.125F, 0F); // todo 1.8 tweak held item render
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.THIRD_PERSON);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND); // todo 1.9
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
@@ -30,12 +27,10 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.ISmartBlockModel;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
import net.minecraftforge.client.model.animation.Event;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -139,25 +134,6 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
|
||||
// Copied from AnimationTESR
|
||||
protected static BlockRendererDispatcher blockRenderer;
|
||||
|
||||
// Botania - expanded size to 15 to hold all states
|
||||
protected static final LoadingCache<Pair<IExtendedBlockState, IModelState>, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(15).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader<Pair<IExtendedBlockState, IModelState>, IBakedModel>()
|
||||
{
|
||||
public IBakedModel load(Pair<IExtendedBlockState, IModelState> key) throws Exception
|
||||
{
|
||||
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(key.getLeft().getClean());
|
||||
if(model instanceof ISmartBlockModel)
|
||||
{
|
||||
model = ((ISmartBlockModel)model).handleBlockState(key.getLeft().withProperty(Properties.AnimationProperty, key.getRight()));
|
||||
}
|
||||
return model;
|
||||
}
|
||||
});
|
||||
|
||||
private static IBakedModel getModel(IExtendedBlockState state, IModelState modelState)
|
||||
{
|
||||
return modelCache.getUnchecked(Pair.of(state, modelState));
|
||||
}
|
||||
|
||||
private void renderAnimatedModel(TileCorporeaCrystalCube te, double x, double y, double z, float partialTick) {
|
||||
// From FastTESR.renderTileEntityAt
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
@@ -197,11 +173,12 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer<Til
|
||||
Pair<IModelState, Iterable<Event>> pair = te.asm().apply(time);
|
||||
// handleEvents(te, time, pair.getRight());
|
||||
|
||||
IBakedModel model = getModel(exState, pair.getLeft());
|
||||
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
|
||||
exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());
|
||||
|
||||
worldRenderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
|
||||
|
||||
blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, worldRenderer, false);
|
||||
blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, worldRenderer, false);
|
||||
}
|
||||
}
|
||||
// End inline AnimationTESR.renderTileEntityFast
|
||||
|
||||
@@ -74,6 +74,6 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
|
||||
|
||||
ShaderHelper.releaseShader();
|
||||
GlStateManager.popMatrix();
|
||||
} else super.renderSkull(par1, par2, par3, par4, par5, par6, gameProfile, digProgress);
|
||||
} else super.renderSkull(par1, par2, par3, par4, par5, par6, gameProfile, digProgress, 0); // todo 1.9 last parameter
|
||||
}
|
||||
}
|
||||
@@ -42,8 +42,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
switch(ID) {
|
||||
case LibGuiIDs.LEXICON :
|
||||
GuiLexicon lex = GuiLexicon.currentOpenLexicon;
|
||||
return lex;
|
||||
return GuiLexicon.currentOpenLexicon;
|
||||
case LibGuiIDs.CRAFTING_HALO :
|
||||
return new GuiCraftingHalo(player.inventory, world);
|
||||
case LibGuiIDs.FLOWER_BAG :
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
*/
|
||||
package vazkii.botania.common.world;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderFlat;
|
||||
|
||||
@@ -36,7 +39,7 @@ public class WorldTypeSkyblock extends WorldType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpawnFuzz() {
|
||||
public int getSpawnFuzz(WorldServer world, MinecraftServer server) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -46,7 +49,7 @@ public class WorldTypeSkyblock extends WorldType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
|
||||
public IChunkGenerator getChunkGenerator(World world, String generatorOptions) {
|
||||
return new ChunkProviderFlat(world, world.getSeed(), false, "3;minecraft:air;");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user