Skip to content

Commit

Permalink
Fix bore particles being missing textures for blocks like lit redston…
Browse files Browse the repository at this point in the history
…e ore
  • Loading branch information
TheCodex6824 committed Aug 19, 2024
1 parent 187c428 commit 2e196c7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private void initTransformers() {
transformers.add(EntityTransformers.ADVANCED_CROSSBOW_PROCESS_INTERACT_DEAD.get());
transformers.add(EntityTransformers.BORE_FIX_RUMBLE.get());
transformers.add(EntityTransformers.BORE_NO_EQUIP_SOUND.get());
transformers.add(EntityTransformers.BORE_PARTICLE_TEXTURE.get());
transformers.add(EntityTransformers.BORE_PROCESS_INTERACT_DEAD.get());
transformers.add(EntityTransformers.BORE_SPIRAL_MISSES.get());
transformers.add(EntityTransformers.CROSSBOW_PROCESS_INTERACT_DEAD.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
import com.mojang.authlib.GameProfile;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
Expand Down Expand Up @@ -263,6 +265,11 @@ public static float getRobeRotationDivisor(Entity entity) {
return f;
}

public static TextureAtlasSprite getBlockParticleTexture(TextureAtlasSprite old, IBlockState state) {
return Minecraft.getMinecraft().getBlockRendererDispatcher()
.getModelForState(state).getParticleTexture();
}

}

private static final String HOOKS_COMMON = Type.getInternalName(HooksCommon.class);
Expand Down Expand Up @@ -599,6 +606,40 @@ private static Supplier<ITransformer> makeEntityProcessInteractTransformer(Strin
);
};

public static final Supplier<ITransformer> BORE_PARTICLE_TEXTURE = () -> {
return new GenericStateMachineTransformer(
PatchStateMachine.builder(
new MethodDefinition(
"thaumcraft/client/fx/particles/FXBoreParticles",
false,
"<init>",
Type.VOID_TYPE,
Types.WORLD, Type.DOUBLE_TYPE, Type.DOUBLE_TYPE, Type.DOUBLE_TYPE,
Type.DOUBLE_TYPE, Type.DOUBLE_TYPE, Type.DOUBLE_TYPE,
Types.I_BLOCK_STATE, Type.INT_TYPE
)
)
.findNextMethodCall(TransformUtil.remapMethod(new MethodDefinition(
"thaumcraft/client/fx/particles/FXBoreParticles",
false,
"func_187117_a",
Type.VOID_TYPE,
Types.TEXTURE_ATLAS_SPRITE
)))
.insertInstructionsBefore(
new VarInsnNode(Opcodes.ALOAD, 14),
new MethodInsnNode(Opcodes.INVOKESTATIC,
HOOKS_CLIENT,
"getBlockParticleTexture",
Type.getMethodDescriptor(Types.TEXTURE_ATLAS_SPRITE, Types.TEXTURE_ATLAS_SPRITE,
Types.I_BLOCK_STATE),
false
)
)
.build()
);
};

public static final Supplier<ITransformer> BORE_SPIRAL_MISSES = () -> {
return new GenericStateMachineTransformer(
PatchStateMachine.builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ private Types() {}
public static final Type SUBSCRIBE_EVENT = Type.getType("Lnet/minecraftforge/fml/common/eventhandler/SubscribeEvent;");
public static final Type EVENT_PRIORITY = Type.getType("Lnet/minecraftforge/fml/common/eventhandler/EventPriority;");

public static final Type TEXTURE_ATLAS_SPRITE = Type.getType("Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;");

}

0 comments on commit 2e196c7

Please sign in to comment.