mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Added infrared goggles
This commit is contained in:
parent
c4ef6cd863
commit
6d3ef21444
11 changed files with 94 additions and 5 deletions
|
@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.ItemInfraredGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -34,12 +35,14 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
||||||
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
||||||
private static final float[] COLOR_ITEM = new float[]{0F, 124F/255F, 16F/255F};
|
private static final float[] COLOR_ITEM = new float[]{0F, 124F/255F, 16F/255F};
|
||||||
private static final float[] COLOR_FLUIDS = new float[]{0F, 97F/255F, 198F/255F};
|
private static final float[] COLOR_FLUIDS = new float[]{0F, 97F/255F, 198F/255F};
|
||||||
|
private static final float[] COLOR_INFRARED = new float[]{209F/255F, 179F/255F, 239F/255F};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if(tile instanceof TileEntityLaserRelay){
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
||||||
boolean hasInvis = false;
|
boolean hasInvis = false;
|
||||||
|
boolean hasGoggles = ItemInfraredGoggles.isWearing(Minecraft.getMinecraft().player);
|
||||||
|
|
||||||
ItemStack upgrade = relay.slots.getStackInSlot(0);
|
ItemStack upgrade = relay.slots.getStackInSlot(0);
|
||||||
if(StackUtil.isValid(upgrade)){
|
if(StackUtil.isValid(upgrade)){
|
||||||
|
@ -73,10 +76,10 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
||||||
ItemStack secondUpgrade = ((TileEntityLaserRelay)secondTile).slots.getStackInSlot(0);
|
ItemStack secondUpgrade = ((TileEntityLaserRelay)secondTile).slots.getStackInSlot(0);
|
||||||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
||||||
|
|
||||||
if(!hasInvis || !otherInvis){
|
if(hasGoggles || !hasInvis || !otherInvis){
|
||||||
float[] color = relay.type == LaserType.ITEM ? COLOR_ITEM : (relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR);
|
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : (relay.type == LaserType.ITEM ? COLOR_ITEM : (relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR));
|
||||||
|
|
||||||
AssetUtil.renderLaser(first.getX()+0.5, first.getY()+0.5, first.getZ()+0.5, second.getX()+0.5, second.getY()+0.5, second.getZ()+0.5, 120, 0.35F, 0.05, color);
|
AssetUtil.renderLaser(first.getX()+0.5, first.getY()+0.5, first.getZ()+0.5, second.getX()+0.5, second.getY()+0.5, second.getZ()+0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ public class CreativeTab extends CreativeTabs{
|
||||||
this.add(InitItems.itemMiningLens);
|
this.add(InitItems.itemMiningLens);
|
||||||
this.add(InitItems.itemLaserWrench);
|
this.add(InitItems.itemLaserWrench);
|
||||||
this.add(InitItems.itemLaserUpgradeInvisibility);
|
this.add(InitItems.itemLaserUpgradeInvisibility);
|
||||||
|
this.add(InitItems.itemInfraredGoggles);
|
||||||
this.add(InitItems.itemCrateKeeper);
|
this.add(InitItems.itemCrateKeeper);
|
||||||
this.add(InitItems.itemChestToCrateUpgrade);
|
this.add(InitItems.itemChestToCrateUpgrade);
|
||||||
this.add(InitItems.itemSmallToMediumCrateUpgrade);
|
this.add(InitItems.itemSmallToMediumCrateUpgrade);
|
||||||
|
|
|
@ -194,10 +194,12 @@ public final class InitItems{
|
||||||
public static Item itemVoidBag;
|
public static Item itemVoidBag;
|
||||||
public static Item itemFillingWand;
|
public static Item itemFillingWand;
|
||||||
public static Item itemLaserUpgradeInvisibility;
|
public static Item itemLaserUpgradeInvisibility;
|
||||||
|
public static Item itemInfraredGoggles;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
|
itemInfraredGoggles = new ItemInfraredGoggles("item_infrared_goggles");
|
||||||
itemLaserUpgradeInvisibility = new ItemLaserRelayUpgrade("item_laser_upgrade_invisibility");
|
itemLaserUpgradeInvisibility = new ItemLaserRelayUpgrade("item_laser_upgrade_invisibility");
|
||||||
itemFillingWand = new ItemFillingWand("item_filling_wand");
|
itemFillingWand = new ItemFillingWand("item_filling_wand");
|
||||||
itemBag = new ItemBag("item_bag", false);
|
itemBag = new ItemBag("item_bag", false);
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* This file ("ItemInfraredGoggles.java") is part of the Actually Additions mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://ellpeck.de/actaddlicense
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015-2017 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ItemInfraredGoggles extends ItemArmorAA{
|
||||||
|
|
||||||
|
public ItemInfraredGoggles(String name){
|
||||||
|
super(name, InitArmorMaterials.armorMaterialGoggles, 0, StackUtil.getNull());
|
||||||
|
this.setMaxDamage(0);
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onClientTick(ClientTickEvent event){
|
||||||
|
EntityPlayer player = ActuallyAdditions.proxy.getCurrentPlayer();
|
||||||
|
if(player != null && isWearing(player)){
|
||||||
|
double innerRange = 8;
|
||||||
|
double remRange = innerRange+2;
|
||||||
|
|
||||||
|
AxisAlignedBB aabb = new AxisAlignedBB(player.posX-remRange, player.posY-remRange, player.posZ-remRange, player.posX+remRange, player.posY+remRange, player.posZ+remRange);
|
||||||
|
List<Entity> entities = player.world.getEntitiesWithinAABB(Entity.class, aabb);
|
||||||
|
|
||||||
|
for(Entity entity : entities){
|
||||||
|
if(entity != player){
|
||||||
|
if(entity.getDistanceSq(player.posX, player.posY, player.posZ) <= innerRange*innerRange){
|
||||||
|
entity.setGlowing(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
entity.setGlowing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWearing(EntityPlayer player){
|
||||||
|
ItemStack face = player.inventory.armorInventory.get(3);
|
||||||
|
return StackUtil.isValid(face) && face.getItem() == InitItems.itemInfraredGoggles;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
return EnumRarity.RARE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemArmor;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -54,7 +55,6 @@ public class ItemArmorAA extends ItemArmor{
|
||||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return this.rarity;
|
return this.rarity;
|
||||||
|
@ -62,6 +62,6 @@ public class ItemArmorAA extends ItemArmor{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
|
||||||
return ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
return StackUtil.isValid(this.repairItem) && ItemUtil.areItemsEqual(this.repairItem, stack, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ public final class InitArmorMaterials{
|
||||||
public static ArmorMaterial armorMaterialCrystalGreen;
|
public static ArmorMaterial armorMaterialCrystalGreen;
|
||||||
public static ArmorMaterial armorMaterialCrystalWhite;
|
public static ArmorMaterial armorMaterialCrystalWhite;
|
||||||
|
|
||||||
|
public static ArmorMaterial armorMaterialGoggles;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Armor Materials...");
|
ModUtil.LOGGER.info("Initializing Armor Materials...");
|
||||||
|
|
||||||
|
@ -44,6 +46,8 @@ public final class InitArmorMaterials{
|
||||||
armorMaterialCrystalBlack = addArmorMaterial("armorMaterialCrystalBlack", ModUtil.MOD_ID+":armor_crystal_black", 12, new int[]{1, 3, 4, 1}, 13, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
armorMaterialCrystalBlack = addArmorMaterial("armorMaterialCrystalBlack", ModUtil.MOD_ID+":armor_crystal_black", 12, new int[]{1, 3, 4, 1}, 13, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
||||||
armorMaterialCrystalGreen = addArmorMaterial("armorMaterialCrystalGreen", ModUtil.MOD_ID+":armor_crystal_green", 60, new int[]{6, 9, 9, 4}, 18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
armorMaterialCrystalGreen = addArmorMaterial("armorMaterialCrystalGreen", ModUtil.MOD_ID+":armor_crystal_green", 60, new int[]{6, 9, 9, 4}, 18, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
||||||
armorMaterialCrystalWhite = addArmorMaterial("armorMaterialCrystalWhite", ModUtil.MOD_ID+":armor_crystal_white", 18, new int[]{3, 6, 6, 3}, 11, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
armorMaterialCrystalWhite = addArmorMaterial("armorMaterialCrystalWhite", ModUtil.MOD_ID+":armor_crystal_white", 18, new int[]{3, 6, 6, 3}, 11, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
||||||
|
|
||||||
|
armorMaterialGoggles = addArmorMaterial("armorMaterialGoggles", ModUtil.MOD_ID+":armor_goggles", 0, new int[]{0, 0, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip){
|
private static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip){
|
||||||
|
|
|
@ -521,6 +521,7 @@ item.actuallyadditions.item_mining_lens.name=Lens of the Miner
|
||||||
item.actuallyadditions.item_more_damage_lens.name=Lens of the Killer
|
item.actuallyadditions.item_more_damage_lens.name=Lens of the Killer
|
||||||
item.actuallyadditions.item_filling_wand.name=Handheld Filler
|
item.actuallyadditions.item_filling_wand.name=Handheld Filler
|
||||||
item.actuallyadditions.item_laser_upgrade_invisibility.name=Laser Relay Modifier: Invisibility
|
item.actuallyadditions.item_laser_upgrade_invisibility.name=Laser Relay Modifier: Invisibility
|
||||||
|
item.actuallyadditions.item_infrared_goggles.name=Infrared Goggles
|
||||||
|
|
||||||
#Tooltips
|
#Tooltips
|
||||||
tooltip.actuallyadditions.onSuffix.desc=On
|
tooltip.actuallyadditions.onSuffix.desc=On
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "actuallyadditions:item/standard_item",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "actuallyadditions:items/item_infrared_goggles"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 357 B |
Binary file not shown.
After Width: | Height: | Size: 526 B |
Binary file not shown.
After Width: | Height: | Size: 249 B |
Loading…
Reference in a new issue