Add IModelData to getParticleTexture (#5756)

This commit is contained in:
ichttt 2019-07-09 04:46:32 +02:00 committed by LexManos
parent 0463949ac3
commit d41fad51c2
6 changed files with 49 additions and 2 deletions

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/particle/DiggingParticle.java
+++ b/net/minecraft/client/particle/DiggingParticle.java
@@ -21,7 +21,7 @@
public DiggingParticle(World p_i46280_1_, double p_i46280_2_, double p_i46280_4_, double p_i46280_6_, double p_i46280_8_, double p_i46280_10_, double p_i46280_12_, BlockState p_i46280_14_) {
super(p_i46280_1_, p_i46280_2_, p_i46280_4_, p_i46280_6_, p_i46280_8_, p_i46280_10_, p_i46280_12_);
this.field_174847_a = p_i46280_14_;
- this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().func_178122_a(p_i46280_14_));
+ this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(p_i46280_14_, p_i46280_1_, new BlockPos(field_187126_f, field_187127_g, field_187128_h)));
this.field_70545_g = 1.0F;
this.field_70552_h = 0.6F;
this.field_70553_i = 0.6F;

View file

@ -0,0 +1,19 @@
--- a/net/minecraft/client/renderer/BlockModelShapes.java
+++ b/net/minecraft/client/renderer/BlockModelShapes.java
@@ -24,10 +24,16 @@
this.field_178128_c = p_i46245_1_;
}
+ @Deprecated
public TextureAtlasSprite func_178122_a(BlockState p_178122_1_) {
return this.func_178125_b(p_178122_1_).func_177554_e();
}
+ public TextureAtlasSprite getTexture(BlockState state, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) {
+ net.minecraftforge.client.model.data.IModelData data = net.minecraftforge.client.model.ModelDataManager.getModelData(world, pos);
+ return this.func_178125_b(state).getParticleTexture(data == null ? net.minecraftforge.client.model.data.EmptyModelData.INSTANCE : data);
+ }
+
public IBakedModel func_178125_b(BlockState p_178125_1_) {
IBakedModel ibakedmodel = this.field_178129_a.get(p_178125_1_);
if (ibakedmodel == null) {

View file

@ -72,8 +72,9 @@
}
if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) {
- this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(blockstate));
+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, blockstate, overlayPos))
this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(blockstate));
+ this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().getTexture(blockstate, field_78455_a.field_71441_e, overlayPos));
}
}

View file

@ -11,8 +11,12 @@
List<BakedQuad> func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_);
boolean func_177555_b();
@@ -21,7 +23,8 @@
@@ -19,9 +21,12 @@
boolean func_188618_c();
+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#getParticleTexture(net.minecraftforge.client.model.data.IModelData)}*/
+ @Deprecated
TextureAtlasSprite func_177554_e();
- ItemCameraTransforms func_177552_f();

View file

@ -29,6 +29,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IEnviromentBlockReader;
@ -62,4 +63,9 @@ public interface IForgeBakedModel
{
return tileData;
}
default TextureAtlasSprite getParticleTexture(@Nonnull IModelData data)
{
return getBakedModel().getParticleTexture();
}
}

View file

@ -101,6 +101,12 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
return originalModel.handlePerspective(cameraTransformType);
}
@Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data)
{
return originalModel.getParticleTexture(data);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData)