Add mind control overlay
This commit is contained in:
@@ -712,6 +712,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
public void initialiseLayers(){
|
public void initialiseLayers(){
|
||||||
LayerTiledOverlay.initialiseLayers(LayerStone::new);
|
LayerTiledOverlay.initialiseLayers(LayerStone::new);
|
||||||
LayerTiledOverlay.initialiseLayers(LayerFrost::new);
|
LayerTiledOverlay.initialiseLayers(LayerFrost::new);
|
||||||
|
LayerTiledOverlay.initialiseLayers(LayerMindControl::new);
|
||||||
LayerTiledOverlay.initialiseLayers(LayerSummonAnimation::new);
|
LayerTiledOverlay.initialiseLayers(LayerSummonAnimation::new);
|
||||||
LayerTiledOverlay.initialiseLayers(LayerDisintegrateAnimation::new);
|
LayerTiledOverlay.initialiseLayers(LayerDisintegrateAnimation::new);
|
||||||
}
|
}
|
||||||
|
|||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
package electroblob.wizardry.client.renderer.entity.layers;
|
||||||
|
|
||||||
|
import electroblob.wizardry.Wizardry;
|
||||||
|
import electroblob.wizardry.registry.WizardryPotions;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layer used to render the mind control overlay on creatures with the mind control effect.
|
||||||
|
*
|
||||||
|
* @author Electroblob
|
||||||
|
* @since Wizardry 4.3
|
||||||
|
*/
|
||||||
|
public class LayerMindControl extends LayerTiledOverlay<EntityLivingBase> {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/entity/mind_control_overlay.png");
|
||||||
|
|
||||||
|
public LayerMindControl(RenderLivingBase<?> renderer){
|
||||||
|
super(renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender(EntityLivingBase entity, float partialTicks){
|
||||||
|
return !entity.isInvisible() && entity.isPotionActive(WizardryPotions.mind_control);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getTexture(EntityLivingBase entity, float partialTicks){
|
||||||
|
return TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks,
|
||||||
|
float ageInTicks, float netHeadYaw, float headPitch, float scale){
|
||||||
|
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE);
|
||||||
|
|
||||||
|
PotionEffect effect = entity.getActivePotionEffect(WizardryPotions.mind_control);
|
||||||
|
if(effect != null){
|
||||||
|
GlStateManager.color(1, 1, 1, Math.min(1, (effect.getDuration() - partialTicks) / 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
super.doRenderLayer(entity, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||||
|
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyTextureSpaceTransformations(EntityLivingBase entity, float partialTicks){
|
||||||
|
float f = entity.ticksExisted + partialTicks;
|
||||||
|
GlStateManager.translate(f * 0.003f, f * 0.003f, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -82,6 +82,16 @@ public abstract class LayerTiledOverlay<T extends EntityLivingBase> implements L
|
|||||||
return false; // Normally it looks kind of weird because second layers typically have holes in them
|
return false; // Normally it looks kind of weird because second layers typically have holes in them
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows subclasses to perform additional transformations in the texture space before the model is rendered. This
|
||||||
|
* can be used for a creeper-charge-like effect. To do this, simply override this method and call the appropriate
|
||||||
|
* transformation method(s) (translate, rotate, scale) in {@link GlStateManager}. This method does nothing by
|
||||||
|
* default.
|
||||||
|
* @param entity The entity being rendered
|
||||||
|
* @param partialTicks The current partial tick time
|
||||||
|
*/
|
||||||
|
protected void applyTextureSpaceTransformations(T entity, float partialTicks){}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRenderLayer(T entity, float limbSwing, float limbSwingAmount, float partialTicks,
|
public void doRenderLayer(T entity, float limbSwing, float limbSwingAmount, float partialTicks,
|
||||||
float ageInTicks, float netHeadYaw, float headPitch, float scale){
|
float ageInTicks, float netHeadYaw, float headPitch, float scale){
|
||||||
@@ -143,6 +153,8 @@ public abstract class LayerTiledOverlay<T extends EntityLivingBase> implements L
|
|||||||
|
|
||||||
GlStateManager.scale(scaleX, scaleY, 1);
|
GlStateManager.scale(scaleX, scaleY, 1);
|
||||||
|
|
||||||
|
applyTextureSpaceTransformations(entity, partialTicks);
|
||||||
|
|
||||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW); // Switch back to the 3D model space
|
GlStateManager.matrixMode(GL11.GL_MODELVIEW); // Switch back to the 3D model space
|
||||||
|
|
||||||
boolean headWearHidden = false;
|
boolean headWearHidden = false;
|
||||||
|
|||||||
@@ -143,8 +143,11 @@ public final class WizardryPotions {
|
|||||||
registerPotion(registry, "mind_trick", new PotionMagicEffect(true, 0x601683,
|
registerPotion(registry, "mind_trick", new PotionMagicEffect(true, 0x601683,
|
||||||
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mind_trick.png")));
|
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mind_trick.png")));
|
||||||
|
|
||||||
registerPotion(registry, "mind_control", new PotionMagicEffect(true, 0x320b44,
|
registerPotion(registry, "mind_control", new PotionMagicEffectParticles(true, 0x320b44,
|
||||||
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mind_control.png")));
|
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mind_control.png")) {
|
||||||
|
@Override
|
||||||
|
public void spawnCustomParticle(World world, double x, double y, double z){} // We only want the syncing
|
||||||
|
});
|
||||||
|
|
||||||
registerPotion(registry, "font_of_mana", new PotionMagicEffect(false, 0xffe5bb,
|
registerPotion(registry, "font_of_mana", new PotionMagicEffect(false, 0xffe5bb,
|
||||||
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/font_of_mana.png")).setBeneficial());
|
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/font_of_mana.png")).setBeneficial());
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Reference in New Issue
Block a user