mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Fix gaia head rendering on players, additionally now renders correctly on mobs that can wear skulls
This commit is contained in:
1 parent
7cabf5f736
commit
cd435822d7
7 files changed
+12
-151
No files matched your search
@@ -12,7 +12,6 @@ package vazkii.botania.client.core.proxy;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.PlayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
@@ -43,7 +42,6 @@ import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.fx.FXLightning;
|
||||
import vazkii.botania.client.render.entity.LayerGaiaHead;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
@@ -73,11 +71,6 @@ public class ClientProxy implements IProxy {
|
||||
public static boolean jingleTheBells = false;
|
||||
public static boolean dootDoot = false;
|
||||
|
||||
private static final BipedModel EMPTY_MODEL = new BipedModel();
|
||||
static {
|
||||
EMPTY_MODEL.setVisible(false);
|
||||
}
|
||||
|
||||
public static KeyBinding CORPOREA_REQUEST;
|
||||
|
||||
@Override
|
||||
@@ -134,14 +127,12 @@ public class ClientProxy implements IProxy {
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler(render));
|
||||
render.addLayer(new LayerTerraHelmet(render));
|
||||
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
|
||||
|
||||
render = skinMap.get("slim");
|
||||
render.addLayer(new ContributorFancinessHandler(render));
|
||||
if(Botania.curiosLoaded)
|
||||
render.addLayer(new BaubleRenderHandler(render));
|
||||
render.addLayer(new LayerTerraHelmet(render));
|
||||
render.addLayer(new LayerGaiaHead(render, render.getEntityModel().bipedHead));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,11 +188,6 @@ public class ClientProxy implements IProxy {
|
||||
return Minecraft.getInstance().gameSettings.renderDistanceChunks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BipedModel getEmptyModelBiped() {
|
||||
return EMPTY_MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
world.addParticle(particleData, true, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.render.tile.RenderTileGaiaHead;
|
||||
import vazkii.botania.common.block.BlockGaiaHead;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class LayerGaiaHead extends LayerRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> {
|
||||
|
||||
private final RendererModel modelRenderer;
|
||||
|
||||
public LayerGaiaHead(IEntityRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> renderer,
|
||||
RendererModel modelRenderer)
|
||||
{
|
||||
super(renderer);
|
||||
this.modelRenderer = modelRenderer;
|
||||
}
|
||||
|
||||
// Copied from LayerCustomHead, edits noted
|
||||
@Override
|
||||
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = player.getItemStackFromSlot(EquipmentSlotType.HEAD);
|
||||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() == ModBlocks.gaiaHead.asItem()) // Botania - check for head
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
GlStateManager.translatef(0.0F, 0.2F, 0.0F);
|
||||
}
|
||||
|
||||
/*boolean flag = player instanceof EntityVillager || player instanceof EntityZombie && ((EntityZombie)player).isVillager();
|
||||
|
||||
if (player.isChild() && !(player instanceof EntityVillager))
|
||||
{
|
||||
float f = 2.0F;
|
||||
float f1 = 1.4F;
|
||||
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
|
||||
GlStateManager.scale(f1 / f, f1 / f, f1 / f);
|
||||
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
|
||||
} Botania - N/A */
|
||||
|
||||
modelRenderer.postRender(0.0625F);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
float f2 = 1.1875F;
|
||||
GlStateManager.scalef(f2, -f2, -f2);
|
||||
|
||||
// Botania - remove if check for skull and else branch. Check done above.
|
||||
|
||||
/*if (flag)
|
||||
{
|
||||
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
|
||||
} Botania - N/A */
|
||||
|
||||
/*GameProfile gameprofile = null;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
|
||||
|
||||
if (nbttagcompound.hasKey("SkullOwner", 10))
|
||||
{
|
||||
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
|
||||
}
|
||||
else if (nbttagcompound.hasKey("SkullOwner", 8))
|
||||
{
|
||||
String s = nbttagcompound.getString("SkullOwner");
|
||||
|
||||
if (!StringUtils.isNullOrEmpty(s))
|
||||
{
|
||||
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
|
||||
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
|
||||
}
|
||||
}
|
||||
} Botania - Don't do skin stuff */
|
||||
|
||||
// Botania - use gaia TESR
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
((RenderTileGaiaHead) (TileEntityRenderer) TileEntityRendererDispatcher.instance.getRenderer(TileGaiaHead.class))
|
||||
.render(-0.5F, 0.0F, -0.5F, Direction.UP, 180.0F, BlockGaiaHead.GAIA_TYPE, null, -1, limbSwing);
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -25,35 +25,31 @@ import net.minecraft.entity.monster.SkeletonEntity;
|
||||
import net.minecraft.entity.monster.WitherSkeletonEntity;
|
||||
import net.minecraft.entity.monster.ZombieEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
import vazkii.botania.common.block.BlockGaiaHead;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RenderTileGaiaHead extends SkullTileEntityRenderer {
|
||||
public static class TEISR extends ItemStackTileEntityRenderer {
|
||||
@Override
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() == ModBlocks.gaiaHead.asItem()) {
|
||||
TileEntityRenderer r = TileEntityRendererDispatcher.instance.getRenderer(TileGaiaHead.class);
|
||||
((RenderTileGaiaHead) r).render(0, 0, 0, null, 180, BlockGaiaHead.GAIA_TYPE, null, -1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
private SkullTileEntityRenderer original = null;
|
||||
|
||||
@Override
|
||||
public void setRendererDispatcher(@Nonnull TileEntityRendererDispatcher dispatcher) {
|
||||
rendererDispatcher = dispatcher;
|
||||
// Do not set `instance` to us, interferes with vanilla skulls
|
||||
original = instance;
|
||||
super.setRendererDispatcher(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float x, float y, float z, @Nullable Direction facing, float rotationIn, SkullBlock.ISkullType type, @Nullable GameProfile profile, int destroyStage, float animationProgress) {
|
||||
// we overwrite the vanilla `instance` singleton in setRendererDispatcher, so call back to the original one if type isn't gaia
|
||||
if (type != BlockGaiaHead.GAIA_TYPE) {
|
||||
original.render(x, y, z, facing, rotationIn, type, profile, destroyStage, animationProgress);
|
||||
return;
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Entity view = mc.getRenderViewEntity();
|
||||
|
||||
@@ -76,7 +72,7 @@ public class RenderTileGaiaHead extends SkullTileEntityRenderer {
|
||||
type = SkullBlock.Types.DRAGON;
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
super.render(x, y, z, facing, rotationIn, type, profile, destroyStage, animationProgress);
|
||||
original.render(x, y, z, facing, rotationIn, type, profile, destroyStage, animationProgress);
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,6 @@ public interface IProxy {
|
||||
|
||||
int getClientRenderDistance();
|
||||
|
||||
Object getEmptyModelBiped();
|
||||
|
||||
// Side-safe version of world.addParticle with noDistanceLimit flag set to true
|
||||
default void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {}
|
||||
}
|
||||
@@ -59,9 +59,4 @@ public class ServerProxy implements IProxy {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEmptyModelBiped() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,11 +32,4 @@ public class ItemGaiaHead extends WallOrFloorItem {
|
||||
public EquipmentSlotType getEquipmentSlot(ItemStack stack) {
|
||||
return EquipmentSlotType.HEAD;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BipedModel getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, BipedModel _default) {
|
||||
return (BipedModel) Botania.proxy.getEmptyModelBiped();
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ public final class ModItems {
|
||||
register(r, new ItemManaweaveArmor(EquipmentSlotType.LEGS, unstackable()), LibItemNames.MANAWEAVE_LEGS);
|
||||
register(r, new ItemManaweaveArmor(EquipmentSlotType.FEET, unstackable()), LibItemNames.MANAWEAVE_BOOTS);
|
||||
register(r, new ItemAutocraftingHalo(unstackable()), LibItemNames.AUTOCRAFTING_HALO);
|
||||
Item head = new ItemGaiaHead(ModBlocks.gaiaHead, ModBlocks.gaiaHeadWall, defaultBuilder().setTEISR(() -> RenderTileGaiaHead.TEISR::new));
|
||||
Item head = new ItemGaiaHead(ModBlocks.gaiaHead, ModBlocks.gaiaHeadWall, defaultBuilder().rarity(Rarity.UNCOMMON));
|
||||
register(r, head, ModBlocks.gaiaHead.getRegistryName());
|
||||
register(r, new ItemSextant(unstackable()), LibItemNames.SEXTANT);
|
||||
register(r, new ItemSpeedUpBelt(unstackable()), LibItemNames.SPEED_UP_BELT);
|
||||
|
||||
Reference in new issue
Block a user