[1.19] Allow custom outline rendering on EntityRenderers and BlockEntityRenderers (#8938)

This commit is contained in:
Dennis C authored and GitHub committed 2022-08-17 00:01:33 +02:00
1 parent 07254b36d7
commit 4e677a7558
4 files changed
+54 -1

No files matched your search

@@ -51,6 +51,16 @@
++this.f_109439_;
if (entity.f_19797_ == 0) {
entity.f_19790_ = entity.m_20185_();
@@ -1206,6 +_,9 @@
int i1 = i & 255;
outlinebuffersource.m_109929_(k, l, i1, 255);
} else {
+ if (this.m_109817_() && entity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ }
multibuffersource = multibuffersource$buffersource;
}
@@ -1226,6 +_,7 @@
List<BlockEntity> list = levelrenderer$renderchunkinfo.f_109839_.m_112835_().m_112773_();
if (!list.isEmpty()) {
@@ -59,7 +69,17 @@
BlockPos blockpos4 = blockentity1.m_58899_();
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
p_109600_.m_85836_();
@@ -1251,6 +_,7 @@
@@ -1242,6 +_,9 @@
};
}
}
+ if (this.m_109817_() && blockentity1.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ }
this.f_172946_.m_112267_(blockentity1, p_109601_, p_109600_, multibuffersource1);
p_109600_.m_85849_();
@@ -1251,9 +_,13 @@
synchronized(this.f_109468_) {
for(BlockEntity blockentity : this.f_109468_) {
@@ -67,6 +87,12 @@
BlockPos blockpos3 = blockentity.m_58899_();
p_109600_.m_85836_();
p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2);
+ if (this.m_109817_() && blockentity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ }
this.f_172946_.m_112267_(blockentity, p_109601_, p_109600_, multibuffersource$buffersource);
p_109600_.m_85849_();
}
@@ -1290,7 +_,8 @@
p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2);
PoseStack.Pose posestack$pose = p_109600_.m_85850_();
@@ -9,6 +9,7 @@ import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
@@ -174,4 +175,15 @@ public interface IForgeBlockEntity extends ICapabilitySerializable<CompoundTag>
{
return ModelData.EMPTY;
}
/**
* Returns whether this {@link BlockEntity} has custom outline rendering behavior.
*
* @param player the local player currently viewing this {@code BlockEntity}
* @return {@code true} to enable outline processing
*/
default boolean hasCustomOutlineRendering(Player player)
{
return false;
}
}
@@ -12,6 +12,7 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.Entity;
@@ -410,4 +411,17 @@ public interface IForgeEntity extends ICapabilitySerializable<CompoundTag>
{
return type.getSound(self(), action);
}
/**
* Returns whether this {@link Entity} has custom outline rendering behavior which does
* not use the existing automatic outline rendering based on {@link Entity#isCurrentlyGlowing()}
* and the entity's team color.
*
* @param player the local player currently viewing this {@code Entity}
* @return {@code true} to enable outline processing
*/
default boolean hasCustomOutlineRendering(Player player)
{
return false;
}
}
@@ -77,6 +77,7 @@ public net.minecraft.client.particle.ParticleEngine m_107381_(Lnet/minecraft/cor
public net.minecraft.client.particle.ParticleEngine$SpriteParticleRegistration
public net.minecraft.client.player.LocalPlayer m_8088_()I # getPermissionLevel
public net.minecraft.client.renderer.GameRenderer m_109128_(Lnet/minecraft/resources/ResourceLocation;)V # loadEffect
public net.minecraft.client.renderer.LevelRenderer m_109817_()Z # shouldShowEntityOutlines
protected-f net.minecraft.client.renderer.RenderStateShard f_110131_ # setupState
public net.minecraft.client.renderer.RenderStateShard$BooleanStateShard
public net.minecraft.client.renderer.RenderStateShard$CullStateShard