Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EffectComponent implements ICustomComponent {
- IVariable effectID;
- private transient TextureAtlasSprite effectSprite;
- private transient Effect effect;
- private transient static final ResourceLocation EFFECT_BACKGROUND = new ResourceLocation("patchouli", "textures/gui/crafting.png");
- @Override
- public void build(int i, int i1, int i2) {
- this.effect = ForgeRegistries.POTIONS.getValue(new ResourceLocation(effectID.asString()));
- this.effectSprite = Minecraft.getInstance().getPotionSpriteUploader().getSprite(effect);
- }
- private ITextComponent renderTooltip(Effect effect) {
- IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(effect.getName());
- return iformattabletextcomponent;
- }
- @Override
- public void render(MatrixStack matrixStack, IComponentRenderContext context, float pticks, int mouseX, int mouseY) {
- Minecraft.getInstance().getTextureManager().bindTexture(EFFECT_BACKGROUND);
- AbstractGui.drawTexture(matrixStack, 0, 0, 1,99,64, 32, 128, 256);
- Minecraft.getInstance().getTextureManager().bindTexture(this.effectSprite.getAtlas().getId());
- AbstractGui.drawSprite(matrixStack, 0, 0, 1, 18, 18, this.effectSprite);
- }
- @Override
- public void onVariablesAvailable(UnaryOperator<IVariable> lookup) {
- lookup.apply(effectID);
- }
- }
Add Comment
Please, Sign In to add comment