Merge remote-tracking branch 'origin/master' into Telepad
Conflicts: src/main/java/crazypants/enderio/EnderIO.java src/main/java/crazypants/enderio/enderface/BlockEnderIO.java src/main/java/crazypants/enderio/teleport/BlockTravelAnchor.java src/main/java/crazypants/enderio/teleport/TravelEntitySpecialRenderer.java src/main/java/crazypants/gui/GuiContainerBase.java src/main/java/crazypants/gui/IGuiScreen.java
No files matched your search
@@ -1886,65 +1886,6 @@ addOreDictionaryTooltips=true
|
||||
</recipe>
|
||||
</recipeGroup>
|
||||
|
||||
<recipeGroup name="Engineer's Toolbox">
|
||||
|
||||
<!-- Metals -->
|
||||
<recipe name="NickelOre" energyCost="3600">
|
||||
<input>
|
||||
<itemStack oreDictionary="oreNickel" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustNickel" number="2" />
|
||||
<itemStack oreDictionary="dustIron" number="1" chance="0.05" />
|
||||
</output>
|
||||
</recipe>
|
||||
<recipe name="AluminumOre" energyCost="3600">
|
||||
<input>
|
||||
<itemStack oreDictionary="oreAluminum" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustAluminum" number="2" />
|
||||
</output>
|
||||
</recipe>
|
||||
|
||||
<!-- Alloys and Ingots -->
|
||||
<recipe name="NickelIngot" energyCost="2400">
|
||||
<input>
|
||||
<itemStack oreDictionary="ingotNickel" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustNickel" number="1" />
|
||||
</output>
|
||||
</recipe>
|
||||
<recipe name="AluminumIngot" energyCost="2400">
|
||||
<input>
|
||||
<itemStack oreDictionary="ingotAluminum" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustAluminum" number="1" />
|
||||
</output>
|
||||
</recipe>
|
||||
|
||||
|
||||
<!-- Blocks -->
|
||||
<recipe name="NickelBlock" energyCost="3600">
|
||||
<input>
|
||||
<itemStack oreDictionary="blockNickel" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustNickel" number="9" />
|
||||
</output>
|
||||
</recipe>
|
||||
<recipe name="AluminumBlock" energyCost="3600">
|
||||
<input>
|
||||
<itemStack oreDictionary="blockAluminum" />
|
||||
</input>
|
||||
<output>
|
||||
<itemStack oreDictionary="dustAluminum" number="9" />
|
||||
</output>
|
||||
</recipe>
|
||||
</recipeGroup>
|
||||
|
||||
<recipeGroup name="BigReactors">
|
||||
<!-- Metals -->
|
||||
<recipe name="YelloriteOre" energyCost="3600">
|
||||
|
||||
@@ -104,6 +104,7 @@ enderio.itemGasConduit.tooltip.detailed.line1=Transfers Mekanism-compatible gase
|
||||
|
||||
enderio.itemMEConduit.name=ME Conduit
|
||||
enderio.itemMEConduitDense.name=Dense ME Conduit
|
||||
enderio.itemMEConduit.channelsUsed={0,number} of {1,number} Channels
|
||||
|
||||
//Entity
|
||||
entity.witherSkeleton.name=Wither Skeleton
|
||||
@@ -303,6 +304,8 @@ enderio.capbank.change=I/O
|
||||
enderio.capbank.iodisplay.stable=I/O
|
||||
enderio.capbank.iodisplay.gain=In
|
||||
enderio.capbank.iodisplay.loss=Out
|
||||
enderio.capbank.iodisplay.input=Input
|
||||
enderio.capbank.iodisplay.output=Output
|
||||
|
||||
tile.blockWirelessCharger.name=Wireless Charger
|
||||
tile.blockWirelessCharger.tooltip.detailed.line1=Charges items in nearby
|
||||
@@ -398,6 +401,7 @@ enderio.farm.note.noSeeds=No Seeds
|
||||
enderio.farm.note.noAxe=No Axe
|
||||
enderio.farm.note.noHoe=No Hoe
|
||||
enderio.farm.note.noPower=No Power
|
||||
enderio.farm.gui.baseUse=Base Use:
|
||||
|
||||
tile.blockTank.name=Fluid Tank
|
||||
tile.blockTank.advanced.name=Pressurized Fluid Tank
|
||||
@@ -719,7 +723,7 @@ enderio.gui.simple.out=Max Out:
|
||||
enderio.gui.available=Available
|
||||
enderio.gui.disabled=Disabled
|
||||
enderio.gui.enabled=Enabled
|
||||
enderio.gui.max=Max:
|
||||
enderio.gui.max=Max:
|
||||
enderio.gui.progress=Progress {0,number}%
|
||||
enderio.gui.receive=Receive
|
||||
enderio.gui.send=Send
|
||||
@@ -834,9 +838,9 @@ enderio.gui.alloy.mode.alloy=Alloys Only
|
||||
enderio.gui.alloy.mode.furnace=Furnace Only
|
||||
|
||||
//Vacuum chest
|
||||
enderio.gui.vacuum.range=Suction strength
|
||||
enderio.gui.vacuum.range=Suction Strength
|
||||
enderio.gui.vacuum.header.chest=Vacuum Chest
|
||||
enderio.gui.vacuum.header.filter=Item filter
|
||||
enderio.gui.vacuum.header.filter=Item Filter
|
||||
enderio.gui.vacuum.header.range=Range
|
||||
|
||||
//Vat
|
||||
|
||||
@@ -0,0 +1,878 @@
|
||||
//*** Ender IO *****//
|
||||
|
||||
//Power
|
||||
enderio.power.rf=RF
|
||||
enderio.power.tick=/t
|
||||
enderio.power.maxOutput=Saída Máxima
|
||||
enderio.power.generates=Gera
|
||||
enderio.power.generation_rate=a
|
||||
|
||||
//Ender IO / Enderface
|
||||
tile.blockEnderIo.name=IO do Fim
|
||||
tile.blockEnderIo.tooltip.detailed.line1=Permite acesso remoto a blocos
|
||||
tile.blockEnderIo.tooltip.detailed.line2=próximos
|
||||
tile.blockEnderIo.tooltip.detailed.line3=Usado com as Âncoras de Viagem ou
|
||||
tile.blockEnderIo.tooltip.detailed.line4=o Cajado da Viagem
|
||||
|
||||
item.enderio.itemEnderface.name=Interfim
|
||||
|
||||
//Conduits
|
||||
enderio.blockConduitBundle=Conjunto de Condutos
|
||||
enderio.blockConduitFacade=Fachada de Condutos
|
||||
item.enderio.itemConduitFacade.name=Fachada de Condutos
|
||||
item.enderio.itemConduitFacade.tooltip.detailed.line1=Pintada na Máquina de Pintura
|
||||
item.enderio.itemConduitFacade.tooltip.detailed.line2=Clica com o botão direito num conduto para colocar
|
||||
item.enderio.itemConduitFacade.tooltip.detailed.line3=Escondida quando uma chave ou conduto
|
||||
item.enderio.itemConduitFacade.tooltip.detailed.line4=está equipada
|
||||
|
||||
enderio.itemPowerConduit.name=Conduto de Energia
|
||||
enderio.itemPowerConduitEnhanced.name=Conduto de Energia Melhorado
|
||||
enderio.itemPowerConduitEnder.name=Conduto de Energia do Fim
|
||||
|
||||
enderio.itemRedstoneConduit.name=Conduto de Redstone
|
||||
enderio.itemRedstoneConduitSwitch.name=Interruptor de Conduto
|
||||
enderio.itemRedstoneConduitInsulated.name=Conduto de Redstone Isolado
|
||||
|
||||
enderio.itemLiquidConduit.name=Conduto de Fluidos
|
||||
enderio.itemLiquidConduitAdvanced.name=Conduto de Fluidos Pressurizado
|
||||
enderio.itemLiquidConduitEnder.name=Conduto de Fluidos do Fim
|
||||
enderio.itemLiquidConduit.lockedType=Tipo de fluido trancado para
|
||||
enderio.itemLiquidConduit.unlockedType=Tipo de fluido destrancado
|
||||
enderio.itemLiquidConduit.lockedWaila=Trancado para
|
||||
|
||||
enderio.itemLiquidConduit.tooltip.maxExtract=Extração Máxima:
|
||||
enderio.itemLiquidConduit.tooltip.maxIo=IO Máximo:
|
||||
enderio.itemLiquidConduit.tooltip.detailed.line1=Fluxo dos fluidos respeita a gravidade
|
||||
enderio.itemLiquidConduit.tooltip.detailed.line2=Taxa de fluxo dependente da viscosidade
|
||||
enderio.itemLiquidConduit.tooltip.detailed.line3=do fluido
|
||||
|
||||
enderio.itemLiquidConduitEnder.tooltip.detailed.line1=Teletransporte de fluidos instantâneo
|
||||
enderio.itemLiquidConduitEnder.tooltip.detailed.line2=permite que múltiplos fluidos sejam
|
||||
enderio.itemLiquidConduitEnder.tooltip.detailed.line3=transportados na mesma linha
|
||||
|
||||
enderio.itemItemConduit.name=Conduto de Itens
|
||||
|
||||
enderio.filterUpgradeBasic.name=Filtro de Itens Básico
|
||||
enderio.filterUpgradeAdvanced.name=Filtro de Itens Avançado
|
||||
enderio.itemConduitFilterUpgrade=Melhoria para condutos de itens
|
||||
|
||||
|
||||
enderio.itemConduitFilterUpgrade.configured=Configurado
|
||||
enderio.itemConduitFilterUpgrade.clearConfigMethod=Coloque em uma grade de criação para limpar
|
||||
enderio.itemConduitFilterUpgrade.clearConfigWarning=Isso vai limpar todas as configurações de filtragem!
|
||||
|
||||
item.itemExistingItemFilter.name=Filtro de Itens Existentes
|
||||
item.itemExistingItemFilter.tooltip.basic.line1=Melhoria para condutos de itens
|
||||
item.itemExistingItemFilter.tooltip.detailed.line1=Seleciona apenas itens que
|
||||
item.itemExistingItemFilter.tooltip.detailed.line2=já estão no inventário
|
||||
item.itemExistingItemFilter.tooltip.detailed.line3=Clique direito enquanto agachado
|
||||
item.itemExistingItemFilter.tooltip.detailed.line4=em um inventário para adicionar o
|
||||
item.itemExistingItemFilter.tooltip.detailed.line5=o conteúdo ao snapshot
|
||||
|
||||
enderio.item.itemExistingItemFilter.filterUpdated=Novos itens foram adicionados ao snapshot
|
||||
enderio.item.itemExistingItemFilter.filterNotUpdated=O snapshot já cobre todos os itens no inventário
|
||||
|
||||
item.itemModItemFilter.name=Filtro de Itens de Mod
|
||||
item.itemModItemFilter.tooltip.basic.line1=Melhoria para condutos de itens
|
||||
item.itemModItemFilter.tooltip.detailed.line1=Seleciona apenas itens de certo(s)
|
||||
item.itemModItemFilter.tooltip.detailed.line2=mod(s)
|
||||
|
||||
item.itemPowerItemFilter.name=Filtro de Item Carregável
|
||||
item.itemPowerItemFilter.tooltip.basic.line1=Melhoria para filtros de itens
|
||||
|
||||
item.itemExtractSpeedUpgrade.name=Melhoria de Velocidade dos Condutos de Itens
|
||||
item.itemExtractSpeedUpgrade.tooltip.basic.line1=Melhoria para condutos de itens
|
||||
item.itemExtractSpeedUpgrade.tooltip.detailed.line1=Melhora a velocidade por 4
|
||||
item.itemExtractSpeedUpgrade.tooltip.detailed.line2=itens por extração
|
||||
item.itemExtractSpeedUpgrade.tooltip.detailed.line3=Máximo de 15 melhorias
|
||||
|
||||
enderio.itemGasConduit.name=Conduto de Gases
|
||||
|
||||
enderio.itemGasConduit.tooltip.maxExtract=Extração Máxima:
|
||||
enderio.itemGasConduit.tooltip.maxIo=IO Máxima:
|
||||
enderio.itemGasConduit.tooltip.detailed.line1=Transfere gases compatíveis com o Mekanism
|
||||
|
||||
enderio.itemMEConduit.name=Conduto ME
|
||||
enderio.itemMEConduitDense.name=Conduto ME Denso
|
||||
|
||||
//Entity
|
||||
entity.witherSkeleton.name=Esqueleto Wither
|
||||
|
||||
//Materials
|
||||
enderio.itemMaterial.name=Materiais
|
||||
enderio.silicon.name=Silicone
|
||||
enderio.conduitBinder.name=Capa de Conduto
|
||||
enderio.binderComposite.name=Composto de Capa
|
||||
enderio.phasedIronNugget.name=Pepita de Ferro Pulsante
|
||||
tile.blockDarkIronBars.name=Barras de Ferro Negro
|
||||
tile.blockEndermanSkull.name=Caveira de Enderman
|
||||
tile.blockEndermanSkull.base.name=Cabeça de Enderman
|
||||
tile.blockEndermanSkull.reanimated.name=Cabeça de Enderman Reanimada
|
||||
tile.blockEndermanSkull.tormented.name=Cabeça de Enderman Atormentado
|
||||
enderio.blastResistant=Resistente a Explosões
|
||||
enderio.lightEmitter=Emite Luz
|
||||
enderio.tooltip.isBeaconBase=Pode ser usado como base de um sinalizador
|
||||
|
||||
//Fluids
|
||||
fluid.nutrient_distillation=Destilado de Nutrientes
|
||||
tile.fluid.nutrient_distillation.name=Destilado de Nutrientes
|
||||
item.bucketNutrient_distillation.name=Balde de Destilado de Nutrientes
|
||||
|
||||
fluid.hootch=Aguardente
|
||||
tile.fluid.hootch.name=Aguardente
|
||||
item.bucketHootch.name=Balde de Aguardente
|
||||
fluid.fire_water=Água de Fogo
|
||||
tile.fluid.fire_water.name=Água de Fogo
|
||||
item.bucketFire_water.name=Balde de Água de Fogo
|
||||
fluid.rocket_fuel=Combustível para Foguetes
|
||||
tile.fluid.rocket_fuel.name=Combustível para Foguetes
|
||||
item.bucketRocket_fuel.name=Balde de Combustível para Foguetes
|
||||
fluid.eio.xpjuice=XP em Líquido
|
||||
tile.fluid.eio.xpjuice.name=XP em Líquido
|
||||
item.bucketXpjuice.name=Balde de XP
|
||||
|
||||
|
||||
enderio.fluid.millibucket.abr=mB
|
||||
|
||||
enderio.fuel.tooltip.heading=Detalhes do Combustível
|
||||
enderio.fuel.tooltip.burnTime=tempo de queima
|
||||
enderio.fluid.millibucketsTick=mB/t
|
||||
enderio.coolant.tooltip.heading=Refrigerante
|
||||
enderio.coolant.tooltip.degreesPerBucket=Graus por balde
|
||||
enderio.gas.gasTick=Gas/t
|
||||
|
||||
|
||||
//Materials
|
||||
enderio.itemMachinePart.name=Partes de Máquina
|
||||
enderio.machineChassi.name=Chassi de Máquina
|
||||
enderio.basicGear.name=Engrenagem Básica
|
||||
enderio.pulsatingCrystal.name=Cristal Pulsante
|
||||
enderio.vibrantCrystal.name=Cristal Vibrante
|
||||
enderio.enderCrystal.name=Cristal do Fim
|
||||
enderio.attractorCrystal.name=Cristal Atraente
|
||||
enderio.darkGrindingBall.name=Bola de Aço Negro
|
||||
enderio.darkGrindingBall.tooltip.detailed.line1=Bola de Moagem para Moinho SAG
|
||||
enderio.darkGrindingBall.tooltip.detailed.line2=Saída Principal
|
||||
enderio.darkGrindingBall.tooltip.detailed.line3=Saída Bônus
|
||||
enderio.darkGrindingBall.tooltip.detailed.line4=Redução de Poder
|
||||
|
||||
tile.blockReinforcedObsidian.name=Obsidiana Reforçada
|
||||
tile.blockReinforcedObsidian.tooltip.common.line1=À Prova De Wither
|
||||
|
||||
//Quartz / Glass
|
||||
tile.blockFusedQuartz.name=Quartzo Fundido
|
||||
enderio.blockFusedQuartz.fusedQuartz.name=Quartzo Fundido
|
||||
enderio.blockFusedQuartz.fusedGlass.name=Vidro Bem Transparente
|
||||
enderio.blockFusedQuartz.enlightenedFusedQuartz.name=Quartzo Fundido Iluminado
|
||||
enderio.blockFusedQuartz.enlightenedFusedGlass.name=Vidro Transparente Iluminado
|
||||
|
||||
item.enderio.itemFusedQuartzFrame.name=Armação de Quartzo Fundido
|
||||
enderio.itemPowderIngot=Pós e Barras
|
||||
|
||||
//Alloys
|
||||
enderio.itemAlloy.name=Liga
|
||||
enderio.electricalSteel.name=Aço Elétrico
|
||||
enderio.energeticAlloy.name=Liga Energética
|
||||
enderio.phasedGold.name=Liga Vibrante
|
||||
enderio.redstoneAlloy.name=Liga de Redstone
|
||||
enderio.conductiveIron.name=Ferro Condutivo
|
||||
enderio.phasedIron.name=Ferro Pulsante
|
||||
enderio.vibrantNugget.name=Pepita de Liga Vibrante
|
||||
enderio.darkSteel.name=Aço Negro
|
||||
enderio.soularium.name=Almário
|
||||
|
||||
tile.blockIngotStorage.name=Armazenamento de Barras
|
||||
tile.enderio.electricalSteel.name=Bloco de Aço Elétrico
|
||||
tile.enderio.energeticAlloy.name=Bloco de Liga Energética
|
||||
tile.enderio.phasedGold.name=Bloco de Liga Vibrante
|
||||
tile.enderio.redstoneAlloy.name=Bloco de Liga de Redstone
|
||||
tile.enderio.conductiveIron.name=Bloco de Ferro Condutivo
|
||||
tile.enderio.phasedIron.name=Bloco de Ferro Pulsante
|
||||
tile.enderio.vibrantNugget.name=Bloco de Pepitas Vibrantes
|
||||
tile.enderio.darkSteel.name=Bloco de Aço Negro
|
||||
tile.enderio.soularium.name=Bloco de Almário
|
||||
|
||||
//Powder / Ingot
|
||||
enderio.powderCoal.name=Pó de Carvão
|
||||
enderio.powderIron.name=Pó de Ferro
|
||||
enderio.powderGold.name=Pó de Ouro
|
||||
enderio.powderCopper.name=Pó de Cobre
|
||||
enderio.powderTin.name=Pó de Estanho
|
||||
enderio.powderEnder.name=Pó de Pérola do Fim
|
||||
|
||||
enderio.ingotEnderiumBase.name=Base de Enderium
|
||||
|
||||
//Capacitors
|
||||
enderio.itemBasicCapacitor.name=Capacitor
|
||||
enderio.basicCapacitor.name=Capacitor Básico
|
||||
enderio.activatedCapacitor.name=Capacitor de Dupla Camada
|
||||
enderio.enderCapacitor.name=Capacitor Octádico
|
||||
|
||||
enderio.machine.tooltip.upgrade=Melhoria de Máquinas
|
||||
enderio.machine.tooltip.upgrade.tooltip.detailed.line1=Aumenta o armazenamento de energia e
|
||||
enderio.machine.tooltip.upgrade.tooltip.detailed.line2=velocidade / alcance das máquinas
|
||||
enderio.machine.tooltip.clearConfig=Isso vai limpar qualquer configuração feita!
|
||||
|
||||
//Machines
|
||||
tile.blockStirlingGenerator.name=Gerador de Stirling
|
||||
tile.blockStirlingGenerator.tooltip.detailed.line1=Queima combustível sólido para gerar energia
|
||||
tile.blockStirlingGenerator.tooltip.detailed.line2=Pode ser melhorado para aumentar a saída
|
||||
tile.blockStirlingGenerator.tooltip.detailed.line3=e eficiência com capacitores
|
||||
|
||||
tile.blockReservoir.name=Reservatório
|
||||
tile.blockReservoir.tooltip.detailed.line1=Formado quando colocado em um 2x2x1
|
||||
tile.blockReservoir.tooltip.detailed.line2=Adicione dois baldes de água para
|
||||
tile.blockReservoir.tooltip.detailed.line3=uma fonte infinita de água
|
||||
tile.blockReservoir.tooltip.detailed.line4=Produz um balde por segundo
|
||||
tile.blockReservoir.tooltip.detailed.line5=Clique direito com uma chave para
|
||||
tile.blockReservoir.tooltip.detailed.line6=ativar a auto-saída
|
||||
|
||||
tile.blockAlloySmelter.name=Fundidora de Ligas
|
||||
tile.blockAlloySmelter.tooltip.detailed.line1=Usada para criar ligas do EnderIO
|
||||
tile.blockAlloySmelter.tooltip.detailed.line2=Também pode ser usada como uma
|
||||
tile.blockAlloySmelter.tooltip.detailed.line3=fornalha elétrica
|
||||
tile.blockAlloySmelter.tooltip.detailed.line4=Melhore com capacitores para aumentar
|
||||
tile.blockAlloySmelter.tooltip.detailed.line5=a velocidade e armazenamento de energia
|
||||
|
||||
tile.blockSolarPanel.name=Célula Fotovoltaica
|
||||
tile.blockSolarPanel.advanced.name=Célula Fotovoltaica Avançada
|
||||
tile.blockSolarPanel.tooltip.detailed.line1=Produz poder durante as horas de luz solar
|
||||
tile.blockSolarPanel.tooltip.detailed.line2=Deve ter uma linha limpa de vista
|
||||
tile.blockSolarPanel.tooltip.detailed.line3=ao céu
|
||||
enderio.maxSolorProduction=Saída Máxima
|
||||
enderio.tooltip.efficiency=Eficiência
|
||||
|
||||
item.itemElectricLight.name=Luz Elétrica
|
||||
item.itemElectricLight.tooltip.detailed.line1=Ilumina uma grande área quando suprida
|
||||
item.itemElectricLight.tooltip.detailed.line2=com energia e um sinal de redstone.
|
||||
|
||||
item.itemElectricLightInverted.name=Luz Elétrica (Invertida)
|
||||
item.itemElectricLightInverted.tooltip.detailed.line1=Ilumina uma grande área quando suprida
|
||||
item.itemElectricLightInverted.tooltip.detailed.line2=com energia.
|
||||
item.itemElectricLightInverted.tooltip.detailed.line3=Desliga com um sinal de redstone.
|
||||
|
||||
item.itemLight.name=Luz
|
||||
item.itemLight.tooltip.detailed.line1=Emite luz com um
|
||||
item.itemLight.tooltip.detailed.line2=sinal de redstone.
|
||||
|
||||
item.itemLightInverted.name=Luz (Invertida)
|
||||
item.itemLightInverted.tooltip.detailed.line1=Emite luz, desativada com
|
||||
item.itemLightInverted.tooltip.detailed.line2=um sinal de redstone.
|
||||
|
||||
item.itemWirelessLight.name=Luz Elétrica Sem Fio
|
||||
item.itemWirelessLight.tooltip.detailed.line1=Ilumina uma grande área quando suprida
|
||||
item.itemWirelessLight.tooltip.detailed.line2=com poder e um sinal de redstone
|
||||
item.itemWirelessLight.tooltip.detailed.line3=Pode receber energia de Carregadores Sem Fio
|
||||
|
||||
item.itemWirelessLightInverted.name=Luz Elétrica Sem Fio (Invertida)
|
||||
item.itemWirelessLightInverted.tooltip.detailed.line1=Ilumina uma grande área quando suprida
|
||||
item.itemWirelessLightInverted.tooltip.detailed.line2=com energia.
|
||||
item.itemWirelessLightInverted.tooltip.detailed.line3=Desliga com um sinal de redstone.
|
||||
item.itemWirelessLightInverted.tooltip.detailed.line4=Pode receber energia de Carregadores Sem Fio
|
||||
|
||||
tile.blockCapacitorBank.name=Banco de Capacitores (Deprecado)
|
||||
tile.blockCapacitorBank.creative.name=Banco de Capacitores Criativo (Deprecado)
|
||||
tile.blockCapacitorBank.tooltip.detailed.line1=Converta a um novo bloco colocando-o
|
||||
tile.blockCapacitorBank.tooltip.detailed.line2=em uma grade de crafting.
|
||||
tile.blockCapacitorBank.tooltipPrefix=Contém
|
||||
|
||||
tile.blockCapBank.creative.name=Banco de Capacitores Criativo
|
||||
tile.blockCapBank.simple.name=Banco de Capacitores Básico
|
||||
tile.blockCapBank.activated.name=Banco de Capacitores
|
||||
tile.blockCapBank.vibrant.name=Banco de Capacitores Vibrante
|
||||
tile.blockCapBank.tooltip.detailed.line1=Armazenamento de energia multi-bloco
|
||||
tile.blockCapBank.tooltip.detailed.line2=Pode carregar itens movidos a RF
|
||||
tile.blockCapBank.tooltipPrefix=Contém
|
||||
|
||||
tile.blockCapBank.tooltip.detailed.line3=Shift-Clique direito em uma face
|
||||
tile.blockCapBank.tooltip.detailed.line4=para mudar a exibição de informação
|
||||
|
||||
enderio.capbank.maxIO=I/O Máxima
|
||||
enderio.capbank.maxIn=Entrada Máxima
|
||||
enderio.capbank.maxOut=Saída Máxima
|
||||
enderio.capbank.change=I/O
|
||||
enderio.capbank.iodisplay.stable=I/O
|
||||
enderio.capbank.iodisplay.gain=Entrada
|
||||
enderio.capbank.iodisplay.loss=Saída
|
||||
|
||||
tile.blockWirelessCharger.name=Carregador Sem-Fio
|
||||
tile.blockWirelessCharger.tooltip.detailed.line1=Carrega itens no inventário
|
||||
tile.blockWirelessCharger.tooltip.detailed.line2=de jogadores próximos.
|
||||
|
||||
tile.blockSagMill.name=Moinho SAG
|
||||
tile.blockSagMill.tooltip.detailed.line1=Mói minérios e outros itens
|
||||
tile.blockSagMill.tooltip.detailed.line2=Adicione bolas de moagem para aumentar a saída
|
||||
tile.blockSagMill.tooltip.detailed.line3=e eficiência
|
||||
tile.blockSagMill.tooltip.detailed.line4=Melhore com capacitores para aumentar a
|
||||
tile.blockSagMill.tooltip.detailed.line5=velocidade e armazenamento de energia
|
||||
tile.blockSagMill.tooltipPrefix=Contém
|
||||
|
||||
tile.blockHyperCube.name=Transceptor Dimensional (Deprecado)
|
||||
tile.blockHyperCube.tooltip.detailed.line1=Converta em um novo modelo colocando-o
|
||||
tile.blockHyperCube.tooltip.detailed.line2=na grade de criação
|
||||
|
||||
tile.blockTransceiver.name=Transceptor Dimensional
|
||||
tile.blockTransceiver.tooltip.detailed.line1=Transporta itens, fluidos e energia
|
||||
tile.blockTransceiver.tooltip.detailed.line2=sem fios através de qualquer distância
|
||||
tile.blockTransceiver.tooltip.detailed.line3=e entre dimensões
|
||||
|
||||
tile.blockEnderRail.name=Trilho do Fim
|
||||
tile.blockEnderRail.tooltip.detailed.line1=Teletransporta carrinhos quando colocado
|
||||
tile.blockEnderRail.tooltip.detailed.line2=acima de um Transceptor Dimensional
|
||||
tile.blockEnderRail.tooltip.detailed.line3=Selecione o destino utilizando
|
||||
tile.blockEnderRail.tooltip.detailed.line4=a aba Trilho no Transcpetor
|
||||
tile.blockEnderRail.tooltip.detailed.line5=Selecione a direção com clique direito
|
||||
tile.blockEnderRail.tooltip.detailed.line6=de uma chave
|
||||
|
||||
enderio.trans.showChannels=<Shift para mostrar canais>
|
||||
|
||||
enderio.trans.power=Energia
|
||||
enderio.trans.item=Item
|
||||
enderio.trans.fluid=Fluido
|
||||
enderio.trans.rail=Trilho
|
||||
|
||||
enderio.trans.receiving=A receber
|
||||
enderio.trans.sending=A enviar
|
||||
|
||||
tile.blockPowerMonitor.name=Monitor de Força
|
||||
tile.blockPowerMonitor.tooltip.detailed.line1=Mostra detalhes do uso e
|
||||
tile.blockPowerMonitor.tooltip.detailed.line2=armazenamento de energia
|
||||
tile.blockPowerMonitor.tooltip.detailed.line3=Pode ser usado para emitir redstone
|
||||
tile.blockPowerMonitor.tooltip.detailed.line4=baseado no nível de energia armazenada
|
||||
tile.blockPowerMonitor.tooltip.detailed.line5=Deve ser conectado a um conduto
|
||||
tile.blockPowerMonitor.tooltip.detailed.line6=do EnderIO
|
||||
|
||||
tile.blockVat.name=O Tonel
|
||||
tile.blockVat.tooltip.detailed.line1=Usado para fermentar fluidos do EnderIO
|
||||
|
||||
tile.blockEnchanter.name=Encantador
|
||||
tile.blockEnchanter.tooltip.detailed.line1=Usa XP para combinar itens
|
||||
tile.blockEnchanter.tooltip.detailed.line2=e uma pena e livro para
|
||||
tile.blockEnchanter.tooltip.detailed.line2=criar livros encantados
|
||||
|
||||
tile.blockCombustionGenerator.name=Gerador a Combustão
|
||||
tile.blockCombustionGenerator.tooltip.detailed.line1=Queima combustível líquido para gerar energia
|
||||
tile.blockCombustionGenerator.tooltip.detailed.line2=Requer um refrigerante (e.g. água)
|
||||
tile.blockCombustionGenerator.tooltip.detailed.line3=Saída dependente do combustível
|
||||
|
||||
tile.blockZombieGenerator.name=Gerador Zumbi
|
||||
tile.blockZombieGenerator.tooltip.detailed.line1=Consome Destilação Nutriente
|
||||
tile.blockZombieGenerator.tooltip.detailed.line2=Para gerar energia
|
||||
enderio.zombieGenerator.fuelTank=Tanque de Nutrientes
|
||||
|
||||
tile.blockKillerJoe.name=Joe Matador
|
||||
tile.blockKillerJoe.tooltip.detailed.line1=Ataca criaturas próximas quando
|
||||
tile.blockKillerJoe.tooltip.detailed.line2=suprida com uma espada e
|
||||
tile.blockKillerJoe.tooltip.detailed.line3=Destilação Nutriente
|
||||
tile.blockKillerJoe.tooltip.detailed.line4=Experiência pode ser drenada como
|
||||
tile.blockKillerJoe.tooltip.detailed.line5=XP Líquida utilizando condutos
|
||||
|
||||
enderio.killerJoe.fuelTank=Tanque de Nutrientes
|
||||
enderio.killerJoe.giveXp.tooltip=Pegar XP
|
||||
enderio.killerJoe.giveXp10.tooltip=Pegar 10 níveis de XP
|
||||
|
||||
tile.blockSliceAndSplice.name=Fatia-e-Emenda
|
||||
tile.blockSliceAndSplice.tooltip.detailed.line1=Fatia cabeças e as emenda em
|
||||
tile.blockSliceAndSplice.tooltip.detailed.line2=todos os tipos de coisas úteis
|
||||
|
||||
tile.blockFarmStation.name=Estação de Cultivo
|
||||
tile.blockFarmStation.tooltip.detailed.line1=Planta e colhe culturas
|
||||
tile.blockFarmStation.tooltip.detailed.line2=Requer energia e
|
||||
tile.blockFarmStation.tooltip.detailed.line3=ferramentas apropriadas (enxada, machado)
|
||||
tile.blockFarmStation.tooltip.detailed.line4=Pilhagem / Fortuna nas ferramentas
|
||||
tile.blockFarmStation.tooltip.detailed.line5=é aplicada nas colheitas
|
||||
tile.blockFarmStation.tooltip.detailed.line6=Melhore com capacitores para aumentar a área,
|
||||
tile.blockFarmStation.tooltip.detailed.line7=a melhoria também aumenta o uso de energia
|
||||
|
||||
enderio.farm.note.outputFull=Saída Lotada
|
||||
enderio.farm.note.noSeeds=Sem Sementes
|
||||
enderio.farm.note.noAxe=Sem Machados
|
||||
enderio.farm.note.noHoe=Sem Enxadas
|
||||
enderio.farm.note.noPower=Sem Energia
|
||||
|
||||
tile.blockTank.name=Tanque de Fluidos
|
||||
tile.blockTank.advanced.name=Tanque de Fluidos Pressurizado
|
||||
tile.blockTank.tooltip.detailed.line1=Tanque de fluidos portátil
|
||||
tile.blockTank.tooltip.detailed.line2=Pode ser usado para esvaziar ou
|
||||
tile.blockTank.tooltip.detailed.line3=encher contêineres de fluidos
|
||||
enderio.tank.tank=Tanque
|
||||
enderio.tooltip.none=Nenhum
|
||||
enderio.tooltip.fluidStored=Fluido Armazenado
|
||||
|
||||
tile.blockCrafter.name=Fabricador
|
||||
tile.blockCrafter.tooltip.detailed.line1=Um auto-fabricador elétrico
|
||||
tile.blockCrafter.tooltip.detailed.line2=Consome energia por fabricação
|
||||
tile.blockCrafter.tooltip.detailed.line3=Pode ser melhorado para aumentar a rapidez
|
||||
tile.blockCrafter.tooltip.detailed.line4=e armazenamento de energia com capacitores
|
||||
|
||||
tile.blockVacuumChest.name=Baú Aspirador
|
||||
tile.blockVacuumChest.tooltip.detailed.line1=Puxa itens próximos
|
||||
tile.blockVacuumChest.tooltip.detailed.line2=no seu inventário
|
||||
|
||||
tile.blockPoweredSpawner.name=Invocador Elétrico
|
||||
tile.blockPoweredSpawner.tooltip.empty=Vazio
|
||||
tile.blockPoweredSpawner.empty.tooltip.detailed.line1=Combine com um invocador
|
||||
tile.blockPoweredSpawner.empty.tooltip.detailed.line2=quebrado numa bigorna
|
||||
tile.blockPoweredSpawner.tooltip.detailed.line1=Supra com energia para
|
||||
tile.blockPoweredSpawner.tooltip.detailed.line2=ativar
|
||||
tile.blockPoweredSpawner.tooltip.detailed.line3=Melhore com capacitores para melhorar
|
||||
tile.blockPoweredSpawner.tooltip.detailed.line4=a rapidez e armazenamento de energia
|
||||
|
||||
item.itemBrokenSpawner.name=Invocador Quebrado
|
||||
item.itemBrokenSpawner.tooltip.detailed.line1=Combine com um Invocador Elétrico
|
||||
item.itemBrokenSpawner.tooltip.detailed.line2=em uma Bigorna para mudar o tipo do Invocador
|
||||
|
||||
tile.blockSoulBinder.name=Vinculador de Almas
|
||||
tile.blockSoulBinder.tooltip.detailed.line1=Use para converter o tipo de
|
||||
tile.blockSoulBinder.tooltip.detailed.line2=um invocador quebrado
|
||||
|
||||
tile.blockAttractor.name=Obelisco Atraidor
|
||||
tile.blockAttractor.tooltip.detailed.line1=Atrai mobs para perto
|
||||
tile.blockAttractor.tooltip.detailed.line2=Especifique os mobs a serem
|
||||
tile.blockAttractor.tooltip.detailed.line3=afetados colocando suas almas
|
||||
tile.blockAttractor.tooltip.detailed.line4=dentro do dispostivo
|
||||
|
||||
tile.blockSpawnGuard.name=Obelisco de Aversão
|
||||
tile.blockSpawnGuard.tooltip.detailed.line1=Previne mobs de aparecer
|
||||
tile.blockSpawnGuard.tooltip.detailed.line2=dentro de uma área de efeitos
|
||||
|
||||
tile.blockExperienceObelisk.name=Obelisco de Experiência
|
||||
tile.blockExperienceObelisk.tooltip.detailed.line1=Armazena Experiência
|
||||
tile.blockExperienceObelisk.tooltip.detailed.line2=Pode liberar XP líquida para
|
||||
tile.blockExperienceObelisk.tooltip.detailed.line3=tanques adjacentes
|
||||
|
||||
tile.blockBuffer.item.name=Buffer de Itens
|
||||
tile.blockBuffer.power.name=Buffer de Energia
|
||||
tile.blockBuffer.omni.name=OniBuffer
|
||||
tile.blockBuffer.creative.name=Buffer Criativo
|
||||
|
||||
enderio.machine.tooltip.configured=(Configurado)
|
||||
|
||||
//Blocks
|
||||
tile.blockDarkSteelPressurePlate.name=Placa de Pressão Negra
|
||||
tile.blockDarkSteelPressurePlate.tooltip.detailed.line1=Apenas ativada por jogadores
|
||||
tile.blockDarkSteelPressurePlate.tooltip.detailed.line2=Pode ser pintada na máquina de pintura,
|
||||
tile.blockDarkSteelPressurePlate.tooltip.detailed.line3=invisível quando pintada com Vidro
|
||||
tile.blockDarkSteelPressurePlate.tooltip.detailed.line4=Bem Transparente
|
||||
tile.blockDarkSteelPressurePlate.silent.tooltip.common.line1=Silenciosa
|
||||
tile.blockDarkSteelPressurePlate.silent.tooltip.detailed.line1=Apenas ativada por jogadores
|
||||
tile.blockDarkSteelPressurePlate.silent.tooltip.detailed.line2=Pode ser pintada na máquina de pintura,
|
||||
tile.blockDarkSteelPressurePlate.silent.tooltip.detailed.line3=invisível quando pintada com Vidro
|
||||
tile.blockDarkSteelPressurePlate.silent.tooltip.detailed.line4=Bem Transparente
|
||||
|
||||
tile.blockDarkSteelAnvil.intact.name=Bigorna de Aço Negro
|
||||
tile.blockDarkSteelAnvil.slightlyDamaged.name=Bigorna de Aço Negro Levemente Danificada
|
||||
tile.blockDarkSteelAnvil.veryDamaged.name=Bigorna de Aço Negro Muito Danificada
|
||||
tile.blockDarkSteelAnvil.tooltip.common.line1=Resistente a Danos
|
||||
tile.blockDarkSteelAnvil.tooltip.detailed.line1=Dura muito mais do que
|
||||
tile.blockDarkSteelAnvil.tooltip.detailed.line2=a bigorna do Minecraft vanilla
|
||||
|
||||
tile.blockDarkSteelLadder.name=Escadas de Aço Negro
|
||||
tile.blockDarkSteelLadder.tooltip.common.line1=Mais rápida que escadas comuns
|
||||
|
||||
//Travel
|
||||
tile.blockTravelAnchor.name=Ãncora de Viagem
|
||||
tile.blockTravelAnchor.tooltip.detailed.line1=Permite teletransporte entre âncoras
|
||||
tile.blockTravelAnchor.tooltip.detailed.line2=Fique de pé em uma Âncora, olhe
|
||||
tile.blockTravelAnchor.tooltip.detailed.line3=para outra e pule para viajar
|
||||
tile.blockTravelAnchor.tooltip.detailed.line4=Pode também ser usada com o Cajado
|
||||
tile.blockTravelAnchor.tooltip.detailed.line5=da Viagem
|
||||
tile.blockTravelAnchor.tooltip.detailed.line6=Pode ser pintada na Máquina de Pintura
|
||||
|
||||
enderio.blockTravelPlatform.invalidTarget=Destino está Obstruído
|
||||
enderio.blockTravelPlatform.outOfRange=Destino fora de alcance
|
||||
|
||||
item.itemTravelStaff.name=Cajado da Viagem
|
||||
item.itemTravelStaff.tooltip.detailed.line1=Quando segurada Âncoras de Viagem e blocos
|
||||
item.itemTravelStaff.tooltip.detailed.line2=do EnderIO se tornam visíveis e pode ser
|
||||
item.itemTravelStaff.tooltip.detailed.line3=ativada por clique direito
|
||||
item.itemTravelStaff.tooltip.detailed.line4=Shift-Clique direito vai teletransportar
|
||||
item.itemTravelStaff.tooltip.detailed.line5=o jogador uma curta distância
|
||||
enderio.itemTravelStaff.notEnoughPower=Sem energia suficiente
|
||||
|
||||
//Painter
|
||||
tile.blockPainter.name=Máquina de Pintura
|
||||
enderio.blockPainter.paintedWith=Pintado com:
|
||||
tile.blockPaintedFence.name=Cerca Pintada
|
||||
tile.blockPaintedFenceGate.name=Portão Pintado
|
||||
tile.blockPaintedWall.name=Parede Pintada
|
||||
tile.blockPaintedStair.name=Painted Stairs
|
||||
tile.blockPaintedSlab.name=Laje Pintada
|
||||
tile.blockPaintedDoubleSlab.name=Laje Pintada
|
||||
tile.blockPaintedGlowstone.name=Pedra Luminosa Pintada
|
||||
tile.blockPaintedCarpet.name=Carpete Pintado
|
||||
enderio.painter.tooltip.wasPainted=§oO que você achou que ia fazer?
|
||||
|
||||
tile.blockPainter.tooltip.detailed.line1=Usada pra pintar:
|
||||
tile.blockPainter.tooltip.detailed.line2=Fachadas de Conduto, Escadas, Cercas,
|
||||
tile.blockPainter.tooltip.detailed.line3=Portões, Lajes, Paredes de Pedregulho,
|
||||
tile.blockPainter.tooltip.detailed.line4=Armações de Vidro, Pedra Luminosa, Tapetes,
|
||||
tile.blockPainter.tooltip.detailed.line5=Placas de Pressão de Aço Negro,
|
||||
tile.blockPainter.tooltip.detailed.line6=Âncoras de Viagem
|
||||
|
||||
//Items
|
||||
item.itemYetaWrench.name=Chave Yeta
|
||||
item.itemYetaWrench.tooltip.detailed.line1=Esconde fachadas de conduto quando segurada,
|
||||
item.itemYetaWrench.tooltip.detailed.line2=Shift-Clique direito para quebrar máquinas
|
||||
item.itemYetaWrench.tooltip.detailed.line3=e condutos instantaneamente
|
||||
item.itemYetaWrench.tooltip.detailed.line4=Shift-Clique num conduto para
|
||||
item.itemYetaWrench.tooltip.detailed.line5=abrir a GUI de configuração
|
||||
item.itemYetaWrench.tooltip.detailed.line6=Use Shift-Roda do Mouse ou '%s' para
|
||||
item.itemYetaWrench.tooltip.detailed.line7=renderizar apenas um tipo de conduto
|
||||
|
||||
item.itemMagnet.name=Eletroímã
|
||||
item.itemMagnet.tooltip.detailed.line1=Puxa itens próximos para ti
|
||||
item.itemMagnet.tooltip.detailed.line2=Shift-Clique direito pra ativar / desativar
|
||||
item.itemMagnet.tooltip.detailed.line3=Deve ter energia, estar ativo e
|
||||
item.itemMagnet.tooltip.detailed.line4=estar na hotbar para funcionar
|
||||
|
||||
item.enderio.itemConduitProbe.name=Sonda de Condutos
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line1=No modo sonda clique direito em um conduto
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line2=para mostrar detalhes sobre sua rede
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line3=No modo copiar/colar Shift-Clique direito para
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line4=copiar a configuração de um conjunto de condutos
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line5=Clica com o botão direito para colar
|
||||
item.enderio.itemConduitProbe.tooltip.detailed.line6=Use Shift-Roda do Rato ou 'Y' para mudar o modo
|
||||
|
||||
item.itemSoulVessel.name=Frasco de Almas
|
||||
enderio.item.itemSoulVessel.tooltip.health=Saúde:
|
||||
enderio.item.itemSoulVessel.tooltip.fluidname=Nome do Fluido:
|
||||
item.itemSoulVessel.tooltip.detailed.line1=Clique direito num mob para
|
||||
item.itemSoulVessel.tooltip.detailed.line2=capturar sua alma
|
||||
item.itemSoulVessel.tooltip.detailed.line3=Clique direito novamente para soltar
|
||||
|
||||
item.itemXpTransfer.name=Vara de Experiência
|
||||
item.itemXpTransfer.tooltip.detailed.line1=Clique direito em um tanque contendo
|
||||
item.itemXpTransfer.tooltip.detailed.line2=XP líquida para ganhar níveis
|
||||
item.itemXpTransfer.tooltip.detailed.line3=Shift-Clique direito para transferir
|
||||
item.itemXpTransfer.tooltip.detailed.line4=níveis ao tanque
|
||||
|
||||
skullZombieElectrode.name=Eletrodo Zumbi
|
||||
skullZombieController.name=Controlador Z-Lógica
|
||||
skullZombieFrankenstien.name=Frankenzumbi
|
||||
skullEnderResonator.name=Ressoador do Fim
|
||||
|
||||
item.itemSpawnEggEnderIO.name=Invoca
|
||||
|
||||
//Dark Steel
|
||||
item.darkSteel_helmet.name=Elmo Negro
|
||||
item.darkSteel_chestplate.name=Peitoral Negro
|
||||
item.darkSteel_leggings.name=Perneiras Negras
|
||||
item.darkSteel_boots.name=Botas Negras
|
||||
item.darkSteel_sword.name="The Ender"
|
||||
item.darkSteel_pickaxe.name=Picareta Negra
|
||||
item.darkSteel_axe.name=Machado Negro
|
||||
|
||||
enderio.item.tooltip.showDetails=<Segure Shift>
|
||||
enderio.item.darkSteel.tooltip.durability=Durabilidade:
|
||||
|
||||
enderio.item.darkSteel_pickaxe.tooltip.effPowered=Eficiência quando eletrizada
|
||||
enderio.item.darkSteel_pickaxe.tooltip.effObs=Eficiência ao quebrar obsidiana
|
||||
|
||||
enderio.item.darkSteel_axe.tooltip.multiHarvest=Segure shift para cortar toda a árvore
|
||||
|
||||
enderio.item.darkSteel_sword.tooltip.line1=Mais drops de cabeças e pérolas do fim
|
||||
enderio.item.darkSteel_sword.tooltip.line2=Endermen não podem se teletransportar depois de atingidos
|
||||
enderio.item.darkSteel_sword.tooltip.line3=+2 de dano quando Eletrizada
|
||||
|
||||
enderio.item.darkSteel_armor.tooltip.line1=Proteção nível diamante
|
||||
enderio.item.darkSteel_armor.tooltip.line2=quando Eletrizada
|
||||
|
||||
enderio.item.darkSteel_boots.tooltip.line1=Dano de queda negado
|
||||
enderio.item.darkSteel_boots.tooltip.line2=quando Eletrizada
|
||||
|
||||
enderio.darksteel.upgrade.empowered_one.name=Energia I
|
||||
enderio.darksteel.upgrade.empowered_one.tooltip.detailed.line1=Energia: $P
|
||||
enderio.darksteel.upgrade.empowered_one.tooltip.detailed.line2=$D% de dano absorvido
|
||||
enderio.darksteel.upgrade.empowered_one.tooltip.detailed.line3=por energia
|
||||
|
||||
enderio.darksteel.upgrade.empowered_two.name=Energia II
|
||||
enderio.darksteel.upgrade.empowered_two.tooltip.detailed.line1=Energia: $P
|
||||
enderio.darksteel.upgrade.empowered_two.tooltip.detailed.line2=$D% de dano absorvido
|
||||
enderio.darksteel.upgrade.empowered_two.tooltip.detailed.line3=por energia
|
||||
|
||||
enderio.darksteel.upgrade.empowered_three.name=Energia III
|
||||
enderio.darksteel.upgrade.empowered_three.tooltip.detailed.line1=Energia: $P
|
||||
enderio.darksteel.upgrade.empowered_three.tooltip.detailed.line2=$D% de dano absorvido
|
||||
enderio.darksteel.upgrade.empowered_three.tooltip.detailed.line3=por energia
|
||||
|
||||
enderio.darksteel.upgrade.empowered_four.name=Energia IV
|
||||
enderio.darksteel.upgrade.empowered_four.tooltip.detailed.line1=Energia: $P
|
||||
enderio.darksteel.upgrade.empowered_four.tooltip.detailed.line2=$D% de dano absorvido
|
||||
enderio.darksteel.upgrade.empowered_four.tooltip.detailed.line3=por energia
|
||||
|
||||
|
||||
enderio.darksteel.upgrade.travel.name=Viagem
|
||||
enderio.darksteel.upgrade.travel.tooltip.detailed.line1=Segure shift e clique direito para teletransportar
|
||||
enderio.darksteel.upgrade.travel.tooltip.detailed.line2=ativar uma âncora de viagem ou IO do Fim
|
||||
|
||||
enderio.darksteel.upgrade.spoon.name=Colher
|
||||
enderio.darksteel.upgrade.spoon.tooltip.detailed.line1=Quem precisa de pá quando
|
||||
enderio.darksteel.upgrade.spoon.tooltip.detailed.line2=se tem uma colher
|
||||
|
||||
enderio.darksteel.upgrade.glider.name=Planador
|
||||
enderio.darksteel.upgrade.glider.tooltip.detailed.line1=Ativa o planamento
|
||||
enderio.darksteel.upgrade.glider.enabled=Planador Ativado
|
||||
enderio.darksteel.upgrade.glider.disabled=Planador Desativado
|
||||
|
||||
enderio.darksteel.upgrade.sound.name=Localizador de Sons
|
||||
enderio.darksteel.upgrade.sound.tooltip.detailed.line1=Mostra a localização de
|
||||
enderio.darksteel.upgrade.sound.tooltip.detailed.line2=sons próximos
|
||||
enderio.darksteel.upgrade.sound.enabled=Localizador de Sons Ativado
|
||||
enderio.darksteel.upgrade.sound.disabled=Localizador de Sons Desativado
|
||||
|
||||
enderio.darksteel.upgrade.gogglesOfRevealing.name=Revelação
|
||||
enderio.darksteel.upgrade.gogglesOfRevealing.tooltip.detailed.line1=Desconto de Vis: 5%
|
||||
|
||||
item.itemGliderWing.name=Asa de Planador
|
||||
item.itemGliderWings.name=Asas de Planador
|
||||
item.itemGliderWings.tooltip.detailed.line1=Melhora para o peitoral
|
||||
item.itemGliderWings.tooltip.detailed.line2=de Aço Negro
|
||||
|
||||
enderio.darksteel.upgrade.jump_one.name=Pulo
|
||||
enderio.darksteel.upgrade.jump_one.tooltip.detailed.line1=Aumenta a altura do passo e do pulo
|
||||
enderio.darksteel.upgrade.stepAssist.enabled=Auxílio de Passos Ativado
|
||||
enderio.darksteel.upgrade.stepAssist.disabled=Auxílio de Passos Desativado
|
||||
|
||||
enderio.darksteel.upgrade.jump_two.name=Pulo II
|
||||
enderio.darksteel.upgrade.jump_two.tooltip.detailed.line1=Aumenta a altura do passo e do pulo
|
||||
enderio.darksteel.upgrade.jump_two.tooltip.detailed.line2=Permite pulos duplos
|
||||
|
||||
enderio.darksteel.upgrade.jump_three.name=Pulo III
|
||||
enderio.darksteel.upgrade.jump_three.tooltip.detailed.line1=Aumenta a altura do passo e do pulo
|
||||
enderio.darksteel.upgrade.jump_three.tooltip.detailed.line2=Permite pulos triplos
|
||||
|
||||
enderio.darksteel.upgrade.speed_one.name=Velocidade
|
||||
enderio.darksteel.upgrade.speed_one.tooltip.detailed.line1=Aumenta a velocidade de movimento
|
||||
enderio.darksteel.upgrade.speed.enabled=Velocidade Ativada
|
||||
enderio.darksteel.upgrade.speed.disabled=Velocidade Desativada
|
||||
|
||||
enderio.darksteel.upgrade.speed_two.name=Velocidade II
|
||||
enderio.darksteel.upgrade.speed_two.tooltip.detailed.line1=Aumenta a velocidade de movimento
|
||||
|
||||
enderio.darksteel.upgrade.speed_three.name=Velocidade III
|
||||
enderio.darksteel.upgrade.speed_three.tooltip.detailed.line1=Aumenta a velocidade de movimento
|
||||
|
||||
enderio.darksteel.upgrade.swim.name=Nadadeiras
|
||||
|
||||
enderio.darksteel.upgrade.nightVision.name=Visão Noturna
|
||||
enderio.darksteel.upgrade.nightVision.enabled=Visão Noturna Ativada
|
||||
enderio.darksteel.upgrade.nightVision.disabled=Visão Noturna Desativada
|
||||
|
||||
enderio.darksteel.upgrade.solar_one.name=Solar I
|
||||
enderio.darksteel.upgrade.solar_one.tooltip.detailed.line1=Gera energia do sol.
|
||||
|
||||
enderio.darksteel.upgrade.solar_two.name=Solar II
|
||||
enderio.darksteel.upgrade.solar_two.tooltip.detailed.line1=Gera energia do sol.
|
||||
|
||||
//------GUI
|
||||
|
||||
enderio.gui.simple.in=Entrada Máxima:
|
||||
enderio.gui.simple.out=Saída Máxima:
|
||||
enderio.gui.enabled=Ativado
|
||||
enderio.gui.disabled=Desativado
|
||||
enderio.gui.send=Enviar
|
||||
enderio.gui.receive=Receber
|
||||
enderio.gui.sendReceive=Enviar & Receber
|
||||
|
||||
//Redstone controls
|
||||
enderio.gui.tooltip.redstoneControlMode=Modo de Redstone
|
||||
enderio.gui.tooltip.redstoneControlMode.ignore=Sempre ativo
|
||||
enderio.gui.tooltip.redstoneControlMode.on=Ativo com sinal
|
||||
enderio.gui.tooltip.redstoneControlMode.off=Ativo sem sinal
|
||||
enderio.gui.tooltip.redstoneControlMode.never=Nunca ativo
|
||||
|
||||
enderio.gui.machine.ioMode.overlay.tooltip=Configurar IO
|
||||
enderio.gui.machine.ioMode.none=Nenhum
|
||||
enderio.gui.machine.ioMode.pull=Puxar
|
||||
enderio.gui.machine.ioMode.push=Empurrar
|
||||
enderio.gui.machine.ioMode.disabled=Desativado
|
||||
enderio.gui.machine.ioMode.pullPush=Empurrar / Puxar
|
||||
enderio.gui.machine.ioMode.pullPush.colored=%sEmpurrar %s/ %sPuxar
|
||||
enderio.gui.machine.ioMode=Modo: %s
|
||||
enderio.gui.machine.side=Lado: %s
|
||||
enderio.gui.machine.side.north=Norte
|
||||
enderio.gui.machine.side.south=Sul
|
||||
enderio.gui.machine.side.west=Oeste
|
||||
enderio.gui.machine.side.east=Lado
|
||||
enderio.gui.machine.side.up=Cima
|
||||
enderio.gui.machine.side.down=Baixo
|
||||
|
||||
|
||||
//Power Monitor
|
||||
enderio.gui.powerMonitor.engineControl=Controle de Motores
|
||||
enderio.gui.powerMonitor.emit=Emitir
|
||||
enderio.gui.powerMonitor.engineSection1=Emitir sinal quando o armazenamento
|
||||
enderio.gui.powerMonitor.engineSection2=está menos de
|
||||
enderio.gui.powerMonitor.engineSection3=% cheio.
|
||||
enderio.gui.powerMonitor.engineSection4= Parar quando o armazenamento está maior
|
||||
enderio.gui.powerMonitor.engineSection5=ou igual
|
||||
enderio.gui.powerMonitor.of=a
|
||||
enderio.gui.powerMonitor.monHeading1=Armazenamentos dos Condutos
|
||||
enderio.gui.powerMonitor.monHeading2=Armazenamento de Banco de Capacitores
|
||||
enderio.gui.powerMonitor.monHeading3=Buffer das Máquinas
|
||||
enderio.gui.powerMonitor.monHeading4=Saída média em 5 segundos
|
||||
enderio.gui.powerMonitor.monHeading5=Entrada média em 5 segundos
|
||||
|
||||
//MJ Reader
|
||||
enderio.gui.mjReader.networkHeading=Rede de Energia
|
||||
enderio.gui.mjReader.conduitBuffer=Buffer Interno
|
||||
enderio.gui.mjReader.requestRange=Alcance de pedido por tick
|
||||
enderio.gui.mjReader.currentRequest=Pedido atual
|
||||
enderio.gui.mjReader.itemHeading=Conduto de Item
|
||||
enderio.gui.mjReader.itemNoConnections=não tem nenhuma conexão externa
|
||||
enderio.gui.mjReader.noPowerFromSide=não pode receber energia desse lado
|
||||
enderio.gui.mjReader.connectionDir=conexão ao
|
||||
enderio.gui.mjReader.extractedItems=Itens extraídos
|
||||
enderio.gui.mjReader.extractedItem=Item
|
||||
enderio.gui.mjReader.noOutputs=não tem saídas válidas
|
||||
enderio.gui.mjReader.insertedInto=vai ser inserido em:
|
||||
enderio.gui.mjReader.noItems=Não recebe itens.
|
||||
enderio.gui.mjReader.noItem=Não pode receber
|
||||
enderio.gui.mjReader.receiveItems=Pode receber itens de:
|
||||
enderio.gui.mjReader.receiveItem1=Pode receber
|
||||
enderio.gui.mjReader.receiveItem2=de:
|
||||
|
||||
//CapactorBank
|
||||
enderio.gui.capBank.inputRs=Entrada Redstone Mode
|
||||
enderio.gui.capBank.outputRs=Saída Redstone Mode
|
||||
enderio.gui.capBank.maxIo=I/O Máximo
|
||||
enderio.gui.capBank.maxInput=Entrada Máxima
|
||||
enderio.gui.capBank.maxOutput=Saída Máxima
|
||||
enderio.gui.capBank.inputMode=Entrada
|
||||
enderio.gui.capBank.outputMode=Saída
|
||||
|
||||
//Transceiver
|
||||
enderio.gui.trans.publicChannel=Canal Público
|
||||
enderio.gui.trans.privateChannel=Canal Privado
|
||||
enderio.gui.trans.addChannel=Adicionar Canal
|
||||
enderio.gui.trans.deleteChannel=Deletar Canal
|
||||
enderio.gui.trans.activateChannel=Ativar Canal
|
||||
enderio.gui.trans.powerMode=Modo Energia
|
||||
enderio.gui.trans.fluidMode=Modo Fluido
|
||||
enderio.gui.trans.itemMode=Modo Item
|
||||
enderio.gui.trans.publicHeading=Público
|
||||
enderio.gui.trans.privateHeading=Privado
|
||||
|
||||
//Alloy Smelter
|
||||
enderio.gui.alloy.mode.heading=Modo Fornalha
|
||||
enderio.gui.alloy.mode.all=Qualquer Modo
|
||||
enderio.gui.alloy.mode.alloy=Apenas Ligas
|
||||
enderio.gui.alloy.mode.furnace=Apenas Fornalha
|
||||
|
||||
//Vat
|
||||
enderio.vat.outputTank=Tanque de Saída
|
||||
enderio.vat.inputTank=Tanque de Entrada
|
||||
enderio.gui.machine.vat.dump.1=Despejar no Tanque de Entrada
|
||||
enderio.gui.machine.vat.dump.2=Despejar no Tanque de Saída
|
||||
|
||||
//Combustion Gen
|
||||
enderio.combustionGenerator.coolantTank=Refrigerante
|
||||
enderio.combustionGenerator.fuelTank=Combustível
|
||||
enderio.combustionGenerator.output=A Gerar:
|
||||
|
||||
//Stirling Gen
|
||||
enderio.stirlingGenerator.output=A Gerar:
|
||||
enderio.stirlingGenerator.burnRate=Taxa de Queima:
|
||||
|
||||
//Travel Blocks
|
||||
enderio.gui.travelAccessable.privateBlock1=Apenas
|
||||
enderio.gui.travelAccessable.privateBlock2=pode mudar as configurações desse bloco
|
||||
enderio.gui.travelAccessable.public=Público
|
||||
enderio.gui.travelAccessable.private=Privado
|
||||
enderio.gui.travelAccessable.protected=Protegido
|
||||
enderio.gui.travelAccessable.unauthorised=Tu não tens permissão para acessar esse bloco.
|
||||
enderio.gui.travelAccessable.enterCode=Código de Acesso Requerido
|
||||
enderio.gui.travelAccessable.ok=Autorizar
|
||||
|
||||
//Spawn Gurad
|
||||
enderio.gui.spawnGurad.showRange=Mostrar Alcance
|
||||
enderio.gui.spawnGurad.range=Alcance:
|
||||
|
||||
//conduits
|
||||
enderio.gui.conduit.ioMode=Modo
|
||||
enderio.gui.conduit.ioMode.inOut=Entrada / Saída
|
||||
enderio.gui.conduit.ioMode.input=Extrair
|
||||
enderio.gui.conduit.ioMode.output=Inserir
|
||||
enderio.gui.conduit.ioMode.disabled=Desativado
|
||||
enderio.gui.conduit.ioMode.notSet=Padrão
|
||||
tile.blockConduitBundle.name=Conector de Condutos
|
||||
|
||||
enderio.gui.conduit.item.insertionFilter=Inserir
|
||||
enderio.gui.conduit.item.extractionFilter=Extrair
|
||||
enderio.gui.conduit.item.sigCol=Cor do Sinal
|
||||
enderio.gui.conduit.item.channel=Canal
|
||||
enderio.gui.conduit.item.ignoreMetaData=Ignorar Meta Data
|
||||
enderio.gui.conduit.item.matchMetaData=Corresponder Meta Data
|
||||
enderio.gui.conduit.item.whitelist=Whitelist
|
||||
enderio.gui.conduit.item.blacklist=Blacklist
|
||||
enderio.gui.conduit.item.stickyEnabled=Modo Grudento Ativado|Itens selecionados vão apenas|ser mandados pra esta ou outras|saídas Grudentas.
|
||||
enderio.gui.conduit.item.stickyDisbaled=Modo Grudento Desativado
|
||||
enderio.gui.conduit.item.ignoreNBT=Ignorar Dados NBT
|
||||
enderio.gui.conduit.item.matchNBT=Corresponder Dados NBT
|
||||
enderio.gui.conduit.item.oreDicEnabled=Ore Dictionary Ativado
|
||||
enderio.gui.conduit.item.oreDicDisabled=Ore Dictionary Desativado
|
||||
enderio.gui.conduit.item.selfFeedEnabled=Auto Alimentar
|
||||
enderio.gui.conduit.item.selfFeedDisabled=Auto Alimentar Desativado
|
||||
enderio.gui.conduit.item.roundRobinEnabled=Rodízio Ativado
|
||||
enderio.gui.conduit.item.roundRobinDisabled=Rodízio Desativado
|
||||
enderio.gui.conduit.item.priority=Prioridade
|
||||
|
||||
enderio.gui.conduit.redstone.signalColor=Cor do Sinal
|
||||
enderio.gui.conduit.redstone.color=Cor
|
||||
enderio.gui.conduit.redstone.signalStrengh=Sinal Forte
|
||||
enderio.gui.conduit.redstone.signalStrengh.tooltip=Liberar um sinal forte de redstone
|
||||
|
||||
enderio.gui.conduit.fluid.autoExtract=Auto Extrair
|
||||
enderio.gui.conduit.fluid.filter=Filtro
|
||||
|
||||
enderio.gui.conduit.gas.autoExtract=Auto Extrair
|
||||
|
||||
//Enchants
|
||||
enchantment.enderio.soulBound=Vínculo da Alma
|
||||
description.enchantment.enderio.soulBound=Esse encantamento previne o item de ser perdido na morte
|
||||
|
||||
//Configuration
|
||||
enderio.config.title=Configurações do Ender IO
|
||||
|
||||
enderio.config.power=Configurações de Energia
|
||||
enderio.config.power.tooltip=Tantos números pra Mudar...
|
||||
|
||||
enderio.config.recipe=Configurações de Receita
|
||||
enderio.config.recipe.tooltip=Configura TUDO isto!
|
||||
|
||||
enderio.config.item=Habilitação de Itens
|
||||
enderio.config.item.tooltip=Se tu não gostas de alguns dos meus incríveis itens :(
|
||||
|
||||
enderio.config.efficiency=Configurações de Eficiência
|
||||
enderio.config.efficiency.tooltip=Para onde os números vão?
|
||||
|
||||
enderio.config.personal=Configurações Pessoais
|
||||
enderio.config.personal.tooltip=Não vou contar pra ninguém, prometo.
|
||||
|
||||
enderio.config.anchor=Configurações da Âncora
|
||||
enderio.config.anchor.tooltip=Lançar âncoras!
|
||||
|
||||
enderio.config.staff=Configurações do Cajado
|
||||
enderio.config.staff.tooltip=Cuidado com essa coisa, vai teletransportar a sua cara.
|
||||
|
||||
enderio.config.darksteel=Aço Negro
|
||||
enderio.config.darksteel.tooltip=Não é qualquer aço, é aço §onegro§r§e.
|
||||
|
||||
enderio.config.farm=Configurações da Fazenda
|
||||
enderio.config.farm.tooltip="A comuna é para toda a vida!"
|
||||
|
||||
enderio.config.aesthetic=Configurações Estéticas
|
||||
enderio.config.aesthetic.tooltip=Oooh, ahhh, lindo.
|
||||
|
||||
enderio.config.advanced=Configurações Avançadas
|
||||
enderio.config.advanced.tooltip=Para aqueles que não conseguem ter configs o suficiente.
|
||||
|
||||
enderio.config.magnet=Configurações do Ímã
|
||||
enderio.config.magnet.tooltip=Como eles funcionam?
|
||||
|
||||
enderio.config.fluid=Configurações de Fluidos
|
||||
enderio.config.fluid.tooltip=Energia líquida pura!
|
||||
|
||||
enderio.config.spawner=Configurações do Invocador
|
||||
enderio.config.spawner.tooltip=Fiquei sem tooltips espertinhas.
|
||||
@@ -30,7 +30,7 @@ item.enderio.itemConduitFacade.tooltip.detailed.line4=экипированы
|
||||
item.enderio.itemConduitFacade.hardened.tooltip=Закалён: Выдерживает удары и взрывы
|
||||
|
||||
enderio.itemPowerConduit.name=Энергетическая труба
|
||||
enderio.itemPowerConduitEnhanced.name=Расширенная энергетическая труба
|
||||
enderio.itemPowerConduitEnhanced.name=Улучшенная энергетическая труба
|
||||
enderio.itemPowerConduitEnder.name=Энергетическая труба Края
|
||||
|
||||
enderio.itemRedstoneConduit.name=Красная труба
|
||||
@@ -706,7 +706,7 @@ enderio.gui.simple.out=Макс. выход:
|
||||
enderio.gui.available=Доступно
|
||||
enderio.gui.disabled=Выключено
|
||||
enderio.gui.enabled=Включено
|
||||
enderio.gui.max=Макс:
|
||||
enderio.gui.max=Макс:
|
||||
enderio.gui.progress=Прогресс {0,number}%
|
||||
enderio.gui.receive=Получать
|
||||
enderio.gui.send=Отправлять
|
||||
@@ -820,6 +820,12 @@ enderio.gui.alloy.mode.all=Выплавка всех материалов
|
||||
enderio.gui.alloy.mode.alloy=Только сплавы
|
||||
enderio.gui.alloy.mode.furnace=Только обычные рецепты
|
||||
|
||||
//Vacuum chest
|
||||
enderio.gui.vacuum.range=Сила всасывания
|
||||
enderio.gui.vacuum.header.chest=Вакуумный сундук
|
||||
enderio.gui.vacuum.header.filter=Предметный фильтр
|
||||
enderio.gui.vacuum.header.range=Дальность
|
||||
|
||||
//Vat
|
||||
enderio.vat.outputTank=Выход чана
|
||||
enderio.vat.inputTank=Вход чана
|
||||
@@ -829,13 +835,14 @@ enderio.gui.machine.vat.dump.2=Сбросить резервуар выхода
|
||||
//Combustion Gen
|
||||
enderio.combustionGenerator.coolantTank=Охладитель
|
||||
enderio.combustionGenerator.fuelTank=Топливо
|
||||
enderio.combustionGenerator.output=Генерирование:
|
||||
enderio.combustionGenerator.output=Генерирует:
|
||||
|
||||
//Stirling Gen
|
||||
enderio.stirlingGenerator.output=Генерирование:
|
||||
enderio.stirlingGenerator.burnRate=Скорость сгорания:
|
||||
enderio.stirlingGenerator.upgradeslot=Слот улучшения
|
||||
enderio.stirlingGenerator.upgrades={0} даёт {2}{1,number,#.#}x{3} эффективности
|
||||
enderio.stirlingGenerator.remaining=Осталось {0,number,percent}|{1,choice,0#|0<{1}m }{2,number}s|{3,number,#,###} RF
|
||||
|
||||
//Travel Blocks
|
||||
enderio.gui.travelAccessable.privateBlock1=Только
|
||||
|
||||
@@ -697,7 +697,7 @@ enderio.gui.simple.out=最大输出:
|
||||
enderio.gui.available=可用
|
||||
enderio.gui.disabled=禁用
|
||||
enderio.gui.enabled=启用
|
||||
enderio.gui.max=最大:
|
||||
enderio.gui.max=最大:
|
||||
enderio.gui.progress=进程 {0,number}%
|
||||
enderio.gui.receive=接收
|
||||
enderio.gui.send=发送
|
||||
|
||||
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
@@ -0,0 +1,108 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class BlockCoordinates implements Comparable
|
||||
{
|
||||
public int x;
|
||||
|
||||
/** the y coordinate */
|
||||
public int y;
|
||||
|
||||
/** the z coordinate */
|
||||
public int z;
|
||||
|
||||
public BlockCoordinates() {}
|
||||
|
||||
public BlockCoordinates(int par1, int par2, int par3)
|
||||
{
|
||||
this.x = par1;
|
||||
this.y = par2;
|
||||
this.z = par3;
|
||||
}
|
||||
|
||||
public BlockCoordinates(TileEntity tile)
|
||||
{
|
||||
this.x = tile.xCoord;
|
||||
this.y = tile.yCoord;
|
||||
this.z = tile.zCoord;
|
||||
}
|
||||
|
||||
public BlockCoordinates(BlockCoordinates par1ChunkCoordinates)
|
||||
{
|
||||
this.x = par1ChunkCoordinates.x;
|
||||
this.y = par1ChunkCoordinates.y;
|
||||
this.z = par1ChunkCoordinates.z;
|
||||
}
|
||||
|
||||
public boolean equals(Object par1Obj)
|
||||
{
|
||||
if (!(par1Obj instanceof BlockCoordinates))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockCoordinates coordinates = (BlockCoordinates)par1Obj;
|
||||
return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z ;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.x + this.y << 8 + this.z << 16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the coordinate with another coordinate
|
||||
*/
|
||||
public int compareWorldCoordinate(BlockCoordinates par1)
|
||||
{
|
||||
return this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y;
|
||||
}
|
||||
|
||||
public void set(int par1, int par2, int par3, int d)
|
||||
{
|
||||
this.x = par1;
|
||||
this.y = par2;
|
||||
this.z = par3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the squared distance between this coordinates and the coordinates given as argument.
|
||||
*/
|
||||
public float getDistanceSquared(int par1, int par2, int par3)
|
||||
{
|
||||
float f = (float)(this.x - par1);
|
||||
float f1 = (float)(this.y - par2);
|
||||
float f2 = (float)(this.z - par3);
|
||||
return f * f + f1 * f1 + f2 * f2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the squared distance between this coordinates and the ChunkCoordinates given as argument.
|
||||
*/
|
||||
public float getDistanceSquaredToWorldCoordinates(BlockCoordinates par1ChunkCoordinates)
|
||||
{
|
||||
return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z);
|
||||
}
|
||||
|
||||
public int compareTo(Object par1Obj)
|
||||
{
|
||||
return this.compareWorldCoordinate((BlockCoordinates)par1Obj);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
this.x = nbt.getInteger("b_x");
|
||||
this.y = nbt.getInteger("b_y");
|
||||
this.z = nbt.getInteger("b_z");
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("b_x",x);
|
||||
nbt.setInteger("b_y",y);
|
||||
nbt.setInteger("b_z",z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IArchitect {
|
||||
|
||||
/**
|
||||
* Returns a list of blocks that should be highlighted in world.
|
||||
*/
|
||||
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world,
|
||||
int x, int y, int z, int side, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* which axis should be displayed.
|
||||
*/
|
||||
public boolean showAxis(ItemStack stack, World world, EntityPlayer player, int side, EnumAxis axis);
|
||||
|
||||
public enum EnumAxis {
|
||||
X, // east / west
|
||||
Y, // up / down
|
||||
Z; // north / south
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
* Items, armor and tools with this interface can receive the Repair enchantment.
|
||||
* Repairs 1 point of durability every 10 seconds (2 for repair II)
|
||||
*/
|
||||
public interface IRepairable {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
* Items, armor and tools with this interface can receive the Repair enchantment.
|
||||
* Repairs 1 point of durability every 10 seconds (2 for repair II)
|
||||
*/
|
||||
public interface IRepairableExtended extends IRepairable {
|
||||
|
||||
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantlevel);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Armor or bauble slot items that implement this interface can provide runic shielding.
|
||||
* Recharging, hardening, etc. is handled internally by thaumcraft.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IRunicArmor {
|
||||
|
||||
/**
|
||||
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
|
||||
*/
|
||||
public int getRunicCharge(ItemStack itemstack);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Interface used to identify scribing tool items used in research table
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IScribeTools {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Armor, held items or bauble slot items that implement this interface add warp when equipped or held.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWarpingGear {
|
||||
|
||||
/**
|
||||
* returns how much warp this item adds while worn or held.
|
||||
*/
|
||||
public int getWarp(ItemStack itemstack, EntityPlayer player);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
*
|
||||
* This is used to gain access to the items in my mod.
|
||||
* I only give some examples and it will probably still
|
||||
* require a bit of work for you to get hold of everything you need.
|
||||
*
|
||||
*/
|
||||
public class ItemApi {
|
||||
|
||||
public static ItemStack getItem(String itemString, int meta) {
|
||||
ItemStack item = null;
|
||||
|
||||
try {
|
||||
String itemClass = "thaumcraft.common.config.ConfigItems";
|
||||
Object obj = Class.forName(itemClass).getField(itemString).get(null);
|
||||
if (obj instanceof Item) {
|
||||
item = new ItemStack((Item) obj,1,meta);
|
||||
} else if (obj instanceof ItemStack) {
|
||||
item = (ItemStack) obj;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public static ItemStack getBlock(String itemString, int meta) {
|
||||
ItemStack item = null;
|
||||
|
||||
try {
|
||||
String itemClass = "thaumcraft.common.config.ConfigBlocks";
|
||||
Object obj = Class.forName(itemClass).getField(itemString).get(null);
|
||||
if (obj instanceof Block) {
|
||||
item = new ItemStack((Block) obj,1,meta);
|
||||
} else if (obj instanceof ItemStack) {
|
||||
item = (ItemStack) obj;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Some examples
|
||||
*
|
||||
* Casting Wands:
|
||||
* itemWandCasting
|
||||
*
|
||||
* Resources:
|
||||
* itemEssence, itemWispEssence, itemResource, itemShard, itemNugget,
|
||||
* itemNuggetChicken, itemNuggetBeef, itemNuggetPork, itemTripleMeatTreat
|
||||
*
|
||||
* Research:
|
||||
* itemResearchNotes, itemInkwell, itemThaumonomicon
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemRunic extends Item implements IRunicArmor {
|
||||
|
||||
int charge;
|
||||
|
||||
public ItemRunic (int charge)
|
||||
{
|
||||
super();
|
||||
this.charge = charge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunicCharge(ItemStack itemstack) {
|
||||
return charge;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
||||
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.crafting.ShapedArcaneRecipe;
|
||||
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
|
||||
import thaumcraft.api.internal.DummyInternalMethodHandler;
|
||||
import thaumcraft.api.internal.IInternalMethodHandler;
|
||||
import thaumcraft.api.internal.WeightedRandomLoot;
|
||||
import thaumcraft.api.research.IScanEventHandler;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchCategoryList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
*
|
||||
*
|
||||
* IMPORTANT: If you are adding your own aspects to items it is a good idea to do it AFTER Thaumcraft adds its aspects, otherwise odd things may happen.
|
||||
*
|
||||
*/
|
||||
public class ThaumcraftApi {
|
||||
|
||||
//Materials
|
||||
public static ToolMaterial toolMatThaumium = EnumHelper.addToolMaterial("THAUMIUM", 3, 400, 7F, 2, 22);
|
||||
public static ToolMaterial toolMatVoid = EnumHelper.addToolMaterial("VOID", 4, 150, 8F, 3, 10);
|
||||
public static ToolMaterial toolMatElemental = EnumHelper.addToolMaterial("THAUMIUM_ELEMENTAL", 3, 1500, 10F, 3, 18);
|
||||
public static ArmorMaterial armorMatThaumium = EnumHelper.addArmorMaterial("THAUMIUM", 25, new int[] { 2, 6, 5, 2 }, 25);
|
||||
public static ArmorMaterial armorMatSpecial = EnumHelper.addArmorMaterial("SPECIAL", 25, new int[] { 1, 3, 2, 1 }, 25);
|
||||
public static ArmorMaterial armorMatThaumiumFortress = EnumHelper.addArmorMaterial("FORTRESS", 40, new int[] { 3, 7, 6, 3 }, 25);
|
||||
public static ArmorMaterial armorMatVoid = EnumHelper.addArmorMaterial("VOID", 10, new int[] { 3, 7, 6, 3 }, 10);
|
||||
public static ArmorMaterial armorMatVoidFortress = EnumHelper.addArmorMaterial("VOIDFORTRESS", 18, new int[] { 4, 8, 7, 4 }, 10);
|
||||
|
||||
//Enchantment references
|
||||
public static int enchantFrugal;
|
||||
public static int enchantPotency;
|
||||
public static int enchantWandFortune;
|
||||
public static int enchantHaste;
|
||||
public static int enchantRepair;
|
||||
|
||||
//Miscellaneous
|
||||
/**
|
||||
* Portable Hole Block-id Blacklist.
|
||||
* Simply add the block-id's of blocks you don't want the portable hole to go through.
|
||||
*/
|
||||
public static ArrayList<Block> portableHoleBlackList = new ArrayList<Block>();
|
||||
|
||||
//Internal (Do not alter this unless you like pretty explosions)
|
||||
//Calling methods from this will only work properly once Thaumcraft is past the FMLPreInitializationEvent phase.
|
||||
public static IInternalMethodHandler internalMethods = new DummyInternalMethodHandler();
|
||||
|
||||
//RESEARCH/////////////////////////////////////////
|
||||
public static ArrayList<IScanEventHandler> scanEventhandlers = new ArrayList<IScanEventHandler>();
|
||||
public static ArrayList<EntityTags> scanEntities = new ArrayList<EntityTags>();
|
||||
public static class EntityTagsNBT {
|
||||
public EntityTagsNBT(String name, Object value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
public String name;
|
||||
public Object value;
|
||||
}
|
||||
public static class EntityTags {
|
||||
public EntityTags(String entityName, AspectList aspects, EntityTagsNBT... nbts) {
|
||||
this.entityName = entityName;
|
||||
this.nbts = nbts;
|
||||
this.aspects = aspects;
|
||||
}
|
||||
public String entityName;
|
||||
public EntityTagsNBT[] nbts;
|
||||
public AspectList aspects;
|
||||
}
|
||||
|
||||
/**
|
||||
* not really working atm, so ignore it for now
|
||||
* @param scanEventHandler
|
||||
*/
|
||||
public static void registerScanEventhandler(IScanEventHandler scanEventHandler) {
|
||||
scanEventhandlers.add(scanEventHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to add aspects to entities which you can then scan using a thaumometer.
|
||||
* Also used to calculate vis drops from mobs.
|
||||
* @param entityName
|
||||
* @param aspects
|
||||
* @param nbt you can specify certain nbt keys and their values
|
||||
* to differentiate between mobs. <br>For example the normal and wither skeleton:
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 5));
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 8), new NBTTagByte("SkeletonType",(byte) 1));
|
||||
*/
|
||||
public static void registerEntityTag(String entityName, AspectList aspects, EntityTagsNBT... nbt ) {
|
||||
scanEntities.add(new EntityTags(entityName,aspects,nbt));
|
||||
}
|
||||
|
||||
//RECIPES/////////////////////////////////////////
|
||||
private static ArrayList craftingRecipes = new ArrayList();
|
||||
private static HashMap<Object,ItemStack> smeltingBonus = new HashMap<Object,ItemStack>();
|
||||
|
||||
/**
|
||||
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
|
||||
* @param in The input of the smelting operation. e.g. new ItemStack(Block.oreGold)
|
||||
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
|
||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
||||
*/
|
||||
public static void addSmeltingBonus(ItemStack in, ItemStack out) {
|
||||
smeltingBonus.put(
|
||||
Arrays.asList(in.getItem(),in.getItemDamage()),
|
||||
new ItemStack(out.getItem(),0,out.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
|
||||
* @param in The ore dictionary input of the smelting operation. e.g. "oreGold"
|
||||
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
|
||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
||||
*/
|
||||
public static void addSmeltingBonus(String in, ItemStack out) {
|
||||
smeltingBonus.put( in, new ItemStack(out.getItem(),0,out.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bonus item produced from a smelting operation in the infernal furnace
|
||||
* @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
|
||||
* @return the The bonus item that can be produced
|
||||
*/
|
||||
public static ItemStack getSmeltingBonus(ItemStack in) {
|
||||
ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
|
||||
if (out==null) {
|
||||
out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
if (out==null) {
|
||||
String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
|
||||
out = smeltingBonus.get(od);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static List getCraftingRecipes() {
|
||||
return craftingRecipes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect.
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
{
|
||||
ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
{
|
||||
ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
|
||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param aspects input the central item to be infused
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*
|
||||
*/
|
||||
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input,ItemStack[] recipe)
|
||||
{
|
||||
if (!(result instanceof ItemStack || result instanceof Object[])) return null;
|
||||
InfusionRecipe r= new InfusionRecipe(research, result, instability, aspects, input, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param enchantment the enchantment that will be applied to the item
|
||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*
|
||||
*/
|
||||
public static InfusionEnchantmentRecipe addInfusionEnchantmentRecipe(String research, Enchantment enchantment, int instability, AspectList aspects, ItemStack[] recipe)
|
||||
{
|
||||
InfusionEnchantmentRecipe r= new InfusionEnchantmentRecipe(research, enchantment, instability, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stack the recipe result
|
||||
* @return the recipe
|
||||
*/
|
||||
public static InfusionRecipe getInfusionRecipe(ItemStack res) {
|
||||
for (Object r:getCraftingRecipes()) {
|
||||
if (r instanceof InfusionRecipe) {
|
||||
if (((InfusionRecipe)r).getRecipeOutput() instanceof ItemStack) {
|
||||
if (((ItemStack) ((InfusionRecipe)r).getRecipeOutput()).isItemEqual(res))
|
||||
return (InfusionRecipe)r;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work.
|
||||
* @param result the output result
|
||||
* @param catalyst an itemstack of the catalyst or a string if it is an ore dictionary item
|
||||
* @param cost the vis cost
|
||||
* @param tags the aspects required to craft this
|
||||
*/
|
||||
public static CrucibleRecipe addCrucibleRecipe(String key, ItemStack result, Object catalyst, AspectList tags) {
|
||||
CrucibleRecipe rc = new CrucibleRecipe(key, result, catalyst, tags);
|
||||
getCraftingRecipes().add(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param stack the recipe result
|
||||
* @return the recipe
|
||||
*/
|
||||
public static CrucibleRecipe getCrucibleRecipe(ItemStack stack) {
|
||||
for (Object r:getCraftingRecipes()) {
|
||||
if (r instanceof CrucibleRecipe) {
|
||||
if (((CrucibleRecipe)r).getRecipeOutput().isItemEqual(stack))
|
||||
return (CrucibleRecipe)r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hash the unique recipe code
|
||||
* @return the recipe
|
||||
*/
|
||||
public static CrucibleRecipe getCrucibleRecipeFromHash(int hash) {
|
||||
for (Object r:getCraftingRecipes()) {
|
||||
if (r instanceof CrucibleRecipe) {
|
||||
if (((CrucibleRecipe)r).hash==hash)
|
||||
return (CrucibleRecipe)r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the thaumonomicon drilldown feature.
|
||||
* @param stack the item
|
||||
* @return the thaumcraft recipe key that produces that item.
|
||||
*/
|
||||
private static HashMap<int[],Object[]> keyCache = new HashMap<int[],Object[]>();
|
||||
|
||||
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) {
|
||||
int[] key = new int[] {Item.getIdFromItem(stack.getItem()),stack.getItemDamage()};
|
||||
if (keyCache.containsKey(key)) {
|
||||
if (keyCache.get(key)==null) return null;
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), (String)(keyCache.get(key))[0]))
|
||||
return keyCache.get(key);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
for (ResearchCategoryList rcl:ResearchCategories.researchCategories.values()) {
|
||||
for (ResearchItem ri:rcl.research.values()) {
|
||||
if (ri.getPages()==null) continue;
|
||||
for (int a=0;a<ri.getPages().length;a++) {
|
||||
ResearchPage page = ri.getPages()[a];
|
||||
if (page.recipe!=null && page.recipe instanceof CrucibleRecipe[]) {
|
||||
CrucibleRecipe[] crs = (CrucibleRecipe[]) page.recipe;
|
||||
for (CrucibleRecipe cr:crs) {
|
||||
if (cr.getRecipeOutput().isItemEqual(stack)) {
|
||||
keyCache.put(key,new Object[] {ri.key,a});
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key))
|
||||
return new Object[] {ri.key,a};
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (page.recipeOutput!=null && stack !=null && page.recipeOutput.isItemEqual(stack)) {
|
||||
keyCache.put(key,new Object[] {ri.key,a});
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key))
|
||||
return new Object[] {ri.key,a};
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
keyCache.put(key,null);
|
||||
return null;
|
||||
}
|
||||
|
||||
//ASPECTS////////////////////////////////////////
|
||||
|
||||
public static ConcurrentHashMap<List,AspectList> objectTags = new ConcurrentHashMap<List,AspectList>();
|
||||
public static ConcurrentHashMap<List,int[]> groupedObjectTags = new ConcurrentHashMap<List,int[]>();
|
||||
|
||||
/**
|
||||
* Checks to see if the passed item/block already has aspects associated with it.
|
||||
* @param id
|
||||
* @param meta
|
||||
* @return
|
||||
*/
|
||||
public static boolean exists(Item item, int meta) {
|
||||
AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,meta));
|
||||
if (tmp==null) {
|
||||
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,OreDictionary.WILDCARD_VALUE));
|
||||
if (meta==OreDictionary.WILDCARD_VALUE && tmp==null) {
|
||||
int index=0;
|
||||
do {
|
||||
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,index));
|
||||
index++;
|
||||
} while (index<16 && tmp==null);
|
||||
}
|
||||
if (tmp==null) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
||||
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
|
||||
* @param item the item passed. Pass OreDictionary.WILDCARD_VALUE if all damage values of this item/block should have the same aspects
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(ItemStack item, AspectList aspects) {
|
||||
if (aspects==null) aspects=new AspectList();
|
||||
try {
|
||||
objectTags.put(Arrays.asList(item.getItem(),item.getItemDamage()), aspects);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
||||
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), new int[]{0,1}, (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
|
||||
* @param item
|
||||
* @param meta A range of meta values if you wish to lump several item meta's together as being the "same" item (i.e. stair orientations)
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(ItemStack item, int[] meta, AspectList aspects) {
|
||||
if (aspects==null) aspects=new AspectList();
|
||||
try {
|
||||
objectTags.put(Arrays.asList(item.getItem(),meta[0]), aspects);
|
||||
for (int m:meta) {
|
||||
groupedObjectTags.put(Arrays.asList(item.getItem(),m), meta);
|
||||
}
|
||||
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign apsects to the given ore dictionary item.
|
||||
* @param oreDict the ore dictionary name
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerObjectTag(String oreDict, AspectList aspects) {
|
||||
if (aspects==null) aspects=new AspectList();
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(oreDict);
|
||||
if (ores!=null && ores.size()>0) {
|
||||
for (ItemStack ore:ores) {
|
||||
try {
|
||||
objectTags.put(Arrays.asList(ore.getItem(), ore.getItemDamage()), aspects);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to assign aspects to the given item/block.
|
||||
* Attempts to automatically generate aspect tags by checking registered recipes.
|
||||
* Here is an example of the declaration for pistons:<p>
|
||||
* <i>ThaumcraftApi.registerComplexObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 4));</i>
|
||||
* IMPORTANT - this should only be used if you are not happy with the default aspects the object would be assigned.
|
||||
* @param item, pass OreDictionary.WILDCARD_VALUE to meta if all damage values of this item/block should have the same aspects
|
||||
* @param aspects A ObjectTags object of the associated aspects
|
||||
*/
|
||||
public static void registerComplexObjectTag(ItemStack item, AspectList aspects ) {
|
||||
if (!exists(item.getItem(),item.getItemDamage())) {
|
||||
AspectList tmp = ThaumcraftApiHelper.generateTags(item.getItem(), item.getItemDamage());
|
||||
if (tmp != null && tmp.size()>0) {
|
||||
for(Aspect tag:tmp.getAspects()) {
|
||||
aspects.add(tag, tmp.getAmount(tag));
|
||||
}
|
||||
}
|
||||
registerObjectTag(item,aspects);
|
||||
} else {
|
||||
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(item);
|
||||
for(Aspect tag:aspects.getAspects()) {
|
||||
tmp.merge(tag, tmp.getAmount(tag));
|
||||
}
|
||||
registerObjectTag(item,tmp);
|
||||
}
|
||||
}
|
||||
|
||||
//WARP ///////////////////////////////////////////////////////////////////////////////////////
|
||||
private static HashMap<Object,Integer> warpMap = new HashMap<Object,Integer>();
|
||||
|
||||
/**
|
||||
* This method is used to determine how much warp is gained if the item is crafted. The warp
|
||||
* added is "sticky" warp
|
||||
* @param craftresult The item crafted
|
||||
* @param amount how much warp is gained
|
||||
*/
|
||||
public static void addWarpToItem(ItemStack craftresult, int amount) {
|
||||
warpMap.put(Arrays.asList(craftresult.getItem(),craftresult.getItemDamage()),amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to determine how much permanent warp is gained if the research is completed
|
||||
* @param in The item crafted
|
||||
* @param amount how much warp is gained
|
||||
*/
|
||||
public static void addWarpToResearch(String research, int amount) {
|
||||
warpMap.put(research, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how much warp is gained from the item or research passed in
|
||||
* @param in itemstack or string
|
||||
* @return how much warp it will give
|
||||
*/
|
||||
public static int getWarp(Object in) {
|
||||
if (in==null) return 0;
|
||||
if (in instanceof ItemStack && warpMap.containsKey(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage()))) {
|
||||
return warpMap.get(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage()));
|
||||
} else
|
||||
if (in instanceof String && warpMap.containsKey((String)in)) {
|
||||
return warpMap.get((String)in);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//LOOT BAGS //////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Used to add possible loot to treasure bags. As a reference, the weight of gold coins are 2000
|
||||
* and a diamond is 50.
|
||||
* The weights are the same for all loot bag types - the only difference is how many items the bag
|
||||
* contains.
|
||||
* @param item
|
||||
* @param weight
|
||||
* @param bagTypes array of which type of bag to add this loot to. Multiple types can be specified
|
||||
* 0 = common, 1 = uncommon, 2 = rare
|
||||
*/
|
||||
public static void addLootBagItem(ItemStack item, int weight, int... bagTypes) {
|
||||
if (bagTypes==null || bagTypes.length==0)
|
||||
WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight));
|
||||
else {
|
||||
for (int rarity:bagTypes) {
|
||||
switch(rarity) {
|
||||
case 0: WeightedRandomLoot.lootBagCommon.add(new WeightedRandomLoot(item,weight)); break;
|
||||
case 1: WeightedRandomLoot.lootBagUncommon.add(new WeightedRandomLoot(item,weight)); break;
|
||||
case 2: WeightedRandomLoot.lootBagRare.add(new WeightedRandomLoot(item,weight)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CROPS //////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* To define mod crops you need to use FMLInterModComms in your @Mod.Init method.
|
||||
* There are two 'types' of crops you can add. Standard crops and clickable crops.
|
||||
*
|
||||
* Standard crops work like normal vanilla crops - they grow until a certain metadata
|
||||
* value is reached and you harvest them by destroying the block and collecting the blocks.
|
||||
* You need to create and ItemStack that tells the golem what block id and metadata represents
|
||||
* the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get
|
||||
* checked.
|
||||
* Example for vanilla wheat:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStandardCrop", new ItemStack(Block.crops,1,7));
|
||||
*
|
||||
* Clickable crops are crops that you right click to gather their bounty instead of destroying them.
|
||||
* As for standard crops, you need to create and ItemStack that tells the golem what block id
|
||||
* and metadata represents the crop when fully grown. The golem will trigger the blocks onBlockActivated method.
|
||||
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
|
||||
* Example (this will technically do nothing since clicking wheat does nothing, but you get the idea):
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(Block.crops,1,7));
|
||||
*
|
||||
* Stacked crops (like reeds) are crops that you wish the bottom block should remain after harvesting.
|
||||
* As for standard crops, you need to create and ItemStack that tells the golem what block id
|
||||
* and metadata represents the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the actualy md won't get
|
||||
* checked. If it has the order upgrade it will only harvest if the crop is more than one block high.
|
||||
* Example:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStackedCrop", new ItemStack(Block.reed,1,7));
|
||||
*/
|
||||
|
||||
//NATIVE CLUSTERS //////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* You can define certain ores that will have a chance to produce native clusters via FMLInterModComms
|
||||
* in your @Mod.Init method using the "nativeCluster" string message.
|
||||
* The format should be:
|
||||
* "[ore item/block id],[ore item/block metadata],[cluster item/block id],[cluster item/block metadata],[chance modifier float]"
|
||||
*
|
||||
* NOTE: The chance modifier is a multiplier applied to the default chance for that cluster to be produced (default 27.5% for a pickaxe of the core)
|
||||
*
|
||||
* Example for vanilla iron ore to produce one of my own native iron clusters (assuming default id's) at double the default chance:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "nativeCluster","15,0,25016,16,2.0");
|
||||
*/
|
||||
|
||||
//LAMP OF GROWTH BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* You can blacklist crops that should not be effected by the Lamp of Growth via FMLInterModComms
|
||||
* in your @Mod.Init method using the "lampBlacklist" itemstack message.
|
||||
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
|
||||
* Example for vanilla wheat:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "lampBlacklist", new ItemStack(Block.crops,1,OreDictionary.WILDCARD_VALUE));
|
||||
*/
|
||||
|
||||
//DIMENSION BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* You can blacklist a dimension to not spawn certain thaumcraft features
|
||||
* in your @Mod.Init method using the "dimensionBlacklist" string message in the format "[dimension]:[level]"
|
||||
* The level values are as follows:
|
||||
* [0] stop all tc spawning and generation
|
||||
* [1] allow ore and node generation (and node special features)
|
||||
* [2] allow mob spawning
|
||||
* [3] allow ore and node gen + mob spawning (and node special features)
|
||||
* Example:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "dimensionBlacklist", "15:1");
|
||||
*/
|
||||
|
||||
//BIOME BLACKLIST ///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* You can blacklist a biome to not spawn certain thaumcraft features
|
||||
* in your @Mod.Init method using the "biomeBlacklist" string message in the format "[biome id]:[level]"
|
||||
* The level values are as follows:
|
||||
* [0] stop all tc spawning and generation
|
||||
* [1] allow ore and node generation (and node special features)
|
||||
* [2] allow mob spawning
|
||||
* [3] allow ore and node gen + mob spawning (and node special features)
|
||||
* Example:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "biomeBlacklist", "180:2");
|
||||
*/
|
||||
|
||||
//CHAMPION MOB WHITELIST ///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* You can whitelist an entity class so it can rarely spawn champion versions in your @Mod.Init method using
|
||||
* the "championWhiteList" string message in the format "[Entity]:[level]"
|
||||
* The entity must extend EntityMob.
|
||||
* [Entity] is in a similar format to what is used for mob spawners and such (see EntityList.class for vanilla examples).
|
||||
* The [level] value indicate how rare the champion version will be - the higher the number the more common.
|
||||
* The number roughly equals the [n] in 100 chance of a mob being a champion version.
|
||||
* You can give 0 or negative numbers to allow champions to spawn with a very low chance only in particularly dangerous places.
|
||||
* However anything less than about -2 will probably result in no spawns at all.
|
||||
* Example:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "championWhiteList", "Thaumcraft.Wisp:1");
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
|
||||
public class ThaumcraftApiHelper {
|
||||
|
||||
public static AspectList cullTags(AspectList temp) {
|
||||
AspectList temp2 = new AspectList();
|
||||
for (Aspect tag:temp.getAspects()) {
|
||||
if (tag!=null)
|
||||
temp2.add(tag, temp.getAmount(tag));
|
||||
}
|
||||
while (temp2!=null && temp2.size()>6) {
|
||||
Aspect lowest = null;
|
||||
float low = Short.MAX_VALUE;
|
||||
for (Aspect tag:temp2.getAspects()) {
|
||||
if (tag==null) continue;
|
||||
float ta=temp2.getAmount(tag);
|
||||
if (tag.isPrimal()) {
|
||||
ta *= .9f;
|
||||
} else {
|
||||
if (!tag.getComponents()[0].isPrimal()) {
|
||||
ta *= 1.1f;
|
||||
if (!tag.getComponents()[0].getComponents()[0].isPrimal()) {
|
||||
ta *= 1.05f;
|
||||
}
|
||||
if (!tag.getComponents()[0].getComponents()[1].isPrimal()) {
|
||||
ta *= 1.05f;
|
||||
}
|
||||
}
|
||||
if (!tag.getComponents()[1].isPrimal()) {
|
||||
ta *= 1.1f;
|
||||
if (!tag.getComponents()[1].getComponents()[0].isPrimal()) {
|
||||
ta *= 1.05f;
|
||||
}
|
||||
if (!tag.getComponents()[1].getComponents()[1].isPrimal()) {
|
||||
ta *= 1.05f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ta<low) {
|
||||
low = ta;
|
||||
lowest = tag;
|
||||
}
|
||||
}
|
||||
temp2.aspects.remove(lowest);
|
||||
}
|
||||
return temp2;
|
||||
}
|
||||
|
||||
public static boolean areItemsEqual(ItemStack s1,ItemStack s2)
|
||||
{
|
||||
if (s1.isItemStackDamageable() && s2.isItemStackDamageable())
|
||||
{
|
||||
return s1.getItem() == s2.getItem();
|
||||
} else
|
||||
return s1.getItem() == s2.getItem() && s1.getItemDamage() == s2.getItemDamage();
|
||||
}
|
||||
|
||||
public static boolean isResearchComplete(String username, String researchkey) {
|
||||
return ThaumcraftApi.internalMethods.isResearchComplete(username, researchkey);
|
||||
}
|
||||
|
||||
public static boolean hasDiscoveredAspect(String username, Aspect aspect) {
|
||||
return ThaumcraftApi.internalMethods.hasDiscoveredAspect(username, aspect);
|
||||
}
|
||||
|
||||
public static AspectList getDiscoveredAspects(String username) {
|
||||
return ThaumcraftApi.internalMethods.getDiscoveredAspects(username);
|
||||
}
|
||||
|
||||
public static ItemStack getStackInRowAndColumn(Object instance, int row, int column) {
|
||||
return ThaumcraftApi.internalMethods.getStackInRowAndColumn(instance, row, column);
|
||||
}
|
||||
|
||||
public static AspectList getObjectAspects(ItemStack is) {
|
||||
return ThaumcraftApi.internalMethods.getObjectAspects(is);
|
||||
}
|
||||
|
||||
public static AspectList getBonusObjectTags(ItemStack is,AspectList ot) {
|
||||
return ThaumcraftApi.internalMethods.getBonusObjectTags(is, ot);
|
||||
}
|
||||
|
||||
public static AspectList generateTags(Item item, int meta) {
|
||||
return ThaumcraftApi.internalMethods.generateTags(item, meta);
|
||||
}
|
||||
|
||||
public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
|
||||
{
|
||||
for (ItemStack input : inputs)
|
||||
{
|
||||
for (ItemStack target : targets)
|
||||
{
|
||||
if (itemMatches(target, input, strict))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean areItemStackTagsEqualForCrafting(ItemStack slotItem,ItemStack recipeItem)
|
||||
{
|
||||
if (recipeItem == null || slotItem == null) return false;
|
||||
if (recipeItem.stackTagCompound!=null && slotItem.stackTagCompound==null ) return false;
|
||||
if (recipeItem.stackTagCompound==null ) return true;
|
||||
|
||||
Iterator iterator = recipeItem.stackTagCompound.func_150296_c().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String)iterator.next();
|
||||
if (slotItem.stackTagCompound.hasKey(s)) {
|
||||
if (!slotItem.stackTagCompound.getTag(s).toString().equals(
|
||||
recipeItem.stackTagCompound.getTag(s).toString())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
|
||||
{
|
||||
if (input == null && target != null || input != null && target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.getItem() == input.getItem() &&
|
||||
((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
|
||||
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
|
||||
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
|
||||
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
|
||||
return te;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
|
||||
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
|
||||
return te;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HashMap<Integer, AspectList> allAspects= new HashMap<Integer, AspectList>();
|
||||
private static HashMap<Integer, AspectList> allCompoundAspects= new HashMap<Integer, AspectList>();
|
||||
|
||||
public static AspectList getAllAspects(int amount) {
|
||||
if (allAspects.get(amount)==null) {
|
||||
AspectList al = new AspectList();
|
||||
for (Aspect aspect:Aspect.aspects.values()) {
|
||||
al.add(aspect, amount);
|
||||
}
|
||||
allAspects.put(amount, al);
|
||||
}
|
||||
return allAspects.get(amount);
|
||||
}
|
||||
|
||||
public static AspectList getAllCompoundAspects(int amount) {
|
||||
if (allCompoundAspects.get(amount)==null) {
|
||||
AspectList al = new AspectList();
|
||||
for (Aspect aspect:Aspect.getCompoundAspects()) {
|
||||
al.add(aspect, amount);
|
||||
}
|
||||
allCompoundAspects.put(amount, al);
|
||||
}
|
||||
return allCompoundAspects.get(amount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use to subtract vis from a wand for most operations
|
||||
* Wands store vis differently so "real" vis costs need to be multiplied by 100 before calling this method
|
||||
* @param wand the wand itemstack
|
||||
* @param player the player using the wand
|
||||
* @param cost the cost of the operation.
|
||||
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
|
||||
* @param crafting is this a crafting operation or not - if
|
||||
* false then things like frugal and potency will apply to the costs
|
||||
* @return was the vis successfully subtracted
|
||||
*/
|
||||
public static boolean consumeVisFromWand(ItemStack wand, EntityPlayer player,
|
||||
AspectList cost, boolean doit, boolean crafting) {
|
||||
return ThaumcraftApi.internalMethods.consumeVisFromWand(wand, player, cost, doit, crafting);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract vis for use by a crafting mechanic. Costs are calculated slightly
|
||||
* differently and things like the frugal enchant is ignored
|
||||
* Must NOT be multiplied by 100 - send the actual vis cost
|
||||
* @param wand the wand itemstack
|
||||
* @param player the player using the wand
|
||||
* @param cost the cost of the operation.
|
||||
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
|
||||
* @return was the vis successfully subtracted
|
||||
*/
|
||||
public static boolean consumeVisFromWandCrafting(ItemStack wand, EntityPlayer player,
|
||||
AspectList cost, boolean doit) {
|
||||
return ThaumcraftApi.internalMethods.consumeVisFromWandCrafting(wand, player, cost, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract vis from a wand the player is carrying. Works like consumeVisFromWand in that actual vis
|
||||
* costs should be multiplied by 100. The costs are handled like crafting however and things like
|
||||
* frugal don't effect them
|
||||
* @param player the player using the wand
|
||||
* @param cost the cost of the operation.
|
||||
* @return was the vis successfully subtracted
|
||||
*/
|
||||
public static boolean consumeVisFromInventory(EntityPlayer player, AspectList cost) {
|
||||
return ThaumcraftApi.internalMethods.consumeVisFromInventory(player, cost);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This adds permanents or temporary warp to a player. It will automatically be synced clientside
|
||||
* @param player the player using the wand
|
||||
* @param amount how much warp to add. Negative amounts are only valid for temporary warp
|
||||
* @param temporary add temporary warp instead of permanent
|
||||
*/
|
||||
public static void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary) {
|
||||
ThaumcraftApi.internalMethods.addWarpToPlayer(player, amount, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* This "sticky" warp to a player. Sticky warp is permanent warp that can be removed.
|
||||
* It will automatically be synced clientside
|
||||
* @param player the player using the wand
|
||||
* @param amount how much warp to add. Can have negative amounts.
|
||||
*/
|
||||
public static void addStickyWarpToPlayer(EntityPlayer player, int amount) {
|
||||
ThaumcraftApi.internalMethods.addStickyWarpToPlayer(player, amount);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition rayTraceIgnoringSource(World world, Vec3 v1, Vec3 v2,
|
||||
boolean bool1, boolean bool2, boolean bool3)
|
||||
{
|
||||
if (!Double.isNaN(v1.xCoord) && !Double.isNaN(v1.yCoord) && !Double.isNaN(v1.zCoord))
|
||||
{
|
||||
if (!Double.isNaN(v2.xCoord) && !Double.isNaN(v2.yCoord) && !Double.isNaN(v2.zCoord))
|
||||
{
|
||||
int i = MathHelper.floor_double(v2.xCoord);
|
||||
int j = MathHelper.floor_double(v2.yCoord);
|
||||
int k = MathHelper.floor_double(v2.zCoord);
|
||||
int l = MathHelper.floor_double(v1.xCoord);
|
||||
int i1 = MathHelper.floor_double(v1.yCoord);
|
||||
int j1 = MathHelper.floor_double(v1.zCoord);
|
||||
Block block = world.getBlock(l, i1, j1);
|
||||
int k1 = world.getBlockMetadata(l, i1, j1);
|
||||
|
||||
MovingObjectPosition movingobjectposition2 = null;
|
||||
k1 = 200;
|
||||
|
||||
while (k1-- >= 0)
|
||||
{
|
||||
if (Double.isNaN(v1.xCoord) || Double.isNaN(v1.yCoord) || Double.isNaN(v1.zCoord))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (l == i && i1 == j && j1 == k)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean flag6 = true;
|
||||
boolean flag3 = true;
|
||||
boolean flag4 = true;
|
||||
double d0 = 999.0D;
|
||||
double d1 = 999.0D;
|
||||
double d2 = 999.0D;
|
||||
|
||||
if (i > l)
|
||||
{
|
||||
d0 = (double)l + 1.0D;
|
||||
}
|
||||
else if (i < l)
|
||||
{
|
||||
d0 = (double)l + 0.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag6 = false;
|
||||
}
|
||||
|
||||
if (j > i1)
|
||||
{
|
||||
d1 = (double)i1 + 1.0D;
|
||||
}
|
||||
else if (j < i1)
|
||||
{
|
||||
d1 = (double)i1 + 0.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag3 = false;
|
||||
}
|
||||
|
||||
if (k > j1)
|
||||
{
|
||||
d2 = (double)j1 + 1.0D;
|
||||
}
|
||||
else if (k < j1)
|
||||
{
|
||||
d2 = (double)j1 + 0.0D;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag4 = false;
|
||||
}
|
||||
|
||||
double d3 = 999.0D;
|
||||
double d4 = 999.0D;
|
||||
double d5 = 999.0D;
|
||||
double d6 = v2.xCoord - v1.xCoord;
|
||||
double d7 = v2.yCoord - v1.yCoord;
|
||||
double d8 = v2.zCoord - v1.zCoord;
|
||||
|
||||
if (flag6)
|
||||
{
|
||||
d3 = (d0 - v1.xCoord) / d6;
|
||||
}
|
||||
|
||||
if (flag3)
|
||||
{
|
||||
d4 = (d1 - v1.yCoord) / d7;
|
||||
}
|
||||
|
||||
if (flag4)
|
||||
{
|
||||
d5 = (d2 - v1.zCoord) / d8;
|
||||
}
|
||||
|
||||
boolean flag5 = false;
|
||||
byte b0;
|
||||
|
||||
if (d3 < d4 && d3 < d5)
|
||||
{
|
||||
if (i > l)
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
v1.xCoord = d0;
|
||||
v1.yCoord += d7 * d3;
|
||||
v1.zCoord += d8 * d3;
|
||||
}
|
||||
else if (d4 < d5)
|
||||
{
|
||||
if (j > i1)
|
||||
{
|
||||
b0 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
v1.xCoord += d6 * d4;
|
||||
v1.yCoord = d1;
|
||||
v1.zCoord += d8 * d4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (k > j1)
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
v1.xCoord += d6 * d5;
|
||||
v1.yCoord += d7 * d5;
|
||||
v1.zCoord = d2;
|
||||
}
|
||||
|
||||
Vec3 vec32 = Vec3.createVectorHelper(v1.xCoord, v1.yCoord, v1.zCoord);
|
||||
l = (int)(vec32.xCoord = (double)MathHelper.floor_double(v1.xCoord));
|
||||
|
||||
if (b0 == 5)
|
||||
{
|
||||
--l;
|
||||
++vec32.xCoord;
|
||||
}
|
||||
|
||||
i1 = (int)(vec32.yCoord = (double)MathHelper.floor_double(v1.yCoord));
|
||||
|
||||
if (b0 == 1)
|
||||
{
|
||||
--i1;
|
||||
++vec32.yCoord;
|
||||
}
|
||||
|
||||
j1 = (int)(vec32.zCoord = (double)MathHelper.floor_double(v1.zCoord));
|
||||
|
||||
if (b0 == 3)
|
||||
{
|
||||
--j1;
|
||||
++vec32.zCoord;
|
||||
}
|
||||
|
||||
Block block1 = world.getBlock(l, i1, j1);
|
||||
int l1 = world.getBlockMetadata(l, i1, j1);
|
||||
|
||||
if (!bool2 || block1.getCollisionBoundingBoxFromPool(world, l, i1, j1) != null)
|
||||
{
|
||||
if (block1.canCollideCheck(l1, bool1))
|
||||
{
|
||||
MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(world, l, i1, j1, v1, v2);
|
||||
|
||||
if (movingobjectposition1 != null)
|
||||
{
|
||||
return movingobjectposition1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
movingobjectposition2 = new MovingObjectPosition(l, i1, j1, b0, v1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bool3 ? movingobjectposition2 : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Custom tile entity class I use for most of my tile entities. Setup in such a way that only
|
||||
* the nbt data within readCustomNBT / writeCustomNBT will be sent to the client when the tile
|
||||
* updates. Apart from all the normal TE data that gets sent that is.
|
||||
*
|
||||
*/
|
||||
public class TileThaumcraft extends TileEntity {
|
||||
|
||||
//NBT stuff
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
readCustomNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.writeToNBT(nbttagcompound);
|
||||
writeCustomNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
//Client Packet stuff
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
this.readCustomNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class WorldCoordinates implements Comparable
|
||||
{
|
||||
public int x;
|
||||
|
||||
/** the y coordinate */
|
||||
public int y;
|
||||
|
||||
/** the z coordinate */
|
||||
public int z;
|
||||
|
||||
public int dim;
|
||||
|
||||
public WorldCoordinates() {}
|
||||
|
||||
public WorldCoordinates(int par1, int par2, int par3, int d)
|
||||
{
|
||||
this.x = par1;
|
||||
this.y = par2;
|
||||
this.z = par3;
|
||||
this.dim = d;
|
||||
}
|
||||
|
||||
public WorldCoordinates(TileEntity tile)
|
||||
{
|
||||
this.x = tile.xCoord;
|
||||
this.y = tile.yCoord;
|
||||
this.z = tile.zCoord;
|
||||
this.dim = tile.getWorldObj().provider.dimensionId;
|
||||
}
|
||||
|
||||
public WorldCoordinates(WorldCoordinates par1ChunkCoordinates)
|
||||
{
|
||||
this.x = par1ChunkCoordinates.x;
|
||||
this.y = par1ChunkCoordinates.y;
|
||||
this.z = par1ChunkCoordinates.z;
|
||||
this.dim = par1ChunkCoordinates.dim;
|
||||
}
|
||||
|
||||
public boolean equals(Object par1Obj)
|
||||
{
|
||||
if (!(par1Obj instanceof WorldCoordinates))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldCoordinates coordinates = (WorldCoordinates)par1Obj;
|
||||
return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z && this.dim == coordinates.dim ;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return this.x + this.y << 8 + this.z << 16 + this.dim << 24;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the coordinate with another coordinate
|
||||
*/
|
||||
public int compareWorldCoordinate(WorldCoordinates par1)
|
||||
{
|
||||
return this.dim == par1.dim ? (
|
||||
this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y) : -1;
|
||||
}
|
||||
|
||||
public void set(int par1, int par2, int par3, int d)
|
||||
{
|
||||
this.x = par1;
|
||||
this.y = par2;
|
||||
this.z = par3;
|
||||
this.dim = d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the squared distance between this coordinates and the coordinates given as argument.
|
||||
*/
|
||||
public float getDistanceSquared(int par1, int par2, int par3)
|
||||
{
|
||||
float f = (float)(this.x - par1);
|
||||
float f1 = (float)(this.y - par2);
|
||||
float f2 = (float)(this.z - par3);
|
||||
return f * f + f1 * f1 + f2 * f2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the squared distance between this coordinates and the ChunkCoordinates given as argument.
|
||||
*/
|
||||
public float getDistanceSquaredToWorldCoordinates(WorldCoordinates par1ChunkCoordinates)
|
||||
{
|
||||
return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z);
|
||||
}
|
||||
|
||||
public int compareTo(Object par1Obj)
|
||||
{
|
||||
return this.compareWorldCoordinate((WorldCoordinates)par1Obj);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
this.x = nbt.getInteger("w_x");
|
||||
this.y = nbt.getInteger("w_y");
|
||||
this.z = nbt.getInteger("w_z");
|
||||
this.dim = nbt.getInteger("w_d");
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("w_x",x);
|
||||
nbt.setInteger("w_y",y);
|
||||
nbt.setInteger("w_z",z);
|
||||
nbt.setInteger("w_d",dim);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
|
||||
public class AspectList implements Serializable {
|
||||
|
||||
public LinkedHashMap<Aspect,Integer> aspects = new LinkedHashMap<Aspect,Integer>();//aspects associated with this object
|
||||
|
||||
|
||||
/**
|
||||
* this creates a new aspect list with preloaded values based off the aspects of the given item.
|
||||
* @param the itemstack of the given item
|
||||
*/
|
||||
public AspectList(ItemStack stack) {
|
||||
try {
|
||||
AspectList temp = ThaumcraftApiHelper.getObjectAspects(stack);
|
||||
if (temp!=null)
|
||||
for (Aspect tag:temp.getAspects()) {
|
||||
add(tag,temp.getAmount(tag));
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
public AspectList() {
|
||||
}
|
||||
|
||||
public AspectList copy() {
|
||||
AspectList out = new AspectList();
|
||||
for (Aspect a:this.getAspects())
|
||||
out.add(a, this.getAmount(a));
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of different aspects in this collection
|
||||
*/
|
||||
public int size() {
|
||||
return aspects.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of total vis in this collection
|
||||
*/
|
||||
public int visSize() {
|
||||
int q = 0;
|
||||
|
||||
for (Aspect as:aspects.keySet()) {
|
||||
q+=this.getAmount(as);
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection
|
||||
*/
|
||||
public Aspect[] getAspects() {
|
||||
Aspect[] q = new Aspect[1];
|
||||
return aspects.keySet().toArray(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection
|
||||
*/
|
||||
public Aspect[] getPrimalAspects() {
|
||||
AspectList t = new AspectList();
|
||||
for (Aspect as:aspects.keySet()) {
|
||||
if (as.isPrimal()) {
|
||||
t.add(as,1);
|
||||
}
|
||||
}
|
||||
Aspect[] q = new Aspect[1];
|
||||
return t.aspects.keySet().toArray(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection sorted by name
|
||||
*/
|
||||
public Aspect[] getAspectsSorted() {
|
||||
try {
|
||||
Aspect[] out = aspects.keySet().toArray(new Aspect[]{});
|
||||
boolean change=false;
|
||||
do {
|
||||
change=false;
|
||||
for(int a=0;a<out.length-1;a++) {
|
||||
Aspect e1 = out[a];
|
||||
Aspect e2 = out[a+1];
|
||||
if (e1!=null && e2!=null && e1.getTag().compareTo(e2.getTag())>0) {
|
||||
out[a] = e2;
|
||||
out[a+1] = e1;
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (change==true);
|
||||
return out;
|
||||
} catch (Exception e) {
|
||||
return this.getAspects();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of all the aspects in this collection sorted by amount
|
||||
*/
|
||||
public Aspect[] getAspectsSortedAmount() {
|
||||
try {
|
||||
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
|
||||
boolean change=false;
|
||||
do {
|
||||
change=false;
|
||||
for(int a=0;a<out.length-1;a++) {
|
||||
int e1 = getAmount(out[a]);
|
||||
int e2 = getAmount(out[a+1]);
|
||||
if (e1>0 && e2>0 && e2>e1) {
|
||||
Aspect ea = out[a];
|
||||
Aspect eb = out[a+1];
|
||||
out[a] = eb;
|
||||
out[a+1] = ea;
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (change==true);
|
||||
return out;
|
||||
} catch (Exception e) {
|
||||
return this.getAspects();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the amount associated with the given aspect in this collection
|
||||
*/
|
||||
public int getAmount(Aspect key) {
|
||||
return aspects.get(key)==null?0:aspects.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean reduce(Aspect key, int amount) {
|
||||
if (getAmount(key)>=amount) {
|
||||
int am = getAmount(key)-amount;
|
||||
aspects.put(key, am);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the amount of an aspect in this collection by the given amount.
|
||||
* If reduced to 0 or less the aspect will be removed completely.
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList remove(Aspect key, int amount) {
|
||||
int am = getAmount(key)-amount;
|
||||
if (am<=0) aspects.remove(key); else
|
||||
this.aspects.put(key, am);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply removes the aspect from the list
|
||||
* @param key
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList remove(Aspect key) {
|
||||
aspects.remove(key);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds this aspect and amount to the collection.
|
||||
* If the aspect exists then its value will be increased by the given amount.
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList add(Aspect aspect, int amount) {
|
||||
if (this.aspects.containsKey(aspect)) {
|
||||
int oldamount = this.aspects.get(aspect);
|
||||
amount+=oldamount;
|
||||
}
|
||||
this.aspects.put( aspect, amount );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds this aspect and amount to the collection.
|
||||
* If the aspect exists then only the highest of the old or new amount will be used.
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public AspectList merge(Aspect aspect, int amount) {
|
||||
if (this.aspects.containsKey(aspect)) {
|
||||
int oldamount = this.aspects.get(aspect);
|
||||
if (amount<oldamount) amount=oldamount;
|
||||
|
||||
}
|
||||
this.aspects.put( aspect, amount );
|
||||
return this;
|
||||
}
|
||||
|
||||
public AspectList add(AspectList in) {
|
||||
for (Aspect a:in.getAspects())
|
||||
this.add(a, in.getAmount(a));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AspectList merge(AspectList in) {
|
||||
for (Aspect a:in.getAspects())
|
||||
this.merge(a, in.getAmount(a));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the list of aspects from nbt
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
aspects.clear();
|
||||
NBTTagList tlist = nbttagcompound.getTagList("Aspects",(byte)10);
|
||||
for (int j = 0; j < tlist.tagCount(); j++) {
|
||||
NBTTagCompound rs = (NBTTagCompound) tlist.getCompoundTagAt(j);
|
||||
if (rs.hasKey("key")) {
|
||||
add( Aspect.getAspect(rs.getString("key")),
|
||||
rs.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound, String label)
|
||||
{
|
||||
aspects.clear();
|
||||
NBTTagList tlist = nbttagcompound.getTagList(label,(byte)10);
|
||||
for (int j = 0; j < tlist.tagCount(); j++) {
|
||||
NBTTagCompound rs = (NBTTagCompound) tlist.getCompoundTagAt(j);
|
||||
if (rs.hasKey("key")) {
|
||||
add( Aspect.getAspect(rs.getString("key")),
|
||||
rs.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the list of aspects to nbt
|
||||
* @param nbttagcompound
|
||||
* @return
|
||||
*/
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
NBTTagList tlist = new NBTTagList();
|
||||
nbttagcompound.setTag("Aspects", tlist);
|
||||
for (Aspect aspect : getAspects())
|
||||
if (aspect != null) {
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("key", aspect.getTag());
|
||||
f.setInteger("amount", getAmount(aspect));
|
||||
tlist.appendTag(f);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound, String label)
|
||||
{
|
||||
NBTTagList tlist = new NBTTagList();
|
||||
nbttagcompound.setTag(label, tlist);
|
||||
for (Aspect aspect : getAspects())
|
||||
if (aspect != null) {
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("key", aspect.getTag());
|
||||
f.setInteger("amount", getAmount(aspect));
|
||||
tlist.appendTag(f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class AspectSourceHelper {
|
||||
|
||||
static Method drainEssentia;
|
||||
static Method findEssentia;
|
||||
/**
|
||||
* This method is what is used to drain essentia from jars and other sources for things like
|
||||
* infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
|
||||
* and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
|
||||
* Only 1 essentia is drained at a time
|
||||
* @param tile the tile entity that is draining the essentia
|
||||
* @param aspect the aspect that you are looking for
|
||||
* @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions.
|
||||
* @param range how many blocks you wish to search for essentia sources.
|
||||
* @return boolean returns true if essentia was found and removed from a source.
|
||||
*/
|
||||
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
|
||||
try {
|
||||
if(drainEssentia == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
|
||||
drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
|
||||
}
|
||||
return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns if there is any essentia of the passed type that can be drained. It in no way checks how
|
||||
* much there is, only if an essentia container nearby contains at least 1 point worth.
|
||||
* @param tile the tile entity that is checking the essentia
|
||||
* @param aspect the aspect that you are looking for
|
||||
* @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions.
|
||||
* @param range how many blocks you wish to search for essentia sources.
|
||||
* @return boolean returns true if essentia was found and removed from a source.
|
||||
*/
|
||||
public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
|
||||
try {
|
||||
if(findEssentia == null) {
|
||||
Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler");
|
||||
findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
|
||||
}
|
||||
return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range);
|
||||
} catch(Exception ex) {
|
||||
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Used by blocks like the crucible and alembic to hold their aspects.
|
||||
* Tiles extending this interface will have their aspects show up when viewed by goggles of revealing
|
||||
*
|
||||
*/
|
||||
public interface IAspectContainer {
|
||||
public AspectList getAspects();
|
||||
|
||||
|
||||
public void setAspects(AspectList aspects);
|
||||
|
||||
|
||||
/**
|
||||
* This method is used to determine of a specific aspect can be added to this container.
|
||||
* @param tag
|
||||
* @return true or false
|
||||
*/
|
||||
public boolean doesContainerAccept(Aspect tag);
|
||||
|
||||
/**
|
||||
* This method is used to add a certain amount of an aspect to the tile entity.
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return the amount of aspect left over that could not be added.
|
||||
*/
|
||||
public int addToContainer(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* Removes a certain amount of a specific aspect from the tile entity
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return true if that amount of aspect was available and was removed
|
||||
*/
|
||||
public boolean takeFromContainer(Aspect tag, int amount);
|
||||
|
||||
/**
|
||||
* removes a bunch of different aspects and amounts from the tile entity.
|
||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
||||
* @return true if all the aspects and their amounts were available and successfully removed
|
||||
*
|
||||
* Going away in the next major patch
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean takeFromContainer(AspectList ot);
|
||||
|
||||
/**
|
||||
* Checks if the tile entity contains the listed amount (or more) of the aspect
|
||||
* @param tag
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
public boolean doesContainerContainAmount(Aspect tag,int amount);
|
||||
|
||||
/**
|
||||
* Checks if the tile entity contains all the listed aspects and their amounts
|
||||
* @param ot the ObjectTags object that contains the aspects and their amounts.
|
||||
* @return
|
||||
*
|
||||
* Going away in the next major patch
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean doesContainerContain(AspectList ot);
|
||||
|
||||
/**
|
||||
* Returns how much of the aspect this tile entity contains
|
||||
* @param tag
|
||||
* @return the amount of that aspect found
|
||||
*/
|
||||
public int containerContains(Aspect tag);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
*
|
||||
* This interface is implemented by tile entites (or possibly anything else) like jars
|
||||
* so that they can act as an essentia source for blocks like the infusion altar.
|
||||
*
|
||||
*/
|
||||
public interface IAspectSource extends IAspectContainer {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Used by wispy essences and essentia phials to hold their aspects.
|
||||
* Useful for similar item containers that store their aspect information in nbt form so TC
|
||||
* automatically picks up the aspects they contain
|
||||
*
|
||||
*/
|
||||
public interface IEssentiaContainerItem {
|
||||
public AspectList getAspects(ItemStack itemstack);
|
||||
public void setAspects(ItemStack itemstack, AspectList aspects);
|
||||
}
|
||||
|
||||
//Example implementation
|
||||
/*
|
||||
@Override
|
||||
public AspectList getAspects(ItemStack itemstack) {
|
||||
if (itemstack.hasTagCompound()) {
|
||||
AspectList aspects = new AspectList();
|
||||
aspects.readFromNBT(itemstack.getTagCompound());
|
||||
return aspects.size()>0?aspects:null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(ItemStack itemstack, AspectList aspects) {
|
||||
if (!itemstack.hasTagCompound()) itemstack.setTagCompound(new NBTTagCompound());
|
||||
aspects.writeToNBT(itemstack.getTagCompound());
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,100 @@
|
||||
package thaumcraft.api.aspects;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
* This interface is used by tiles that use or transport vis.
|
||||
* Only tiles that implement this interface will be able to connect to vis conduits or other thaumic devices
|
||||
*/
|
||||
public interface IEssentiaTransport {
|
||||
/**
|
||||
* Is this tile able to connect to other vis users/sources on the specified side?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
public boolean isConnectable(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Is this side used to input essentia?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
boolean canInputFrom(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Is this side used to output essentia?
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
boolean canOutputTo(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Sets the amount of suction this block will apply
|
||||
* @param suction
|
||||
*/
|
||||
public void setSuction(Aspect aspect, int amount);
|
||||
|
||||
/**
|
||||
* Returns the type of suction this block is applying.
|
||||
* @param loc
|
||||
* the location from where the suction is being checked
|
||||
* @return
|
||||
* a return type of null indicates the suction is untyped and the first thing available will be drawn
|
||||
*/
|
||||
public Aspect getSuctionType(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* Returns the strength of suction this block is applying.
|
||||
* @param loc
|
||||
* the location from where the suction is being checked
|
||||
* @return
|
||||
*/
|
||||
public int getSuctionAmount(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* remove the specified amount of essentia from this transport tile
|
||||
* @return how much was actually taken
|
||||
*/
|
||||
public int takeEssentia(Aspect aspect, int amount, ForgeDirection face);
|
||||
|
||||
/**
|
||||
* add the specified amount of essentia to this transport tile
|
||||
* @return how much was actually added
|
||||
*/
|
||||
public int addEssentia(Aspect aspect, int amount, ForgeDirection face);
|
||||
|
||||
/**
|
||||
* What type of essentia this contains
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
public Aspect getEssentiaType(ForgeDirection face);
|
||||
|
||||
/**
|
||||
* How much essentia this block contains
|
||||
* @param face
|
||||
* @return
|
||||
*/
|
||||
public int getEssentiaAmount(ForgeDirection face);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Essentia will not be drawn from this container unless the suction exceeds this amount.
|
||||
* @return the amount
|
||||
*/
|
||||
public int getMinimumSuction();
|
||||
|
||||
/**
|
||||
* Return true if you want the conduit to extend a little further into the block.
|
||||
* Used by jars and alembics that have smaller than normal hitboxes
|
||||
* @return
|
||||
*/
|
||||
boolean renderExtendedTube();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class CrucibleRecipe {
|
||||
|
||||
private ItemStack recipeOutput;
|
||||
|
||||
public Object catalyst;
|
||||
public AspectList aspects;
|
||||
public String key;
|
||||
|
||||
public int hash;
|
||||
|
||||
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
|
||||
recipeOutput = result;
|
||||
this.aspects = tags;
|
||||
this.key = researchKey;
|
||||
this.catalyst = cat;
|
||||
if (cat instanceof String) {
|
||||
this.catalyst = OreDictionary.getOres((String) cat);
|
||||
}
|
||||
String hc = researchKey + result.toString();
|
||||
for (Aspect tag:tags.getAspects()) {
|
||||
hc += tag.getTag()+tags.getAmount(tag);
|
||||
}
|
||||
if (cat instanceof ItemStack) {
|
||||
hc += ((ItemStack)cat).toString();
|
||||
} else
|
||||
if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
||||
for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
|
||||
hc += is.toString();
|
||||
}
|
||||
}
|
||||
|
||||
hash = hc.hashCode();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean matches(AspectList itags, ItemStack cat) {
|
||||
if (catalyst instanceof ItemStack &&
|
||||
!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
|
||||
return false;
|
||||
} else
|
||||
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
||||
ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
|
||||
if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
|
||||
}
|
||||
if (itags==null) return false;
|
||||
for (Aspect tag:aspects.getAspects()) {
|
||||
if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean catalystMatches(ItemStack cat) {
|
||||
if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
|
||||
return true;
|
||||
} else
|
||||
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
|
||||
ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public AspectList removeMatching(AspectList itags) {
|
||||
AspectList temptags = new AspectList();
|
||||
temptags.aspects.putAll(itags.aspects);
|
||||
|
||||
for (Aspect tag:aspects.getAspects()) {
|
||||
temptags.remove(tag, aspects.getAmount(tag));
|
||||
}
|
||||
|
||||
itags = temptags;
|
||||
return itags;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput() {
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public interface IArcaneRecipe
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
* @param player
|
||||
*/
|
||||
boolean matches(IInventory var1, World world, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
ItemStack getCraftingResult(IInventory var1);
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
int getRecipeSize();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
AspectList getAspects();
|
||||
AspectList getAspects(IInventory var1);
|
||||
String getResearch();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class InfusionEnchantmentRecipe
|
||||
{
|
||||
|
||||
public AspectList aspects;
|
||||
public String research;
|
||||
public ItemStack[] components;
|
||||
public Enchantment enchantment;
|
||||
public int recipeXP;
|
||||
public int instability;
|
||||
|
||||
public InfusionEnchantmentRecipe(String research, Enchantment input, int inst,
|
||||
AspectList aspects2, ItemStack[] recipe) {
|
||||
this.research = research;
|
||||
this.enchantment = input;
|
||||
this.aspects = aspects2;
|
||||
this.components = recipe;
|
||||
this.instability = inst;
|
||||
this.recipeXP = Math.max(1, input.getMinEnchantability(1)/3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
* @param player
|
||||
*/
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!enchantment.canApply(central) || !central.getItem().isItemTool(central)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Map map1 = EnchantmentHelper.getEnchantments(central);
|
||||
Iterator iterator = map1.keySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
Enchantment ench = Enchantment.enchantmentsList[j1];
|
||||
if (j1 == enchantment.effectId &&
|
||||
EnchantmentHelper.getEnchantmentLevel(j1, central)>=ench.getMaxLevel())
|
||||
return false;
|
||||
if (enchantment.effectId != ench.effectId &&
|
||||
(!enchantment.canApplyTogether(ench) ||
|
||||
!ench.canApplyTogether(enchantment))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack i2 = null;
|
||||
|
||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
||||
for (ItemStack is:input) {
|
||||
ii.add(is.copy());
|
||||
}
|
||||
|
||||
for (ItemStack comp:components) {
|
||||
boolean b=false;
|
||||
for (int a=0;a<ii.size();a++) {
|
||||
i2 = ii.get(a).copy();
|
||||
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
if (areItemStacksEqual(i2, comp,true)) {
|
||||
ii.remove(a);
|
||||
b=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!b) return false;
|
||||
}
|
||||
// System.out.println(ii.size());
|
||||
return ii.size()==0?true:false;
|
||||
}
|
||||
|
||||
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
|
||||
{
|
||||
if (stack0==null && stack1!=null) return false;
|
||||
if (stack0!=null && stack1==null) return false;
|
||||
if (stack0==null && stack1==null) return true;
|
||||
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
|
||||
if (!t1) return false;
|
||||
if (fuzzy) {
|
||||
Integer od = OreDictionary.getOreID(stack0);
|
||||
if (od!=-1) {
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
|
||||
}
|
||||
|
||||
|
||||
public Enchantment getEnchantment() {
|
||||
return enchantment;
|
||||
|
||||
}
|
||||
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
|
||||
}
|
||||
|
||||
public String getResearch() {
|
||||
return research;
|
||||
|
||||
}
|
||||
|
||||
public int calcInstability(ItemStack recipeInput) {
|
||||
int i = 0;
|
||||
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
|
||||
Iterator iterator = map1.keySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
i += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput);
|
||||
}
|
||||
return (i/2) + instability;
|
||||
}
|
||||
|
||||
public int calcXP(ItemStack recipeInput) {
|
||||
return recipeXP * (1+EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput));
|
||||
}
|
||||
|
||||
public float getEssentiaMod(ItemStack recipeInput) {
|
||||
float mod = EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput);
|
||||
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
|
||||
Iterator iterator = map1.keySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
int j1 = ((Integer)iterator.next()).intValue();
|
||||
if (j1 != enchantment.effectId)
|
||||
mod += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput) * .1f;
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class InfusionRecipe
|
||||
{
|
||||
protected AspectList aspects;
|
||||
protected String research;
|
||||
private ItemStack[] components;
|
||||
private ItemStack recipeInput;
|
||||
protected Object recipeOutput;
|
||||
protected int instability;
|
||||
|
||||
public InfusionRecipe(String research, Object output, int inst,
|
||||
AspectList aspects2, ItemStack input, ItemStack[] recipe) {
|
||||
this.research = research;
|
||||
this.recipeOutput = output;
|
||||
this.recipeInput = input;
|
||||
this.aspects = aspects2;
|
||||
this.components = recipe;
|
||||
this.instability = inst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
* @param player
|
||||
*/
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
||||
if (getRecipeInput()==null) return false;
|
||||
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack i2 = central.copy();
|
||||
if (getRecipeInput().getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
|
||||
if (!areItemStacksEqual(i2, getRecipeInput(), true)) return false;
|
||||
|
||||
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
|
||||
for (ItemStack is:input) {
|
||||
ii.add(is.copy());
|
||||
}
|
||||
|
||||
for (ItemStack comp:getComponents()) {
|
||||
boolean b=false;
|
||||
for (int a=0;a<ii.size();a++) {
|
||||
i2 = ii.get(a).copy();
|
||||
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
|
||||
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
if (areItemStacksEqual(i2, comp,true)) {
|
||||
ii.remove(a);
|
||||
b=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!b) return false;
|
||||
}
|
||||
return ii.size()==0?true:false;
|
||||
}
|
||||
|
||||
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
|
||||
{
|
||||
if (stack0==null && stack1!=null) return false;
|
||||
if (stack0!=null && stack1==null) return false;
|
||||
if (stack0==null && stack1==null) return true;
|
||||
|
||||
//nbt
|
||||
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
|
||||
if (!t1) return false;
|
||||
|
||||
if (fuzzy) {
|
||||
Integer od = OreDictionary.getOreID(stack0);
|
||||
if (od!=-1) {
|
||||
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
|
||||
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//damage
|
||||
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
|
||||
stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;
|
||||
|
||||
return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
|
||||
}
|
||||
|
||||
public Object getRecipeOutput() {
|
||||
return getRecipeOutput(this.getRecipeInput());
|
||||
}
|
||||
|
||||
public AspectList getAspects() {
|
||||
return getAspects(this.getRecipeInput());
|
||||
}
|
||||
|
||||
public int getInstability() {
|
||||
return getInstability(this.getRecipeInput());
|
||||
}
|
||||
|
||||
public String getResearch() {
|
||||
return research;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeInput() {
|
||||
return recipeInput;
|
||||
}
|
||||
|
||||
public ItemStack[] getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
public Object getRecipeOutput(ItemStack input) {
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
public AspectList getAspects(ItemStack input) {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
public int getInstability(ItemStack input) {
|
||||
return instability;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapedArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
//Added in for future ease of change, but hard coded for now.
|
||||
private static final int MAX_CRAFT_GRID_WIDTH = 3;
|
||||
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
|
||||
|
||||
public ItemStack output = null;
|
||||
public Object[] input = null;
|
||||
public AspectList aspects = null;
|
||||
public String research;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
private boolean mirrored = true;
|
||||
|
||||
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
||||
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research, new ItemStack(result), aspects, recipe); }
|
||||
public ShapedArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
this.research = research;
|
||||
this.aspects = aspects;
|
||||
String shape = "";
|
||||
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean)recipe[idx];
|
||||
if (recipe[idx+1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[])recipe[idx+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[])recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String)recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character)recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
itemMap.put(chr, ((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
{
|
||||
itemMap.put(chr, OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
||||
|
||||
@Override
|
||||
public int getRecipeSize(){ return input.length; }
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput(){ return output; }
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory inv, World world, EntityPlayer player)
|
||||
{
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
||||
return false;
|
||||
}
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
|
||||
{
|
||||
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
|
||||
{
|
||||
if (checkMatch(inv, x, y, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mirrored && checkMatch(inv, x, y, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
|
||||
{
|
||||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
|
||||
{
|
||||
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
|
||||
{
|
||||
int subX = x - startX;
|
||||
int subY = y - startY;
|
||||
Object target = null;
|
||||
|
||||
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
|
||||
{
|
||||
if (mirror)
|
||||
{
|
||||
target = input[width - subX - 1 + subY * width];
|
||||
}
|
||||
else
|
||||
{
|
||||
target = input[subX + subY * width];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
|
||||
|
||||
if (target instanceof ItemStack)
|
||||
{
|
||||
if (!checkItemEquals((ItemStack)target, slot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target instanceof ArrayList)
|
||||
{
|
||||
boolean matched = false;
|
||||
|
||||
for (ItemStack item : (ArrayList<ItemStack>)target)
|
||||
{
|
||||
matched = matched || checkItemEquals(item, slot);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target == null && slot != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
||||
{
|
||||
if (input == null && target != null || input != null && target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.getItem() == input.getItem() &&
|
||||
(!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) &&
|
||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
public ShapedArcaneRecipe setMirrored(boolean mirror)
|
||||
{
|
||||
mirrored = mirror;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public Object[] getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects(IInventory inv) {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return research;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ShapelessArcaneRecipe implements IArcaneRecipe
|
||||
{
|
||||
private ItemStack output = null;
|
||||
private ArrayList input = new ArrayList();
|
||||
|
||||
public AspectList aspects = null;
|
||||
public String research;
|
||||
|
||||
public ShapelessArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
||||
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
|
||||
|
||||
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
this.research = research;
|
||||
this.aspects = aspects;
|
||||
for (Object in : recipe)
|
||||
{
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
input.add(((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
{
|
||||
input.add(new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
{
|
||||
input.add(new ItemStack((Block)in));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
{
|
||||
input.add(OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
{
|
||||
String ret = "Invalid shapeless ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize(){ return input.size(); }
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput(){ return output; }
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
|
||||
|
||||
@Override
|
||||
public boolean matches(IInventory var1, World world, EntityPlayer player)
|
||||
{
|
||||
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList required = new ArrayList(input);
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
ItemStack slot = var1.getStackInSlot(x);
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
Iterator req = required.iterator();
|
||||
|
||||
while (req.hasNext())
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
Object next = req.next();
|
||||
|
||||
if (next instanceof ItemStack)
|
||||
{
|
||||
match = checkItemEquals((ItemStack)next, slot);
|
||||
}
|
||||
else if (next instanceof ArrayList)
|
||||
{
|
||||
for (ItemStack item : (ArrayList<ItemStack>)next)
|
||||
{
|
||||
match = match || checkItemEquals(item, slot);
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
{
|
||||
inRecipe = true;
|
||||
required.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inRecipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return required.isEmpty();
|
||||
}
|
||||
|
||||
private boolean checkItemEquals(ItemStack target, ItemStack input)
|
||||
{
|
||||
if (input == null && target != null || input != null && target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.getItem() == input.getItem() &&
|
||||
(!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) &&
|
||||
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never
|
||||
* manipulate the values in this array as it will effect the recipe itself.
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects(IInventory inv) {
|
||||
return aspects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return research;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package thaumcraft.api.damagesource;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
|
||||
public class DamageSourceIndirectThaumcraftEntity extends EntityDamageSourceIndirect {
|
||||
|
||||
private boolean fireDamage;
|
||||
private float hungerDamage;
|
||||
private boolean isUnblockable;
|
||||
|
||||
|
||||
public DamageSourceIndirectThaumcraftEntity(String par1Str,
|
||||
Entity par2Entity, Entity par3Entity) {
|
||||
super(par1Str, par2Entity, par3Entity);
|
||||
}
|
||||
|
||||
|
||||
public DamageSource setFireDamage()
|
||||
{
|
||||
this.fireDamage = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DamageSource setDamageBypassesArmor()
|
||||
{
|
||||
this.isUnblockable = true;
|
||||
this.hungerDamage = 0.0F;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package thaumcraft.api.damagesource;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
|
||||
public class DamageSourceThaumcraft extends DamageSource
|
||||
{
|
||||
|
||||
public static DamageSource taint = new DamageSourceThaumcraft("taint").setDamageBypassesArmor().setMagicDamage();
|
||||
public static DamageSource tentacle = new DamageSourceThaumcraft("tentacle");
|
||||
public static DamageSource swarm = new DamageSourceThaumcraft("swarm");
|
||||
public static DamageSource dissolve = new DamageSourceThaumcraft("dissolve").setDamageBypassesArmor();
|
||||
|
||||
protected DamageSourceThaumcraft(String par1Str) {
|
||||
super(par1Str);
|
||||
}
|
||||
|
||||
/** This kind of damage can be blocked or not. */
|
||||
private boolean isUnblockable = false;
|
||||
private boolean isDamageAllowedInCreativeMode = false;
|
||||
private float hungerDamage = 0.3F;
|
||||
|
||||
/** This kind of damage is based on fire or not. */
|
||||
private boolean fireDamage;
|
||||
|
||||
/** This kind of damage is based on a projectile or not. */
|
||||
private boolean projectile;
|
||||
|
||||
/**
|
||||
* Whether this damage source will have its damage amount scaled based on the current difficulty.
|
||||
*/
|
||||
private boolean difficultyScaled;
|
||||
private boolean magicDamage = false;
|
||||
private boolean explosion = false;
|
||||
|
||||
public static DamageSource causeSwarmDamage(EntityLivingBase par0EntityLiving)
|
||||
{
|
||||
return new EntityDamageSource("swarm", par0EntityLiving);
|
||||
}
|
||||
|
||||
public static DamageSource causeTentacleDamage(EntityLivingBase par0EntityLiving)
|
||||
{
|
||||
return new EntityDamageSource("tentacle", par0EntityLiving);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package thaumcraft.api.entities;
|
||||
|
||||
public interface IEldritchMob {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package thaumcraft.api.entities;
|
||||
|
||||
public interface ITaintedMob {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package thaumcraft.api.internal;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class DummyInternalMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@Override
|
||||
public void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResearchComplete(String username, String researchkey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDiscoveredAspect(String username, Aspect aspect) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getDiscoveredAspects(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInRowAndColumn(Object instance, int row, int column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getObjectAspects(ItemStack is) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getBonusObjectTags(ItemStack is, AspectList ot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList generateTags(Item item, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean consumeVisFromWand(ItemStack wand, EntityPlayer player,
|
||||
AspectList cost, boolean doit, boolean crafting) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean consumeVisFromWandCrafting(ItemStack wand,
|
||||
EntityPlayer player, AspectList cost, boolean doit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean consumeVisFromInventory(EntityPlayer player, AspectList cost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWarpToPlayer(EntityPlayer player, int amount, boolean temporary) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStickyWarpToPlayer(EntityPlayer player, int amount) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package thaumcraft.api.internal;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public interface IInternalMethodHandler {
|
||||
|
||||
public void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color);
|
||||
public boolean isResearchComplete(String username, String researchkey);
|
||||
public ItemStack getStackInRowAndColumn(Object instance, int row, int column);
|
||||
public AspectList getObjectAspects(ItemStack is);
|
||||
public AspectList getBonusObjectTags(ItemStack is,AspectList ot);
|
||||
public AspectList generateTags(Item item, int meta);
|
||||
public boolean consumeVisFromWand(ItemStack wand, EntityPlayer player, AspectList cost, boolean doit, boolean crafting);
|
||||
public boolean consumeVisFromWandCrafting(ItemStack wand,EntityPlayer player, AspectList cost, boolean doit);
|
||||
public boolean consumeVisFromInventory(EntityPlayer player, AspectList cost);
|
||||
public void addWarpToPlayer(EntityPlayer player, int amount,boolean temporary);
|
||||
public void addStickyWarpToPlayer(EntityPlayer player, int amount);
|
||||
public boolean hasDiscoveredAspect(String username, Aspect aspect);
|
||||
public AspectList getDiscoveredAspects(String username);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package thaumcraft.api.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
|
||||
public class WeightedRandomLoot extends WeightedRandom.Item {
|
||||
|
||||
/** The Item/Block ID to generate in the bag. */
|
||||
public ItemStack item;
|
||||
|
||||
public WeightedRandomLoot(ItemStack stack, int weight)
|
||||
{
|
||||
super(weight);
|
||||
this.item = stack;
|
||||
}
|
||||
|
||||
public static ArrayList<WeightedRandomLoot> lootBagCommon = new ArrayList<WeightedRandomLoot>();
|
||||
public static ArrayList<WeightedRandomLoot> lootBagUncommon = new ArrayList<WeightedRandomLoot>();
|
||||
public static ArrayList<WeightedRandomLoot> lootBagRare = new ArrayList<WeightedRandomLoot>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package thaumcraft.api.nodes;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
|
||||
public interface INode extends IAspectContainer {
|
||||
|
||||
/**
|
||||
* Unique identifier to distinguish nodes. Normal node id's are based on world id and coordinates
|
||||
* @return
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
public AspectList getAspectsBase();
|
||||
|
||||
/**
|
||||
* Return the type of node
|
||||
* @return
|
||||
*/
|
||||
public NodeType getNodeType();
|
||||
|
||||
/**
|
||||
* Set the type of node
|
||||
* @return
|
||||
*/
|
||||
public void setNodeType(NodeType nodeType);
|
||||
|
||||
/**
|
||||
* Set the node modifier
|
||||
* @return
|
||||
*/
|
||||
public void setNodeModifier(NodeModifier nodeModifier);
|
||||
|
||||
/**
|
||||
* Return the node modifier
|
||||
* @return
|
||||
*/
|
||||
public NodeModifier getNodeModifier();
|
||||
|
||||
/**
|
||||
* Return the maximum capacity of each aspect the node can hold
|
||||
* @return
|
||||
*/
|
||||
public int getNodeVisBase(Aspect aspect);
|
||||
|
||||
/**
|
||||
* Set the maximum capacity of each aspect the node can hold
|
||||
* @return
|
||||
*/
|
||||
public void setNodeVisBase(Aspect aspect, short nodeVisBase);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package thaumcraft.api.nodes;
|
||||
|
||||
public enum NodeModifier
|
||||
{
|
||||
BRIGHT, PALE, FADING
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package thaumcraft.api.nodes;
|
||||
|
||||
public enum NodeType
|
||||
{
|
||||
NORMAL, UNSTABLE, DARK, TAINTED, HUNGRY, PURE
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package thaumcraft.api.potions;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.api.damagesource.DamageSourceThaumcraft;
|
||||
import thaumcraft.api.entities.ITaintedMob;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionFluxTaint extends Potion
|
||||
{
|
||||
public static PotionFluxTaint instance = null; // will be instantiated at runtime
|
||||
private int statusIconIndex = -1;
|
||||
|
||||
public PotionFluxTaint(int par1, boolean par2, int par3)
|
||||
{
|
||||
super(par1,par2,par3);
|
||||
setIconIndex(0, 0);
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
instance.setPotionName("potion.fluxtaint");
|
||||
instance.setIconIndex(3, 1);
|
||||
instance.setEffectiveness(0.25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBadEffect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(rl);
|
||||
return super.getStatusIconIndex();
|
||||
}
|
||||
|
||||
static final ResourceLocation rl = new ResourceLocation("thaumcraft","textures/misc/potions.png");
|
||||
|
||||
@Override
|
||||
public void performEffect(EntityLivingBase target, int par2) {
|
||||
if (target instanceof ITaintedMob) {
|
||||
target.heal(1);
|
||||
} else
|
||||
if (!target.isEntityUndead() && !(target instanceof EntityPlayer))
|
||||
{
|
||||
target.attackEntityFrom(DamageSourceThaumcraft.taint, 1);
|
||||
}
|
||||
else
|
||||
if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer)))
|
||||
{
|
||||
target.attackEntityFrom(DamageSourceThaumcraft.taint, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReady(int par1, int par2)
|
||||
{
|
||||
int k = 40 >> par2;
|
||||
return k > 0 ? par1 % k == 0 : true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package thaumcraft.api.potions;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionVisExhaust extends Potion
|
||||
{
|
||||
public static PotionVisExhaust instance = null; // will be instantiated at runtime
|
||||
private int statusIconIndex = -1;
|
||||
|
||||
public PotionVisExhaust(int par1, boolean par2, int par3)
|
||||
{
|
||||
super(par1,par2,par3);
|
||||
setIconIndex(0, 0);
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
instance.setPotionName("potion.visexhaust");
|
||||
instance.setIconIndex(5, 1);
|
||||
instance.setEffectiveness(0.25D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBadEffect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(rl);
|
||||
return super.getStatusIconIndex();
|
||||
}
|
||||
|
||||
static final ResourceLocation rl = new ResourceLocation("thaumcraft","textures/misc/potions.png");
|
||||
|
||||
@Override
|
||||
public void performEffect(EntityLivingBase target, int par2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IScanEventHandler {
|
||||
ScanResult scanPhenomena(ItemStack stack, World world, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class ResearchCategories {
|
||||
|
||||
//Research
|
||||
public static LinkedHashMap <String, ResearchCategoryList> researchCategories = new LinkedHashMap <String,ResearchCategoryList>();
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the research item linked to this key
|
||||
*/
|
||||
public static ResearchCategoryList getResearchList(String key) {
|
||||
return researchCategories.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return the name of the research category linked to this key.
|
||||
* Must be stored as localization information in the LanguageRegistry.
|
||||
*/
|
||||
public static String getCategoryName(String key) {
|
||||
return StatCollector.translateToLocal("tc.research_category."+key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key the research key
|
||||
* @return the ResearchItem object.
|
||||
*/
|
||||
public static ResearchItem getResearch(String key) {
|
||||
Collection rc = researchCategories.values();
|
||||
for (Object cat:rc) {
|
||||
Collection rl = ((ResearchCategoryList)cat).research.values();
|
||||
for (Object ri:rl) {
|
||||
if ((((ResearchItem)ri).key).equals(key)) return (ResearchItem)ri;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be done at the PostInit stage
|
||||
* @param key the key used for this category
|
||||
* @param icon the icon to be used for the research category tab
|
||||
* @param background the resource location of the background image to use for this category
|
||||
* @return the name of the research linked to this key
|
||||
*/
|
||||
public static void registerCategory(String key, ResourceLocation icon, ResourceLocation background) {
|
||||
if (getResearchList(key)==null) {
|
||||
ResearchCategoryList rl = new ResearchCategoryList(icon, background);
|
||||
researchCategories.put(key, rl);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addResearch(ResearchItem ri) {
|
||||
ResearchCategoryList rl = getResearchList(ri.category);
|
||||
if (rl!=null && !rl.research.containsKey(ri.key)) {
|
||||
|
||||
if (!ri.isVirtual()) {
|
||||
for (ResearchItem rr:rl.research.values()) {
|
||||
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
|
||||
FMLLog.log(Level.FATAL, "[Thaumcraft] Research ["+ri.getName()+"] not added as it overlaps with existing research ["+rr.getName()+"]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rl.research.put(ri.key, ri);
|
||||
|
||||
if (ri.displayColumn < rl.minDisplayColumn)
|
||||
{
|
||||
rl.minDisplayColumn = ri.displayColumn;
|
||||
}
|
||||
|
||||
if (ri.displayRow < rl.minDisplayRow)
|
||||
{
|
||||
rl.minDisplayRow = ri.displayRow;
|
||||
}
|
||||
|
||||
if (ri.displayColumn > rl.maxDisplayColumn)
|
||||
{
|
||||
rl.maxDisplayColumn = ri.displayColumn;
|
||||
}
|
||||
|
||||
if (ri.displayRow > rl.maxDisplayRow)
|
||||
{
|
||||
rl.maxDisplayRow = ri.displayRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ResearchCategoryList {
|
||||
|
||||
/** Is the smallest column used on the GUI. */
|
||||
public int minDisplayColumn;
|
||||
|
||||
/** Is the smallest row used on the GUI. */
|
||||
public int minDisplayRow;
|
||||
|
||||
/** Is the biggest column used on the GUI. */
|
||||
public int maxDisplayColumn;
|
||||
|
||||
/** Is the biggest row used on the GUI. */
|
||||
public int maxDisplayRow;
|
||||
|
||||
/** display variables **/
|
||||
public ResourceLocation icon;
|
||||
public ResourceLocation background;
|
||||
|
||||
public ResearchCategoryList(ResourceLocation icon, ResourceLocation background) {
|
||||
this.icon = icon;
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
//Research
|
||||
public Map<String, ResearchItem> research = new HashMap<String,ResearchItem>();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class ResearchItem
|
||||
{
|
||||
/**
|
||||
* A short string used as a key for this research. Must be unique
|
||||
*/
|
||||
public final String key;
|
||||
|
||||
/**
|
||||
* A short string used as a reference to the research category to which this must be added.
|
||||
*/
|
||||
public final String category;
|
||||
|
||||
/**
|
||||
* The aspect tags and their values required to complete this research
|
||||
*/
|
||||
public final AspectList tags;
|
||||
|
||||
/**
|
||||
* This links to any research that needs to be completed before this research can be discovered or learnt.
|
||||
*/
|
||||
public String[] parents = null;
|
||||
|
||||
/**
|
||||
* Like parent above, but a line will not be displayed in the thaumonomicon linking them. Just used to prevent clutter.
|
||||
*/
|
||||
public String[] parentsHidden = null;
|
||||
/**
|
||||
* any research linked to this that will be unlocked automatically when this research is complete
|
||||
*/
|
||||
public String[] siblings = null;
|
||||
|
||||
/**
|
||||
* the horizontal position of the research icon
|
||||
*/
|
||||
public final int displayColumn;
|
||||
|
||||
/**
|
||||
* the vertical position of the research icon
|
||||
*/
|
||||
public final int displayRow;
|
||||
|
||||
/**
|
||||
* the icon to be used for this research
|
||||
*/
|
||||
public final ItemStack icon_item;
|
||||
|
||||
/**
|
||||
* the icon to be used for this research
|
||||
*/
|
||||
public final ResourceLocation icon_resource;
|
||||
|
||||
/**
|
||||
* How large the research grid is. Valid values are 1 to 3.
|
||||
*/
|
||||
private int complexity;
|
||||
|
||||
/**
|
||||
* Special research has a spiky border. Used for important research milestones.
|
||||
*/
|
||||
private boolean isSpecial;
|
||||
|
||||
/**
|
||||
* Research that can be directly purchased with RP in normal research difficulty.
|
||||
*/
|
||||
private boolean isSecondary;
|
||||
|
||||
/**
|
||||
* This indicates if the research should use a circular icon border. Usually used for "passive" research
|
||||
* that doesn't have recipes and grants passive effects, or that unlock automatically.
|
||||
*/
|
||||
private boolean isRound;
|
||||
|
||||
/**
|
||||
* Stub research cannot be discovered by normal means, but can be unlocked via the sibling system.
|
||||
*/
|
||||
private boolean isStub;
|
||||
|
||||
/**
|
||||
* This indicated that the research is completely hidden and cannot be discovered by any
|
||||
* player-controlled means. The recipes will never show up in the thaumonomicon.
|
||||
* Usually used to unlock "hidden" recipes via sibling unlocking, like
|
||||
* the various cap and rod combos for wands.
|
||||
*/
|
||||
private boolean isVirtual;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Concealed research does not display in the thaumonomicon until parent researches are discovered.
|
||||
*/
|
||||
private boolean isConcealed;
|
||||
|
||||
/**
|
||||
* Hidden research can only be discovered via scanning or knowledge fragments
|
||||
*/
|
||||
private boolean isHidden;
|
||||
|
||||
/**
|
||||
* This is the same as isHidden, except it cannot be discovered with knowledge fragments, only scanning.
|
||||
*/
|
||||
private boolean isLost;
|
||||
|
||||
/**
|
||||
* These research items will automatically unlock for all players on game start
|
||||
*/
|
||||
private boolean isAutoUnlock;
|
||||
|
||||
/**
|
||||
* Scanning these items will have a chance of revealing hidden knowledge in the thaumonomicon
|
||||
*/
|
||||
private ItemStack[] itemTriggers;
|
||||
|
||||
/**
|
||||
* Scanning these entities will have a chance of revealing hidden knowledge in the thaumonomicon
|
||||
*/
|
||||
private String[] entityTriggers;
|
||||
|
||||
/**
|
||||
* Scanning things with these aspects will have a chance of revealing hidden knowledge in the thaumonomicon
|
||||
*/
|
||||
private Aspect[] aspectTriggers;
|
||||
|
||||
private ResearchPage[] pages = null;
|
||||
|
||||
public ResearchItem(String key, String category)
|
||||
{
|
||||
this.key = key;
|
||||
this.category = category;
|
||||
this.tags = new AspectList();
|
||||
this.icon_resource = null;
|
||||
this.icon_item = null;
|
||||
this.displayColumn = 0;
|
||||
this.displayRow = 0;
|
||||
this.setVirtual();
|
||||
|
||||
}
|
||||
|
||||
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon)
|
||||
{
|
||||
this.key = key;
|
||||
this.category = category;
|
||||
this.tags = tags;
|
||||
this.icon_resource = icon;
|
||||
this.icon_item = null;
|
||||
this.displayColumn = col;
|
||||
this.displayRow = row;
|
||||
this.complexity = complex;
|
||||
if (complexity < 1) this.complexity = 1;
|
||||
if (complexity > 3) this.complexity = 3;
|
||||
}
|
||||
|
||||
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon)
|
||||
{
|
||||
this.key = key;
|
||||
this.category = category;
|
||||
this.tags = tags;
|
||||
this.icon_item = icon;
|
||||
this.icon_resource = null;
|
||||
this.displayColumn = col;
|
||||
this.displayRow = row;
|
||||
this.complexity = complex;
|
||||
if (complexity < 1) this.complexity = 1;
|
||||
if (complexity > 3) this.complexity = 3;
|
||||
}
|
||||
|
||||
public ResearchItem setSpecial()
|
||||
{
|
||||
this.isSpecial = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setStub()
|
||||
{
|
||||
this.isStub = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setLost()
|
||||
{
|
||||
this.isLost = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setConcealed()
|
||||
{
|
||||
this.isConcealed = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setHidden()
|
||||
{
|
||||
this.isHidden = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setVirtual()
|
||||
{
|
||||
this.isVirtual = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setParents(String... par)
|
||||
{
|
||||
this.parents = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ResearchItem setParentsHidden(String... par)
|
||||
{
|
||||
this.parentsHidden = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setSiblings(String... sib)
|
||||
{
|
||||
this.siblings = sib;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setPages(ResearchPage... par)
|
||||
{
|
||||
this.pages = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchPage[] getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public ResearchItem setItemTriggers(ItemStack... par)
|
||||
{
|
||||
this.itemTriggers = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setEntityTriggers(String... par)
|
||||
{
|
||||
this.entityTriggers = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResearchItem setAspectTriggers(Aspect... par)
|
||||
{
|
||||
this.aspectTriggers = par;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack[] getItemTriggers() {
|
||||
return itemTriggers;
|
||||
}
|
||||
|
||||
public String[] getEntityTriggers() {
|
||||
return entityTriggers;
|
||||
}
|
||||
|
||||
public Aspect[] getAspectTriggers() {
|
||||
return aspectTriggers;
|
||||
}
|
||||
|
||||
public ResearchItem registerResearchItem()
|
||||
{
|
||||
ResearchCategories.addResearch(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return StatCollector.translateToLocal("tc.research_name."+key);
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return StatCollector.translateToLocal("tc.research_text."+key);
|
||||
}
|
||||
|
||||
public boolean isSpecial()
|
||||
{
|
||||
return this.isSpecial;
|
||||
}
|
||||
|
||||
public boolean isStub()
|
||||
{
|
||||
return this.isStub;
|
||||
}
|
||||
|
||||
public boolean isLost()
|
||||
{
|
||||
return this.isLost;
|
||||
}
|
||||
|
||||
public boolean isConcealed()
|
||||
{
|
||||
return this.isConcealed;
|
||||
}
|
||||
|
||||
public boolean isHidden()
|
||||
{
|
||||
return this.isHidden;
|
||||
}
|
||||
|
||||
public boolean isVirtual()
|
||||
{
|
||||
return this.isVirtual;
|
||||
}
|
||||
|
||||
public boolean isAutoUnlock() {
|
||||
return isAutoUnlock;
|
||||
}
|
||||
|
||||
public ResearchItem setAutoUnlock()
|
||||
{
|
||||
this.isAutoUnlock = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRound() {
|
||||
return isRound;
|
||||
}
|
||||
|
||||
public ResearchItem setRound() {
|
||||
this.isRound = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSecondary() {
|
||||
return isSecondary;
|
||||
}
|
||||
|
||||
public ResearchItem setSecondary() {
|
||||
this.isSecondary = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getComplexity() {
|
||||
return complexity;
|
||||
}
|
||||
|
||||
public ResearchItem setComplexity(int complexity) {
|
||||
this.complexity = complexity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
|
||||
*/
|
||||
public Aspect getResearchPrimaryTag() {
|
||||
Aspect aspect=null;
|
||||
int highest=0;
|
||||
if (tags!=null)
|
||||
for (Aspect tag:tags.getAspects()) {
|
||||
if (tags.getAmount(tag)>highest) {
|
||||
aspect=tag;
|
||||
highest=tags.getAmount(tag);
|
||||
};
|
||||
}
|
||||
return aspect;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
|
||||
public class ResearchPage {
|
||||
public static enum PageType
|
||||
{
|
||||
TEXT,
|
||||
TEXT_CONCEALED,
|
||||
IMAGE,
|
||||
CRUCIBLE_CRAFTING,
|
||||
ARCANE_CRAFTING,
|
||||
ASPECTS,
|
||||
NORMAL_CRAFTING,
|
||||
INFUSION_CRAFTING,
|
||||
COMPOUND_CRAFTING,
|
||||
INFUSION_ENCHANTMENT,
|
||||
SMELTING
|
||||
}
|
||||
|
||||
public PageType type = PageType.TEXT;
|
||||
|
||||
public String text=null;
|
||||
public String research=null;
|
||||
public ResourceLocation image=null;
|
||||
public AspectList aspects=null;
|
||||
public Object recipe=null;
|
||||
public ItemStack recipeOutput=null;
|
||||
|
||||
/**
|
||||
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
|
||||
*/
|
||||
public ResearchPage(String text) {
|
||||
this.type = PageType.TEXT;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param research this page will only be displayed if the player has discovered this research
|
||||
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
|
||||
*/
|
||||
public ResearchPage(String research, String text) {
|
||||
this.type = PageType.TEXT_CONCEALED;
|
||||
this.research = research;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a vanilla crafting recipe.
|
||||
*/
|
||||
public ResearchPage(IRecipe recipe) {
|
||||
this.type = PageType.NORMAL_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a collection of vanilla crafting recipes.
|
||||
*/
|
||||
public ResearchPage(IRecipe[] recipe) {
|
||||
this.type = PageType.NORMAL_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a collection of arcane crafting recipes.
|
||||
*/
|
||||
public ResearchPage(IArcaneRecipe[] recipe) {
|
||||
this.type = PageType.ARCANE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a collection of arcane crafting recipes.
|
||||
*/
|
||||
public ResearchPage(CrucibleRecipe[] recipe) {
|
||||
this.type = PageType.CRUCIBLE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a collection of infusion crafting recipes.
|
||||
*/
|
||||
public ResearchPage(InfusionRecipe[] recipe) {
|
||||
this.type = PageType.INFUSION_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a compound crafting recipe.
|
||||
*/
|
||||
public ResearchPage(List recipe) {
|
||||
this.type = PageType.COMPOUND_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an arcane worktable crafting recipe.
|
||||
*/
|
||||
public ResearchPage(IArcaneRecipe recipe) {
|
||||
this.type = PageType.ARCANE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an alchemy crafting recipe.
|
||||
*/
|
||||
public ResearchPage(CrucibleRecipe recipe) {
|
||||
this.type = PageType.CRUCIBLE_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
this.recipeOutput = recipe.getRecipeOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe a furnace smelting crafting recipe.
|
||||
*/
|
||||
public ResearchPage(ItemStack input) {
|
||||
this.type = PageType.SMELTING;
|
||||
this.recipe = input;
|
||||
this.recipeOutput = FurnaceRecipes.smelting().getSmeltingResult(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an infusion crafting recipe.
|
||||
*/
|
||||
public ResearchPage(InfusionRecipe recipe) {
|
||||
this.type = PageType.INFUSION_CRAFTING;
|
||||
this.recipe = recipe;
|
||||
if (recipe.getRecipeOutput() instanceof ItemStack) {
|
||||
this.recipeOutput = (ItemStack) recipe.getRecipeOutput();
|
||||
} else {
|
||||
this.recipeOutput = recipe.getRecipeInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recipe an infusion crafting recipe.
|
||||
*/
|
||||
public ResearchPage(InfusionEnchantmentRecipe recipe) {
|
||||
this.type = PageType.INFUSION_ENCHANTMENT;
|
||||
this.recipe = recipe;
|
||||
// if (recipe.recipeOutput instanceof ItemStack) {
|
||||
// this.recipeOutput = (ItemStack) recipe.recipeOutput;
|
||||
// } else {
|
||||
// this.recipeOutput = recipe.recipeInput;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* @param image
|
||||
* @param caption this can (but does not have to) be a reference to a localization variable, not the actual text.
|
||||
*/
|
||||
public ResearchPage(ResourceLocation image, String caption) {
|
||||
this.type = PageType.IMAGE;
|
||||
this.image = image;
|
||||
this.text = caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should really not be called directly - used internally
|
||||
*/
|
||||
public ResearchPage(AspectList as) {
|
||||
this.type = PageType.ASPECTS;
|
||||
this.aspects = as;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a localized text of the text field (if one exists). Returns the text field itself otherwise.
|
||||
* @return
|
||||
*/
|
||||
public String getTranslatedText() {
|
||||
String ret="";
|
||||
if (text != null) {
|
||||
ret = StatCollector.translateToLocal(text);
|
||||
if (ret.isEmpty()) ret = text;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package thaumcraft.api.research;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ScanResult {
|
||||
public byte type = 0; //1=blocks,2=entities,3=phenomena
|
||||
public int id;
|
||||
public int meta;
|
||||
public Entity entity;
|
||||
public String phenomena;
|
||||
|
||||
public ScanResult(byte type, int blockId, int blockMeta, Entity entity,
|
||||
String phenomena) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.id = blockId;
|
||||
this.meta = blockMeta;
|
||||
this.entity = entity;
|
||||
this.phenomena = phenomena;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ScanResult) {
|
||||
ScanResult sr = (ScanResult) obj;
|
||||
if (type != sr.type)
|
||||
return false;
|
||||
if (type == 1
|
||||
&& (id != sr.id || meta != sr.meta))
|
||||
return false;
|
||||
if (type == 2 && entity.getEntityId() != sr.entity.getEntityId())
|
||||
return false;
|
||||
if (type == 3 && !phenomena.equals(sr.phenomena))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package thaumcraft.api.visnet;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import thaumcraft.api.TileThaumcraft;
|
||||
import thaumcraft.api.WorldCoordinates;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
*
|
||||
* The tile entity used by nodes in the vis energy network. A node is either a source (like an aura node),
|
||||
* a transport relay or vis receiver (like the infernal furnace).
|
||||
*
|
||||
*/
|
||||
public abstract class TileVisNode extends TileThaumcraft {
|
||||
|
||||
WeakReference<TileVisNode> parent = null;
|
||||
ArrayList<WeakReference<TileVisNode>> children = new ArrayList<WeakReference<TileVisNode>>();
|
||||
|
||||
/**
|
||||
* @return the WorldCoordinates location of where this node is located
|
||||
*/
|
||||
public WorldCoordinates getLocation() {
|
||||
return new WorldCoordinates(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of blocks away this node will check for parent nodes to connect to.
|
||||
*/
|
||||
public abstract int getRange();
|
||||
|
||||
/**
|
||||
* @return true if this is the source or root node of the vis network.
|
||||
*/
|
||||
public abstract boolean isSource();
|
||||
|
||||
/**
|
||||
* This method should never be called directly. Use VisNetHandler.drainVis() instead
|
||||
* @param aspect what aspect to drain
|
||||
* @param vis how much to drain
|
||||
* @return how much was actually drained
|
||||
*/
|
||||
public int consumeVis(Aspect aspect, int vis) {
|
||||
if (VisNetHandler.isNodeValid(getParent())) {
|
||||
int out = getParent().get().consumeVis(aspect, vis);
|
||||
if (out>0) {
|
||||
triggerConsumeEffect(aspect);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void removeThisNode() {
|
||||
for (WeakReference<TileVisNode> n:getChildren()) {
|
||||
if (n!=null && n.get()!=null) {
|
||||
n.get().removeThisNode();
|
||||
}
|
||||
}
|
||||
|
||||
children = new ArrayList<WeakReference<TileVisNode>>();
|
||||
if (VisNetHandler.isNodeValid(this.getParent())) {
|
||||
this.getParent().get().nodeRefresh=true;
|
||||
}
|
||||
this.setParent(null);
|
||||
this.parentChanged();
|
||||
|
||||
if (this.isSource()) {
|
||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = VisNetHandler.sources.get(worldObj.provider.dimensionId);
|
||||
if (sourcelist==null) {
|
||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
||||
}
|
||||
sourcelist.remove(getLocation());
|
||||
VisNetHandler.sources.put( worldObj.provider.dimensionId, sourcelist );
|
||||
}
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
removeThisNode();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
public void triggerConsumeEffect(Aspect aspect) { }
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public WeakReference<TileVisNode> getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public WeakReference<TileVisNode> getRootSource() {
|
||||
return VisNetHandler.isNodeValid(getParent()) ?
|
||||
getParent().get().getRootSource() : this.isSource() ?
|
||||
new WeakReference(this) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
*/
|
||||
public void setParent(WeakReference<TileVisNode> parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<WeakReference<TileVisNode>> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int nodeCounter = 0;
|
||||
private boolean nodeRegged = false;
|
||||
public boolean nodeRefresh = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if (!worldObj.isRemote && ((nodeCounter++) % 40==0 || nodeRefresh)) {
|
||||
//check for changes
|
||||
if (!nodeRefresh && children.size()>0) {
|
||||
for (WeakReference<TileVisNode> n:children) {
|
||||
if (n==null || n.get()==null || !VisNetHandler.canNodeBeSeen(this, n.get())) {
|
||||
nodeRefresh=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//refresh linked nodes
|
||||
if (nodeRefresh) {
|
||||
for (WeakReference<TileVisNode> n:children) {
|
||||
if (n.get()!=null) {
|
||||
n.get().nodeRefresh=true;
|
||||
}
|
||||
}
|
||||
children.clear();
|
||||
parent=null;
|
||||
}
|
||||
|
||||
//redo stuff
|
||||
if (isSource() && !nodeRegged) {
|
||||
VisNetHandler.addSource(getWorldObj(), this);
|
||||
nodeRegged = true;
|
||||
} else
|
||||
if (!isSource() && !VisNetHandler.isNodeValid(getParent())) {
|
||||
setParent(VisNetHandler.addNode(getWorldObj(), this));
|
||||
nodeRefresh=true;
|
||||
}
|
||||
|
||||
if (nodeRefresh) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
parentChanged();
|
||||
}
|
||||
nodeRefresh=false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void parentChanged() { }
|
||||
|
||||
/**
|
||||
* @return the type of shard this is attuned to:
|
||||
* none -1, air 0, fire 1, water 2, earth 3, order 4, entropy 5
|
||||
* Should return -1 for most implementations
|
||||
*/
|
||||
public byte getAttunement() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
package thaumcraft.api.visnet;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.WorldCoordinates;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class VisNetHandler {
|
||||
|
||||
// NODE DRAINING
|
||||
/**
|
||||
* This method drains vis from a relay or source near the passed in
|
||||
* location. The amount received can be less than the amount requested so
|
||||
* take that into account.
|
||||
*
|
||||
* @param world
|
||||
* @param x the x position of the draining block or entity
|
||||
* @param y the y position of the draining block or entity
|
||||
* @param z the z position of the draining block or entity
|
||||
* @param aspect what aspect to drain
|
||||
* @param amount how much to drain
|
||||
* @return how much was actually drained
|
||||
*/
|
||||
public static int drainVis(World world, int x, int y, int z, Aspect aspect, int amount) {
|
||||
|
||||
int drainedAmount = 0;
|
||||
|
||||
WorldCoordinates drainer = new WorldCoordinates(x, y, z,
|
||||
world.provider.dimensionId);
|
||||
if (!nearbyNodes.containsKey(drainer)) {
|
||||
calculateNearbyNodes(world, x, y, z);
|
||||
}
|
||||
|
||||
ArrayList<WeakReference<TileVisNode>> nodes = nearbyNodes.get(drainer);
|
||||
if (nodes!=null && nodes.size()>0)
|
||||
for (WeakReference<TileVisNode> noderef : nodes) {
|
||||
|
||||
TileVisNode node = noderef.get();
|
||||
|
||||
if (node == null) continue;
|
||||
|
||||
int a = node.consumeVis(aspect, amount);
|
||||
drainedAmount += a;
|
||||
amount -= a;
|
||||
if (a>0) {
|
||||
int color = Aspect.getPrimalAspects().indexOf(aspect);
|
||||
generateVisEffect(world.provider.dimensionId, x, y, z, node.xCoord, node.yCoord, node.zCoord, color);
|
||||
}
|
||||
if (amount <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return drainedAmount;
|
||||
}
|
||||
|
||||
public static void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) {
|
||||
ThaumcraftApi.internalMethods.generateVisEffect(dim, x, y, z, x2, y2, z2, color);
|
||||
}
|
||||
|
||||
public static HashMap<Integer, HashMap<WorldCoordinates, WeakReference<TileVisNode>>> sources = new HashMap<Integer, HashMap<WorldCoordinates, WeakReference<TileVisNode>>>();
|
||||
|
||||
public static void addSource(World world, TileVisNode vs) {
|
||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
||||
.get(world.provider.dimensionId);
|
||||
if (sourcelist == null) {
|
||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
||||
}
|
||||
sourcelist.put(vs.getLocation(), new WeakReference(vs));
|
||||
sources.put(world.provider.dimensionId, sourcelist);
|
||||
nearbyNodes.clear();
|
||||
}
|
||||
|
||||
public static boolean isNodeValid(WeakReference<TileVisNode> node) {
|
||||
if (node == null || node.get() == null || node.get().isInvalid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static WeakReference<TileVisNode> addNode(World world, TileVisNode vn) {
|
||||
WeakReference ref = new WeakReference(vn);
|
||||
|
||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
||||
.get(world.provider.dimensionId);
|
||||
if (sourcelist == null) {
|
||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<Object[]> nearby = new ArrayList<Object[]>();
|
||||
|
||||
for (WeakReference<TileVisNode> root : sourcelist.values()) {
|
||||
if (!isNodeValid(root))
|
||||
continue;
|
||||
|
||||
TileVisNode source = root.get();
|
||||
|
||||
float r = inRange(world, vn.getLocation(), source.getLocation(),
|
||||
vn.getRange());
|
||||
if (r > 0) {
|
||||
nearby.add(new Object[] { source, r - vn.getRange() * 2 });
|
||||
}
|
||||
|
||||
nearby = findClosestNodes(vn, source, nearby);
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
float dist = Float.MAX_VALUE;
|
||||
TileVisNode closest = null;
|
||||
if (nearby.size() > 0) {
|
||||
for (Object[] o : nearby) {
|
||||
if ((Float) o[1] < dist &&
|
||||
(vn.getAttunement() == -1 || ((TileVisNode) o[0]).getAttunement() == -1 ||
|
||||
vn.getAttunement() == ((TileVisNode) o[0]).getAttunement())//) {
|
||||
&& canNodeBeSeen(vn,(TileVisNode)o[0])) {
|
||||
dist = (Float) o[1];
|
||||
closest = (TileVisNode) o[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closest != null) {
|
||||
closest.getChildren().add(ref);
|
||||
nearbyNodes.clear();
|
||||
return new WeakReference(closest);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static ArrayList<WorldCoordinates> cache = new ArrayList<WorldCoordinates>();
|
||||
public static ArrayList<Object[]> findClosestNodes(TileVisNode target,
|
||||
TileVisNode parent, ArrayList<Object[]> in) {
|
||||
|
||||
if (cache.size() > 512 || cache.contains(new WorldCoordinates(parent))) return in;
|
||||
cache.add(new WorldCoordinates(parent));
|
||||
|
||||
for (WeakReference<TileVisNode> childWR : parent.getChildren()) {
|
||||
TileVisNode child = childWR.get();
|
||||
|
||||
if (child != null && !child.equals(target) && !child.equals(parent)) {
|
||||
float r2 = inRange(child.getWorldObj(), child.getLocation(),
|
||||
target.getLocation(), target.getRange());
|
||||
if (r2 > 0) {
|
||||
in.add(new Object[] { child, r2 });
|
||||
}
|
||||
|
||||
in = findClosestNodes(target, child, in);
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
private static float inRange(World world, WorldCoordinates cc1,
|
||||
WorldCoordinates cc2, int range) {
|
||||
float distance = cc1.getDistanceSquaredToWorldCoordinates(cc2);
|
||||
return distance > range * range ? -1 : distance;
|
||||
}
|
||||
|
||||
private static HashMap<WorldCoordinates, ArrayList<WeakReference<TileVisNode>>> nearbyNodes = new HashMap<WorldCoordinates, ArrayList<WeakReference<TileVisNode>>>();
|
||||
|
||||
private static void calculateNearbyNodes(World world, int x, int y, int z) {
|
||||
|
||||
HashMap<WorldCoordinates, WeakReference<TileVisNode>> sourcelist = sources
|
||||
.get(world.provider.dimensionId);
|
||||
if (sourcelist == null) {
|
||||
sourcelist = new HashMap<WorldCoordinates, WeakReference<TileVisNode>>();
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<WeakReference<TileVisNode>> cn = new ArrayList<WeakReference<TileVisNode>>();
|
||||
WorldCoordinates drainer = new WorldCoordinates(x, y, z,
|
||||
world.provider.dimensionId);
|
||||
|
||||
ArrayList<Object[]> nearby = new ArrayList<Object[]>();
|
||||
|
||||
for (WeakReference<TileVisNode> root : sourcelist.values()) {
|
||||
|
||||
if (!isNodeValid(root))
|
||||
continue;
|
||||
|
||||
TileVisNode source = root.get();
|
||||
|
||||
TileVisNode closest = null;
|
||||
float range = Float.MAX_VALUE;
|
||||
|
||||
float r = inRange(world, drainer, source.getLocation(),
|
||||
source.getRange());
|
||||
if (r > 0) {
|
||||
range = r;
|
||||
closest = source;
|
||||
}
|
||||
|
||||
ArrayList<WeakReference<TileVisNode>> children = new ArrayList<WeakReference<TileVisNode>>();
|
||||
children = getAllChildren(source,children);
|
||||
|
||||
for (WeakReference<TileVisNode> child : children) {
|
||||
TileVisNode n = child.get();
|
||||
if (n != null && !n.equals(root)) {
|
||||
|
||||
float r2 = inRange(n.getWorldObj(), n.getLocation(),
|
||||
drainer, n.getRange());
|
||||
if (r2 > 0 && r2 < range) {
|
||||
range = r2;
|
||||
closest = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closest != null) {
|
||||
|
||||
cn.add(new WeakReference(closest));
|
||||
}
|
||||
}
|
||||
|
||||
nearbyNodes.put(drainer, cn);
|
||||
}
|
||||
|
||||
private static ArrayList<WeakReference<TileVisNode>> getAllChildren(TileVisNode source, ArrayList<WeakReference<TileVisNode>> list) {
|
||||
for (WeakReference<TileVisNode> child : source.getChildren()) {
|
||||
TileVisNode n = child.get();
|
||||
|
||||
if (n != null && n.getWorldObj()!=null && isChunkLoaded(n.getWorldObj(), n.xCoord, n.zCoord)) {
|
||||
list.add(child);
|
||||
list = getAllChildren(n,list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean isChunkLoaded(World world, int x, int z) {
|
||||
int xx = x >> 4;
|
||||
int zz = z >> 4;
|
||||
return world.getChunkProvider().chunkExists(xx, zz);
|
||||
}
|
||||
|
||||
public static boolean canNodeBeSeen(TileVisNode source,TileVisNode target)
|
||||
{
|
||||
MovingObjectPosition mop = ThaumcraftApiHelper.rayTraceIgnoringSource(source.getWorldObj(),
|
||||
Vec3.createVectorHelper(source.xCoord+.5, source.yCoord+.5,source.zCoord+.5),
|
||||
Vec3.createVectorHelper(target.xCoord+.5, target.yCoord+.5,target.zCoord+.5),
|
||||
false, true, false);
|
||||
return mop == null || (mop.typeOfHit==MovingObjectType.BLOCK &&
|
||||
mop.blockX==target.xCoord && mop.blockY==target.yCoord && mop.blockZ==target.zCoord);
|
||||
}
|
||||
|
||||
// public static HashMap<WorldCoordinates,WeakReference<TileVisNode>>
|
||||
// noderef = new HashMap<WorldCoordinates,WeakReference<TileVisNode>>();
|
||||
//
|
||||
// public static TileVisNode getClosestNodeWithinRadius(World world, int x,
|
||||
// int y, int z, int radius) {
|
||||
// TileVisNode out = null;
|
||||
// WorldCoordinates wc = null;
|
||||
// float cd = Float.MAX_VALUE;
|
||||
// for (int sx = x - radius; sx <= x + radius; sx++) {
|
||||
// for (int sy = y - radius; sy <= y + radius; sy++) {
|
||||
// for (int sz = z - radius; sz <= z + radius; sz++) {
|
||||
// wc = new WorldCoordinates(sx,sy,sz,world.provider.dimensionId);
|
||||
// if (noderef.containsKey(wc)) {
|
||||
// float d = wc.getDistanceSquared(x, y, z);
|
||||
// if (d<radius*radius && noderef.get(wc).get()!=null &&
|
||||
// !noderef.get(wc).get().isReceiver() &&
|
||||
// isNodeValid(noderef.get(wc).get().getParent())
|
||||
// ) {
|
||||
// out = noderef.get(wc).get();
|
||||
// cd = d;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return out;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class FocusUpgradeType {
|
||||
|
||||
public static FocusUpgradeType[] types = new FocusUpgradeType[20];
|
||||
|
||||
public short id;
|
||||
|
||||
public ResourceLocation icon;
|
||||
|
||||
public String name;
|
||||
|
||||
public String text;
|
||||
|
||||
/**
|
||||
* What aspects are used to calculate the cost of this upgrade. The amounts given is ignored, just the type is used for the calculation.
|
||||
*/
|
||||
public AspectList aspects;
|
||||
|
||||
|
||||
|
||||
public FocusUpgradeType(int id, ResourceLocation icon, String name, String text, AspectList aspects) {
|
||||
this.id = (short) id;
|
||||
this.icon = icon;
|
||||
this.name = name;
|
||||
this.text = text;
|
||||
this.aspects = aspects;
|
||||
|
||||
if (id<types.length && types[id]!=null) {
|
||||
LogManager.getLogger("THAUMCRAFT").fatal("Focus Upgrade id "+id+" already occupied. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate space
|
||||
if (id>=types.length) {
|
||||
FocusUpgradeType[] temp = new FocusUpgradeType[id+1];
|
||||
System.arraycopy(types, 0, temp, 0, types.length);
|
||||
types = temp;
|
||||
}
|
||||
|
||||
types[id] = this;
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return StatCollector.translateToLocal(name);
|
||||
}
|
||||
|
||||
public String getLocalizedText() {
|
||||
return StatCollector.translateToLocal(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FocusUpgradeType) {
|
||||
return this.id == ((FocusUpgradeType)obj).id;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
// basic upgrade types
|
||||
public static FocusUpgradeType potency = new FocusUpgradeType( 0,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/potency.png"),
|
||||
"focus.upgrade.potency.name","focus.upgrade.potency.text",
|
||||
new AspectList().add(Aspect.WEAPON,1));
|
||||
|
||||
public static FocusUpgradeType frugal = new FocusUpgradeType( 1,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/frugal.png"),
|
||||
"focus.upgrade.frugal.name","focus.upgrade.frugal.text",
|
||||
new AspectList().add(Aspect.HUNGER,1));
|
||||
|
||||
public static FocusUpgradeType treasure = new FocusUpgradeType( 2,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/treasure.png"),
|
||||
"focus.upgrade.treasure.name","focus.upgrade.treasure.text",
|
||||
new AspectList().add(Aspect.GREED,1));
|
||||
|
||||
public static FocusUpgradeType enlarge = new FocusUpgradeType( 3,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/enlarge.png"),
|
||||
"focus.upgrade.enlarge.name","focus.upgrade.enlarge.text",
|
||||
new AspectList().add(Aspect.TRAVEL,1));
|
||||
|
||||
public static FocusUpgradeType alchemistsfire = new FocusUpgradeType( 4,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/alchemistsfire.png"),
|
||||
"focus.upgrade.alchemistsfire.name","focus.upgrade.alchemistsfire.text",
|
||||
new AspectList().add(Aspect.ENERGY,1).add(Aspect.SLIME,1));
|
||||
|
||||
public static FocusUpgradeType alchemistsfrost = new FocusUpgradeType( 5,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/alchemistsfrost.png"),
|
||||
"focus.upgrade.alchemistsfrost.name","focus.upgrade.alchemistsfrost.text",
|
||||
new AspectList().add(Aspect.COLD,1).add(Aspect.TRAP,1));
|
||||
|
||||
public static FocusUpgradeType architect = new FocusUpgradeType( 6,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/architect.png"),
|
||||
"focus.upgrade.architect.name","focus.upgrade.architect.text",
|
||||
new AspectList().add(Aspect.CRAFT,1));
|
||||
|
||||
public static FocusUpgradeType extend = new FocusUpgradeType( 7,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/extend.png"),
|
||||
"focus.upgrade.extend.name","focus.upgrade.extend.text",
|
||||
new AspectList().add(Aspect.EXCHANGE,1));
|
||||
|
||||
public static FocusUpgradeType silktouch = new FocusUpgradeType( 8,
|
||||
new ResourceLocation("thaumcraft", "textures/foci/silktouch.png"),
|
||||
"focus.upgrade.silktouch.name","focus.upgrade.silktouch.text",
|
||||
new AspectList().add(Aspect.GREED,1));
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Implemented by a class that you wish to be called whenever a wand with this rod performs its
|
||||
* update tick.
|
||||
*
|
||||
*/
|
||||
public interface IWandRodOnUpdate {
|
||||
void onUpdate(ItemStack itemstack, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IWandTriggerManager {
|
||||
|
||||
/**
|
||||
* This class will be called by wands with the proper parameters. It is up to you to decide what to do with them.
|
||||
*/
|
||||
public boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
||||
int x, int y, int z, int side, int event);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
* Add this to a tile entity that you wish wands to interact with in some way.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IWandable {
|
||||
|
||||
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md);
|
||||
|
||||
public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player);
|
||||
|
||||
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count);
|
||||
|
||||
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFocusBasic extends Item {
|
||||
|
||||
public ItemFocusBasic ()
|
||||
{
|
||||
super();
|
||||
maxStackSize = 1;
|
||||
canRepair=false;
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
public IIcon icon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int par1) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) {
|
||||
AspectList al = this.getVisCost(stack);
|
||||
if (al!=null && al.size()>0) {
|
||||
list.add(StatCollector.translateToLocal(isVisCostPerTick(stack)?"item.Focus.cost2":"item.Focus.cost1"));
|
||||
for (Aspect aspect:al.getAspectsSorted()) {
|
||||
DecimalFormat myFormatter = new DecimalFormat("#####.##");
|
||||
String amount = myFormatter.format(al.getAmount(aspect)/100f);
|
||||
list.add(" \u00A7"+aspect.getChatcolor()+aspect.getName()+"\u00A7r x "+ amount);
|
||||
}
|
||||
}
|
||||
addFocusInformation(stack,player,list,par4);
|
||||
}
|
||||
|
||||
public void addFocusInformation(ItemStack focusstack,EntityPlayer player, List list, boolean par4) {
|
||||
LinkedHashMap<Short, Integer> map = new LinkedHashMap<Short, Integer>();
|
||||
for (short id:this.getAppliedUpgrades(focusstack)) {
|
||||
if (id>=0) {
|
||||
int amt = 1;
|
||||
if (map.containsKey(id)) {
|
||||
amt = map.get(id) + 1;
|
||||
}
|
||||
map.put(id, amt);
|
||||
}
|
||||
}
|
||||
for (Short id:map.keySet()) {
|
||||
list.add(EnumChatFormatting.DARK_PURPLE +FocusUpgradeType.types[id].getLocalizedName()+
|
||||
(map.get(id)>1?" "+StatCollector.translateToLocal("enchantment.level." + map.get(id)):""));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purely for display on the focus tooltip (see addInformation method above)
|
||||
*/
|
||||
public boolean isVisCostPerTick(ItemStack focusstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack focusstack)
|
||||
{
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
/**
|
||||
* What color will the focus orb be rendered on the held wand
|
||||
*/
|
||||
public int getFocusColor(ItemStack focusstack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does the focus have ornamentation like the focus of the nine hells. Ornamentation is a standard icon rendered in a cross around the focus
|
||||
*/
|
||||
public IIcon getOrnament(ItemStack focusstack) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* An icon to be rendered inside the focus itself
|
||||
*/
|
||||
public IIcon getFocusDepthLayerIcon(ItemStack focusstack) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum WandFocusAnimation {
|
||||
WAVE, CHARGE;
|
||||
}
|
||||
|
||||
public WandFocusAnimation getAnimation(ItemStack focusstack) {
|
||||
return WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just insert two alphanumeric characters before this string in your focus item class
|
||||
*/
|
||||
public String getSortingHelper(ItemStack focusstack) {
|
||||
String out="";
|
||||
for (short id:this.getAppliedUpgrades(focusstack)) {
|
||||
out = out + id;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* How much vis does this focus consume per activation.
|
||||
*/
|
||||
public AspectList getVisCost(ItemStack focusstack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns how many milliseconds must pass before the focus can be activated again.
|
||||
*/
|
||||
public int getActivationCooldown(ItemStack focusstack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by foci like equal trade to determine their area in artchitect mode
|
||||
*/
|
||||
public int getMaxAreaSize(ItemStack focusstack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* What upgrades can be applied to this focus for ranks 1 to 5
|
||||
*/
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack focusstack, int rank) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* What upgrades does the focus currently have
|
||||
*/
|
||||
public short[] getAppliedUpgrades(ItemStack focusstack) {
|
||||
short[] l = new short[] {-1,-1,-1,-1,-1};
|
||||
NBTTagList nbttaglist = getFocusUpgradeTagList(focusstack);
|
||||
if (nbttaglist == null)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < nbttaglist.tagCount(); ++j)
|
||||
{
|
||||
if (j>=5) break;
|
||||
l[j] = nbttaglist.getCompoundTagAt(j).getShort("id");
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean applyUpgrade(ItemStack focusstack, FocusUpgradeType type, int rank) {
|
||||
short[] upgrades = getAppliedUpgrades(focusstack);
|
||||
if (upgrades[rank-1]!=-1 || rank<1 || rank>5) {
|
||||
return false;
|
||||
}
|
||||
upgrades[rank-1] = type.id;
|
||||
setFocusUpgradeTagList(focusstack, upgrades);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to define custom logic about which upgrades can be applied. This can be used to set up upgrade "trees"
|
||||
* that make certain upgrades available only when others are unlocked first, when certain research is completed, or similar logic.
|
||||
*
|
||||
*/
|
||||
public boolean canApplyUpgrade(ItemStack focusstack, EntityPlayer player, FocusUpgradeType type, int rank) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this focus have the passed upgrade type
|
||||
*/
|
||||
public boolean isUpgradedWith(ItemStack focusstack, FocusUpgradeType focusUpgradetype) {
|
||||
return getUpgradeLevel(focusstack,focusUpgradetype)>0;
|
||||
}
|
||||
|
||||
/**
|
||||
* What level is the passed upgrade type on the focus. If it is not present it returns 0
|
||||
*/
|
||||
public int getUpgradeLevel(ItemStack focusstack, FocusUpgradeType focusUpgradetype) {
|
||||
short[] list = getAppliedUpgrades(focusstack);
|
||||
int level=0;
|
||||
for (short id:list) {
|
||||
if (id == focusUpgradetype.id)
|
||||
{
|
||||
level++;
|
||||
}
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick(ItemStack wandstack, World world,EntityPlayer player, MovingObjectPosition movingobjectposition) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onUsingFocusTick(ItemStack wandstack, EntityPlayer player,int count) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void onPlayerStoppedUsingFocus(ItemStack wandstack, World world, EntityPlayer player, int count) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public boolean onFocusBlockStartBreak(ItemStack wandstack, int x, int y,int z, EntityPlayer player) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal helper methods
|
||||
*/
|
||||
private NBTTagList getFocusUpgradeTagList(ItemStack focusstack)
|
||||
{
|
||||
return focusstack.stackTagCompound == null ? null : focusstack.stackTagCompound.getTagList("upgrade", 10);
|
||||
}
|
||||
|
||||
private void setFocusUpgradeTagList(ItemStack focusstack, short[] upgrades) {
|
||||
if (!focusstack.hasTagCompound())
|
||||
focusstack.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound nbttagcompound = focusstack.getTagCompound();
|
||||
NBTTagList tlist = new NBTTagList();
|
||||
nbttagcompound.setTag("upgrade", tlist);
|
||||
for (short id : upgrades) {
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setShort("id", id);
|
||||
tlist.appendTag(f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) {
|
||||
if (stack.stackTagCompound !=null && stack.stackTagCompound.hasKey("ench")) {
|
||||
stack.stackTagCompound.removeTag("ench");
|
||||
}
|
||||
super.onUpdate(stack, world, entity, p_77663_4_, p_77663_5_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* This class is used to keep the material information for the various rods.
|
||||
* It is also used to generate the wand recipes ingame.
|
||||
*
|
||||
*/
|
||||
public class StaffRod extends WandRod {
|
||||
|
||||
boolean runes=false;
|
||||
|
||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost) {
|
||||
super(tag+"_staff", capacity, item, craftCost);
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
|
||||
}
|
||||
|
||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
||||
IWandRodOnUpdate onUpdate, ResourceLocation texture) {
|
||||
super(tag+"_staff", capacity, item, craftCost, onUpdate, texture);
|
||||
}
|
||||
|
||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
||||
IWandRodOnUpdate onUpdate) {
|
||||
super(tag+"_staff", capacity, item, craftCost, onUpdate);
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
|
||||
}
|
||||
|
||||
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
|
||||
ResourceLocation texture) {
|
||||
super(tag+"_staff", capacity, item, craftCost, texture);
|
||||
}
|
||||
|
||||
public boolean hasRunes() {
|
||||
return runes;
|
||||
}
|
||||
|
||||
public void setRunes(boolean hasRunes) {
|
||||
this.runes = hasRunes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
/**
|
||||
* This class is used to keep the material information for the various caps.
|
||||
* It is also used to generate the wand recipes ingame.
|
||||
* @author Azanor
|
||||
*
|
||||
*/
|
||||
public class WandCap {
|
||||
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* Cost to craft this wand. Combined with the rod cost.
|
||||
*/
|
||||
private int craftCost;
|
||||
|
||||
/**
|
||||
* the amount by which all aspect costs are multiplied
|
||||
*/
|
||||
float baseCostModifier;
|
||||
|
||||
/**
|
||||
* specifies a list of primal aspects that use the special discount figure instead of the normal discount.
|
||||
*/
|
||||
List<Aspect> specialCostModifierAspects;
|
||||
|
||||
/**
|
||||
* the amount by which the specified aspect costs are multiplied
|
||||
*/
|
||||
float specialCostModifier;
|
||||
|
||||
/**
|
||||
* The texture that will be used for the ingame wand cap
|
||||
*/
|
||||
ResourceLocation texture;
|
||||
|
||||
/**
|
||||
* the actual item that makes up this cap and will be used to generate the wand recipes
|
||||
*/
|
||||
ItemStack item;
|
||||
|
||||
public static LinkedHashMap<String,WandCap> caps = new LinkedHashMap<String,WandCap>();
|
||||
|
||||
public WandCap (String tag, float discount, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.baseCostModifier = discount;
|
||||
this.specialCostModifierAspects = null;
|
||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
caps.put(tag, this);
|
||||
}
|
||||
|
||||
public WandCap (String tag, float discount, List<Aspect> specialAspects, float discountSpecial, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.baseCostModifier = discount;
|
||||
this.specialCostModifierAspects = specialAspects;
|
||||
this.specialCostModifier = discountSpecial;
|
||||
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
caps.put(tag, this);
|
||||
}
|
||||
|
||||
public float getBaseCostModifier() {
|
||||
return baseCostModifier;
|
||||
}
|
||||
|
||||
public List<Aspect> getSpecialCostModifierAspects() {
|
||||
return specialCostModifierAspects;
|
||||
}
|
||||
|
||||
public float getSpecialCostModifier() {
|
||||
return specialCostModifier;
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(ResourceLocation texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getCraftCost() {
|
||||
return craftCost;
|
||||
}
|
||||
|
||||
public void setCraftCost(int craftCost) {
|
||||
this.craftCost = craftCost;
|
||||
}
|
||||
|
||||
/**
|
||||
* The research a player needs to have finished to be able to craft a wand with this cap.
|
||||
*/
|
||||
public String getResearch() {
|
||||
return "CAP_"+getTag();
|
||||
}
|
||||
|
||||
// Some examples:
|
||||
// WandCap WAND_CAP_IRON = new WandCap("iron", 1.1f, Arrays.asList(Aspect.ORDER),1, new ItemStack(ConfigItems.itemWandCap,1,0),1);
|
||||
// WandCap WAND_CAP_GOLD = new WandCap("gold", 1f, new ItemStack(ConfigItems.itemWandCap,1,1),3);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* This class is used to keep the material information for the various rods.
|
||||
* It is also used to generate the wand recipes ingame.
|
||||
*
|
||||
*/
|
||||
public class WandRod {
|
||||
|
||||
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* Cost to craft this wand. Combined with the rod cost.
|
||||
*/
|
||||
private int craftCost;
|
||||
|
||||
/**
|
||||
* The amount of vis that can be stored - this number is actually multiplied
|
||||
* by 100 for use by the wands internals
|
||||
*/
|
||||
int capacity;
|
||||
|
||||
/**
|
||||
* The texture that will be used for the ingame wand rod
|
||||
*/
|
||||
protected ResourceLocation texture;
|
||||
|
||||
/**
|
||||
* the actual item that makes up this rod and will be used to generate the wand recipes
|
||||
*/
|
||||
ItemStack item;
|
||||
|
||||
/**
|
||||
* A class that will be called whenever the wand onUpdate tick is run
|
||||
*/
|
||||
IWandRodOnUpdate onUpdate;
|
||||
|
||||
/**
|
||||
* Does the rod glow in the dark?
|
||||
*/
|
||||
boolean glow;
|
||||
|
||||
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = texture;
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate, ResourceLocation texture) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = texture;
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
}
|
||||
|
||||
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate) {
|
||||
this.setTag(tag);
|
||||
this.capacity = capacity;
|
||||
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
|
||||
this.item=item;
|
||||
this.setCraftCost(craftCost);
|
||||
rods.put(tag, this);
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public ResourceLocation getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setTexture(ResourceLocation texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getCraftCost() {
|
||||
return craftCost;
|
||||
}
|
||||
|
||||
public void setCraftCost(int craftCost) {
|
||||
this.craftCost = craftCost;
|
||||
}
|
||||
|
||||
public IWandRodOnUpdate getOnUpdate() {
|
||||
return onUpdate;
|
||||
}
|
||||
|
||||
public void setOnUpdate(IWandRodOnUpdate onUpdate) {
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public boolean isGlowing() {
|
||||
return glow;
|
||||
}
|
||||
|
||||
public void setGlowing(boolean hasGlow) {
|
||||
this.glow = hasGlow;
|
||||
}
|
||||
|
||||
/**
|
||||
* The research a player needs to have finished to be able to craft a wand with this rod.
|
||||
*/
|
||||
public String getResearch() {
|
||||
return "ROD_"+getTag();
|
||||
}
|
||||
|
||||
// Some examples:
|
||||
// WandRod WAND_ROD_WOOD = new WandRod("wood",25,new ItemStack(Item.stick),1);
|
||||
// WandRod WAND_ROD_BLAZE = new WandRod("blaze",100,new ItemStack(Item.blazeRod),7,new WandRodBlazeOnUpdate());
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package thaumcraft.api.wands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class serves a similar function to IWandable in that it allows wands to interact
|
||||
* with object in the world. In this case it is most useful for adding interaction with non-mod
|
||||
* blocks where you can't control what happens in their code.
|
||||
* Example where it is used is in crafting the thaumonomicon from a bookshelf and the
|
||||
* crucible from a cauldron
|
||||
*
|
||||
* @author azanor
|
||||
*
|
||||
*/
|
||||
public class WandTriggerRegistry {
|
||||
|
||||
private static HashMap<String,HashMap<List,List>> triggers = new HashMap<String,HashMap<List,List>>();
|
||||
private static final String DEFAULT = "default";
|
||||
|
||||
/**
|
||||
* Registers an action to perform when a casting wand right clicks on a specific block.
|
||||
* A manager class needs to be created that implements IWandTriggerManager.
|
||||
* @param manager
|
||||
* @param event a logical number that you can use to differentiate different events or actions
|
||||
* @param block
|
||||
* @param meta send -1 as a wildcard value for all possible meta values
|
||||
* @param modid a unique identifier. It is best to register your own triggers using your mod id to avoid conflicts with mods that register triggers for the same block
|
||||
*/
|
||||
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, Block block, int meta, String modid) {
|
||||
if (!triggers.containsKey(modid)) {
|
||||
triggers.put(modid, new HashMap<List,List>());
|
||||
}
|
||||
HashMap<List,List> temp = triggers.get(modid);
|
||||
temp.put(Arrays.asList(block,meta),Arrays.asList(manager,event));
|
||||
triggers.put(modid, temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* for legacy support
|
||||
*/
|
||||
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, Block block, int meta) {
|
||||
registerWandBlockTrigger(manager, event, block, meta, DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks all trigger registries if one exists for the given block and meta
|
||||
* @param block
|
||||
* @param meta
|
||||
* @return
|
||||
*/
|
||||
public static boolean hasTrigger(Block block, int meta) {
|
||||
for (String modid:triggers.keySet()) {
|
||||
HashMap<List,List> temp = triggers.get(modid);
|
||||
if (temp.containsKey(Arrays.asList(block,meta)) ||
|
||||
temp.containsKey(Arrays.asList(block,-1))) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* modid sensitive version
|
||||
*/
|
||||
public static boolean hasTrigger(Block block, int meta, String modid) {
|
||||
if (!triggers.containsKey(modid)) return false;
|
||||
HashMap<List,List> temp = triggers.get(modid);
|
||||
if (temp.containsKey(Arrays.asList(block,meta)) ||
|
||||
temp.containsKey(Arrays.asList(block,-1))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is called by the onItemUseFirst function in wands.
|
||||
* Parameters and return value functions like you would expect for that function.
|
||||
* @param world
|
||||
* @param wand
|
||||
* @param player
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param side
|
||||
* @param block
|
||||
* @param meta
|
||||
* @return
|
||||
*/
|
||||
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
||||
int x, int y, int z, int side, Block block, int meta) {
|
||||
|
||||
for (String modid:triggers.keySet()) {
|
||||
HashMap<List,List> temp = triggers.get(modid);
|
||||
List l = temp.get(Arrays.asList(block,meta));
|
||||
if (l==null) l = temp.get(Arrays.asList(block,-1));
|
||||
if (l==null) continue;
|
||||
|
||||
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
|
||||
int event = (Integer) l.get(1);
|
||||
boolean result = manager.performTrigger(world, wand, player, x, y, z, side, event);
|
||||
if (result) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* modid sensitive version
|
||||
*/
|
||||
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
|
||||
int x, int y, int z, int side, Block block, int meta, String modid) {
|
||||
if (!triggers.containsKey(modid)) return false;
|
||||
HashMap<List,List> temp = triggers.get(modid);
|
||||
List l = temp.get(Arrays.asList(block,meta));
|
||||
if (l==null) l = temp.get(Arrays.asList(block,-1));
|
||||
if (l==null) return false;
|
||||
|
||||
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
|
||||
int event = (Integer) l.get(1);
|
||||
return manager.performTrigger(world, wand, player, x, y, z, side, event);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -22,6 +21,8 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
@@ -132,6 +133,7 @@ import crazypants.enderio.teleport.anchor.TravelEntitySpecialRenderer;
|
||||
import crazypants.enderio.teleport.telepad.TeleportEntityRenderHandler;
|
||||
import crazypants.render.IconUtil;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
// @formatter:off
|
||||
@@ -225,7 +227,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
BlockSolarPanel.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new SolarPanelRenderer());
|
||||
|
||||
|
||||
EnchanterModelRenderer emr = new EnchanterModelRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, emr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnchanter), emr);
|
||||
@@ -260,7 +262,7 @@ public class ClientProxy extends CommonProxy {
|
||||
BlockWeatherObelisk.renderId = BlockAttractor.renderId;
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWeatherObelisk.class, twr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
|
||||
|
||||
|
||||
if(Config.useCombustionGenModel) {
|
||||
CombustionGeneratorModelRenderer cgmr = new CombustionGeneratorModelRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCombustionGenerator.class, cgmr);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
import static crazypants.enderio.EnderIO.MOD_NAME;
|
||||
import static crazypants.enderio.EnderIO.VERSION;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@@ -155,9 +151,12 @@ import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.enderio.teleport.anchor.BlockTravelAnchor;
|
||||
import crazypants.enderio.teleport.telepad.BlockTelePad;
|
||||
import crazypants.enderio.teleport.telepad.ItemCoordSelector;
|
||||
import crazypants.enderio.thaumcraft.ThaumcraftCompat;
|
||||
import crazypants.util.EntityUtil;
|
||||
|
||||
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = "required-after:[email protected],);after:MineFactoryReloaded;after:Waila@[1.5.8,)", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
import static crazypants.enderio.EnderIO.*;
|
||||
|
||||
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = "required-after:[email protected],);after:MineFactoryReloaded;after:Waila@[1.5.8,);after:Thaumcraft", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
public class EnderIO {
|
||||
|
||||
public static final String MODID = "EnderIO";
|
||||
@@ -478,7 +477,7 @@ public class EnderIO {
|
||||
public void load(FMLInitializationEvent event) {
|
||||
|
||||
Config.init();
|
||||
|
||||
|
||||
instance = this;
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(MessageTileNBT.class, MessageTileNBT.class, PacketHandler.nextID(), Side.SERVER);
|
||||
@@ -559,14 +558,13 @@ public class EnderIO {
|
||||
TeleportRecipes.addRecipes();
|
||||
|
||||
proxy.load();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
Config.postInit();
|
||||
|
||||
|
||||
//Regsiter the enchants
|
||||
Enchantments.getInstance();
|
||||
|
||||
@@ -627,7 +625,7 @@ public class EnderIO {
|
||||
try {
|
||||
Field getField = Class.forName("openblocks.Config").getField("xpFluidId");
|
||||
openBlocksXPJuiceName = (String) getField.get(null);
|
||||
}catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
if(openBlocksXPJuiceName != null && !Config.xpJuiceName.equals(openBlocksXPJuiceName)) {
|
||||
@@ -657,7 +655,8 @@ public class EnderIO {
|
||||
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ThaumcraftCompat.load();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import static crazypants.enderio.EnderIO.*;
|
||||
|
||||
public class EnderIOTab extends CreativeTabs {
|
||||
|
||||
@@ -27,6 +27,7 @@ public class EnderIOTab extends CreativeTabs {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return EnderIO.itemEnderface;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iIconRegister) {
|
||||
blockIcon = iIconRegister.registerIcon("enderio:" + ModObject.blockDarkSteelPressurePlate.unlocalisedName);
|
||||
}
|
||||
@@ -69,6 +70,7 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntityPaintedBlock) {
|
||||
|
||||
@@ -437,9 +437,6 @@ public abstract class AbstractConduit implements IConduit {
|
||||
bundle.getEntity().getBlockType());
|
||||
}
|
||||
}
|
||||
if(getNetwork() != null) {
|
||||
getNetwork().onUpdateEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,10 +12,12 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
|
||||
protected final List<I> conduits = new ArrayList<I>();
|
||||
|
||||
protected Class<I> implClass;
|
||||
protected final Class<I> implClass;
|
||||
protected final Class<T> baseConduitClass;
|
||||
|
||||
protected AbstractConduitNetwork(Class<I> implClass) {
|
||||
protected AbstractConduitNetwork(Class<I> implClass, Class<T> baseConduitClass) {
|
||||
this.implClass = implClass;
|
||||
this.baseConduitClass = baseConduitClass;
|
||||
}
|
||||
|
||||
public void init(IConduitBundle tile, Collection<I> connections, World world) {
|
||||
@@ -35,7 +37,9 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
notifyNetworkOfUpdate();
|
||||
}
|
||||
|
||||
public abstract Class<T> getBaseConduitType();
|
||||
public final Class<T> getBaseConduitType() {
|
||||
return baseConduitClass;
|
||||
}
|
||||
|
||||
protected void setNetwork(World world, IConduitBundle tile) {
|
||||
|
||||
@@ -58,6 +62,9 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
|
||||
public void addConduit(I con) {
|
||||
if(!conduits.contains(con)) {
|
||||
if(conduits.isEmpty()) {
|
||||
ConduitNetworkTickHandler.instance.registerNetwork(this);
|
||||
}
|
||||
conduits.add(con);
|
||||
}
|
||||
}
|
||||
@@ -67,6 +74,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
con.setNetwork(null);
|
||||
}
|
||||
conduits.clear();
|
||||
ConduitNetworkTickHandler.instance.unregisterNetwork(this);
|
||||
}
|
||||
|
||||
public List<I> getConduits() {
|
||||
@@ -90,7 +98,6 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
return "AbstractConduitNetwork [conduits=" + sb.toString() + "]";
|
||||
}
|
||||
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
public void doNetworkTick() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -43,6 +45,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int index = 0;
|
||||
for (ItemConduitSubtype subtype : subtypes) {
|
||||
@@ -108,6 +111,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, subtypes.length - 1);
|
||||
return icons[damage];
|
||||
@@ -122,6 +126,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int j = 0; j < subtypes.length; ++j) {
|
||||
par3List.add(new ItemStack(this, 1, j));
|
||||
|
||||
@@ -337,14 +337,15 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public static volatile int theRenderPass;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass) {
|
||||
theRenderPass = pass;
|
||||
@@ -760,6 +761,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int
|
||||
y, int z) {
|
||||
|
||||
@@ -851,7 +853,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
List<RaytraceResult> hits = new ArrayList<RaytraceResult>();
|
||||
|
||||
|
||||
if (player == null) {
|
||||
player = EnderIO.proxy.getClientPlayer();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -19,6 +20,9 @@ public class ConduitNetworkTickHandler {
|
||||
|
||||
private final List<TickListener> listeners = new ArrayList<TickListener>();
|
||||
|
||||
private final IdentityHashMap<AbstractConduitNetwork<?,?>, Boolean> networks =
|
||||
new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
|
||||
|
||||
public void addListener(TickListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
@@ -27,6 +31,14 @@ public class ConduitNetworkTickHandler {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void registerNetwork(AbstractConduitNetwork<?,?> cn) {
|
||||
networks.put(cn, Boolean.TRUE);
|
||||
}
|
||||
|
||||
public void unregisterNetwork(AbstractConduitNetwork<?,?> cn) {
|
||||
networks.remove(cn);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerTick(TickEvent.ServerTickEvent event) {
|
||||
if(event.phase == Phase.START) {
|
||||
@@ -47,6 +59,9 @@ public class ConduitNetworkTickHandler {
|
||||
h.tickEnd(event);
|
||||
}
|
||||
listeners.clear();
|
||||
for(AbstractConduitNetwork<?,?> cn : networks.keySet()) {
|
||||
cn.doNetworkTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -33,7 +34,6 @@ import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.geom.Offsets;
|
||||
import crazypants.enderio.conduit.geom.Offsets.Axis;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.me.IMEConduit;
|
||||
@@ -224,7 +224,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(worldObj == null) {
|
||||
return;
|
||||
}
|
||||
@@ -234,62 +233,74 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
|
||||
if(conduitsDirty) {
|
||||
if(!worldObj.isRemote) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
markDirty();
|
||||
}
|
||||
conduitsDirty = false;
|
||||
doConduitsDirty();
|
||||
}
|
||||
|
||||
if(facadeChanged) {
|
||||
//force re-calc of lighting for both client and server
|
||||
ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord);
|
||||
//worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
worldObj.func_147451_t(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
facadeChanged = false;
|
||||
doFacadeChanged();
|
||||
}
|
||||
|
||||
//client side only, check for changes in rendering of the bundle
|
||||
if(worldObj.isRemote) {
|
||||
updateEntityClient();
|
||||
}
|
||||
}
|
||||
|
||||
boolean markForUpdate = false;
|
||||
if(clientUpdated) {
|
||||
//TODO: This is not the correct solution here but just marking the block for a render update server side
|
||||
//seems to get out of sync with the client sometimes so connections are not rendered correctly
|
||||
private void doConduitsDirty() {
|
||||
if(!worldObj.isRemote) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
markDirty();
|
||||
}
|
||||
conduitsDirty = false;
|
||||
}
|
||||
|
||||
private void doFacadeChanged() {
|
||||
//force re-calc of lighting for both client and server
|
||||
ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord);
|
||||
//worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
worldObj.func_147451_t(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, EnderIO.blockConduitBundle);
|
||||
facadeChanged = false;
|
||||
}
|
||||
|
||||
private void updateEntityClient() {
|
||||
boolean markForUpdate = false;
|
||||
if(clientUpdated) {
|
||||
//TODO: This is not the correct solution here but just marking the block for a render update server side
|
||||
//seems to get out of sync with the client sometimes so connections are not rendered correctly
|
||||
markForUpdate = true;
|
||||
clientUpdated = false;
|
||||
}
|
||||
|
||||
FacadeRenderState curRS = getFacadeRenderedAs();
|
||||
FacadeRenderState rs = ConduitUtil.getRequiredFacadeRenderState(this, EnderIO.proxy.getClientPlayer());
|
||||
|
||||
if(Config.updateLightingWhenHidingFacades) {
|
||||
int curLO = getLightOpacity();
|
||||
int shouldBeLO = rs == FacadeRenderState.FULL ? 255 : 0;
|
||||
if(curLO != shouldBeLO) {
|
||||
setLightOpacity(shouldBeLO);
|
||||
//worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
worldObj.func_147451_t(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if(curRS != rs) {
|
||||
setFacadeRenderAs(rs);
|
||||
if(!ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord)) {
|
||||
markForUpdate = true;
|
||||
clientUpdated = false;
|
||||
}
|
||||
} else { //can do the else as only need to update once
|
||||
ConduitDisplayMode curMode = ConduitDisplayMode.getDisplayMode(EnderIO.proxy.getClientPlayer().getCurrentEquippedItem());
|
||||
if(curMode != lastMode) {
|
||||
markForUpdate = true;
|
||||
lastMode = curMode;
|
||||
}
|
||||
|
||||
FacadeRenderState curRS = getFacadeRenderedAs();
|
||||
FacadeRenderState rs = ConduitUtil.getRequiredFacadeRenderState(this, EnderIO.proxy.getClientPlayer());
|
||||
|
||||
if(Config.updateLightingWhenHidingFacades) {
|
||||
int curLO = getLightOpacity();
|
||||
int shouldBeLO = rs == FacadeRenderState.FULL ? 255 : 0;
|
||||
if(curLO != shouldBeLO) {
|
||||
setLightOpacity(shouldBeLO);
|
||||
//worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
worldObj.func_147451_t(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if(curRS != rs) {
|
||||
setFacadeRenderAs(rs);
|
||||
if(!ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord)) {
|
||||
markForUpdate = true;
|
||||
}
|
||||
} else { //can do the else as only need to update once
|
||||
ConduitDisplayMode curMode = ConduitDisplayMode.getDisplayMode(EnderIO.proxy.getClientPlayer().getCurrentEquippedItem());
|
||||
if(curMode != lastMode) {
|
||||
markForUpdate = true;
|
||||
lastMode = curMode;
|
||||
}
|
||||
|
||||
}
|
||||
if(markForUpdate) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
if(markForUpdate) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +432,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public Set<ForgeDirection> getAllConnections() {
|
||||
Set<ForgeDirection> result = new HashSet<ForgeDirection>();
|
||||
EnumSet<ForgeDirection> result = EnumSet.noneOf(ForgeDirection.class);
|
||||
for (IConduit con : conduits) {
|
||||
result.addAll(con.getConduitConnections());
|
||||
}
|
||||
@@ -582,7 +593,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
|
||||
// External Connectors
|
||||
Set<ForgeDirection> externalDirs = new HashSet<ForgeDirection>();
|
||||
EnumSet<ForgeDirection> externalDirs = EnumSet.noneOf(ForgeDirection.class);
|
||||
for (IConduit con : conduits) {
|
||||
Set<ForgeDirection> extCons = con.getExternalConnections();
|
||||
if(extCons != null) {
|
||||
@@ -603,20 +614,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
connectorsDirty = false;
|
||||
}
|
||||
|
||||
private boolean axisOfConnectionsEqual(Set<ForgeDirection> cons) {
|
||||
Axis axis = null;
|
||||
for (ForgeDirection dir : cons) {
|
||||
if(axis == null) {
|
||||
axis = Offsets.getAxisForDir(dir);
|
||||
} else {
|
||||
if(axis != Offsets.getAxisForDir(dir)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addConduitCores(List<CollidableComponent> result, IConduit con) {
|
||||
CollidableCache cc = CollidableCache.instance;
|
||||
Class<? extends IConduit> type = con.getCollidableType();
|
||||
@@ -632,43 +629,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
}
|
||||
|
||||
// private boolean containsOnlySingleVerticalConnections() {
|
||||
// return getConnectionCount(ForgeDirection.UP) < 2 && getConnectionCount(ForgeDirection.DOWN) < 2;
|
||||
// }
|
||||
//
|
||||
// private boolean containsOnlySingleHorizontalConnections() {
|
||||
// return getConnectionCount(ForgeDirection.WEST) < 2 && getConnectionCount(ForgeDirection.EAST) < 2 &&
|
||||
// getConnectionCount(ForgeDirection.NORTH) < 2 && getConnectionCount(ForgeDirection.SOUTH) < 2;
|
||||
// }
|
||||
//
|
||||
// private boolean allDirectionsHaveSameConnectionCount() {
|
||||
// for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
// boolean hasCon = conduits.get(0).isConnectedTo(dir);
|
||||
// for (int i = 1; i < conduits.size(); i++) {
|
||||
// if(hasCon != conduits.get(i).isConnectedTo(dir)) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// private boolean containsOnlyHorizontalConnections() {
|
||||
// for (IConduit con : conduits) {
|
||||
// for (ForgeDirection dir : con.getConduitConnections()) {
|
||||
// if(dir == ForgeDirection.UP || dir == ForgeDirection.DOWN) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// for (ForgeDirection dir : con.getExternalConnections()) {
|
||||
// if(dir == ForgeDirection.UP || dir == ForgeDirection.DOWN) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
private int getConnectionCount(ForgeDirection dir) {
|
||||
if(dir == ForgeDirection.UNKNOWN) {
|
||||
return conduits.size();
|
||||
@@ -916,7 +876,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public void securityBreak() {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister IIconRegister) {
|
||||
blockIcon = IIconRegister.registerIcon("enderio:conduitFacade");
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.util.Util;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
|
||||
public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider {
|
||||
|
||||
@@ -63,6 +63,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
|
||||
for (FacadeType t : FacadeType.values()) {
|
||||
list.add(new ItemStack(item, 1, t.ordinal()));
|
||||
@@ -80,6 +81,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
icons = new IIcon[FacadeType.values().length];
|
||||
icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade");
|
||||
@@ -92,6 +94,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return icons[damage % icons.length];
|
||||
}
|
||||
|
||||
@@ -8,18 +8,13 @@ public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit> ext
|
||||
protected GasStack gasType;
|
||||
|
||||
protected AbstractGasTankConduitNetwork(Class<T> cl) {
|
||||
super(cl);
|
||||
super(cl, IGasConduit.class);
|
||||
}
|
||||
|
||||
public GasStack getGasType() {
|
||||
return gasType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IGasConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(T con) {
|
||||
super.addConduit(con);
|
||||
|
||||
@@ -9,9 +9,6 @@ import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
@@ -29,19 +26,10 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
|
||||
private int lastSyncedVolume = -1;
|
||||
|
||||
private long timeAtLastApply;
|
||||
|
||||
private final InnerTickHandler tickHandler = new InnerTickHandler();
|
||||
|
||||
public GasConduitNetwork() {
|
||||
super(GasConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IGasConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(GasConduit con) {
|
||||
tank.setCapacity(tank.getMaxGas() + GasConduit.CONDUIT_VOLUME);
|
||||
@@ -97,24 +85,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
World world = conduit.getBundle().getEntity().getWorldObj();
|
||||
if(world == null) {
|
||||
return;
|
||||
}
|
||||
if(world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if(curTime > 0 && curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
ConduitNetworkTickHandler.instance.addListener(tickHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doTick() {
|
||||
public void doNetworkTick() {
|
||||
if(gasType == null || outputs.isEmpty() || !tank.containsValidGas() || tank.isEmpty()) {
|
||||
updateActiveState();
|
||||
return;
|
||||
@@ -294,16 +265,4 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
lastSyncedVolume = tank.getStored();
|
||||
}
|
||||
|
||||
private class InnerTickHandler implements TickListener {
|
||||
|
||||
@Override
|
||||
public void tickStart(ServerTickEvent evt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(ServerTickEvent evt) {
|
||||
doTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,33 +17,22 @@ import crazypants.enderio.conduit.gui.item.InventoryFilterUpgrade;
|
||||
import crazypants.enderio.conduit.gui.item.InventorySpeedUpgrades;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.SpeedUpgrade;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
|
||||
public class ExternalConnectionContainer extends Container {
|
||||
|
||||
private InventoryPlayer playerInv;
|
||||
private IConduitBundle bundle;
|
||||
private ForgeDirection dir;
|
||||
private IItemConduit itemConduit;
|
||||
private final IItemConduit itemConduit;
|
||||
|
||||
private int speedUpgradeSlotLimit = 15;
|
||||
private IItemFilter inputFilter;
|
||||
private IItemFilter outputFilter;
|
||||
|
||||
private int outputFilterUpgradeSlot = 36;
|
||||
private int inputFilterUpgradeSlot = 37;
|
||||
private int speedUpgradeSlot = 38;
|
||||
private int startFilterSlot = 39;
|
||||
|
||||
private List<Point> slotLocations = new ArrayList<Point>();
|
||||
|
||||
List<FilterChangeListener> filterListeners = new ArrayList<FilterChangeListener>();
|
||||
|
||||
public ExternalConnectionContainer(InventoryPlayer playerInv, IConduitBundle bundle, ForgeDirection dir) {
|
||||
this.playerInv = playerInv;
|
||||
this.bundle = bundle;
|
||||
this.dir = dir;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
@@ -67,7 +56,6 @@ public class ExternalConnectionContainer extends Container {
|
||||
|
||||
itemConduit = bundle.getConduit(IItemConduit.class);
|
||||
if(itemConduit != null) {
|
||||
|
||||
x = 10;
|
||||
y = 47;
|
||||
InventoryFilterUpgrade fi = new InventoryFilterUpgrade(itemConduit, dir, false);
|
||||
@@ -96,48 +84,14 @@ public class ExternalConnectionContainer extends Container {
|
||||
}
|
||||
});
|
||||
slotLocations.add(new Point(x, y));
|
||||
|
||||
addFilterSlots(dir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addFilterListener(FilterChangeListener list) {
|
||||
filterListeners.add(list);
|
||||
}
|
||||
|
||||
private void addFilterSlots(ForgeDirection dir) {
|
||||
|
||||
List<Slot> slots;
|
||||
inputFilter = itemConduit.getInputFilter(dir);
|
||||
if(inputFilter != null && inputFilter.getSlotCount() > 0) {
|
||||
slots = inputFilter.getSlots(33, 69);
|
||||
for (Slot slot : slots) {
|
||||
addSlotToContainer(slot);
|
||||
slotLocations.add(new Point(slot.xDisplayPosition, slot.yDisplayPosition));
|
||||
}
|
||||
}
|
||||
|
||||
outputFilter = itemConduit.getOutputFilter(dir);
|
||||
if(outputFilter != null && outputFilter.getSlotCount() > 0) {
|
||||
slots = outputFilter.getSlots(33, 69);
|
||||
for (Slot slot : slots) {
|
||||
addSlotToContainer(slot);
|
||||
slotLocations.add(new Point(slot.xDisplayPosition, slot.yDisplayPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void filterChanged() {
|
||||
int slotsToRemove = inventorySlots.size() - startFilterSlot;
|
||||
for (int i = 0; i < slotsToRemove; i++) {
|
||||
int removeIndex = inventorySlots.size() - 1;
|
||||
inventorySlots.remove(removeIndex);
|
||||
inventoryItemStacks.remove(removeIndex);
|
||||
slotLocations.remove(removeIndex);
|
||||
}
|
||||
addFilterSlots(dir);
|
||||
|
||||
for (FilterChangeListener list : filterListeners) {
|
||||
list.onFilterChanged();
|
||||
}
|
||||
@@ -149,31 +103,14 @@ public class ExternalConnectionContainer extends Container {
|
||||
}
|
||||
setSlotsVisible(visible, inputFilterUpgradeSlot, inputFilterUpgradeSlot + 1);
|
||||
setSlotsVisible(visible, speedUpgradeSlot, speedUpgradeSlot + 1);
|
||||
|
||||
if(inputFilter == null || inputFilter.getSlotCount() == 0) {
|
||||
return;
|
||||
}
|
||||
int startIndex = startFilterSlot;
|
||||
int endIndex = inputFilter.getSlotCount() + startIndex;
|
||||
setSlotsVisible(visible, startIndex, endIndex);
|
||||
|
||||
}
|
||||
|
||||
public void setOutputSlotsVisible(boolean visible) {
|
||||
|
||||
if(itemConduit == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSlotsVisible(visible, outputFilterUpgradeSlot, outputFilterUpgradeSlot + 1);
|
||||
|
||||
if(outputFilter == null || outputFilter.getSlotCount() == 0) {
|
||||
return;
|
||||
}
|
||||
int startIndex = startFilterSlot + (inputFilter == null ? 0 : inputFilter.getSlotCount());
|
||||
int endIndex = startIndex + outputFilter.getSlotCount();
|
||||
setSlotsVisible(visible, startIndex, endIndex);
|
||||
|
||||
}
|
||||
|
||||
public void setInventorySlotsVisible(boolean visible) {
|
||||
@@ -205,12 +142,6 @@ public class ExternalConnectionContainer extends Container {
|
||||
SpeedUpgrade speedUpgrade = EnderIO.itemExtractSpeedUpgrade.getSpeedUpgrade(st);
|
||||
speedUpgradeSlotLimit = speedUpgrade.maxStackSize;
|
||||
}
|
||||
if(par4EntityPlayer.worldObj != null) {
|
||||
if(par1 >= startFilterSlot && itemConduit != null) {
|
||||
itemConduit.setInputFilter(dir, inputFilter);
|
||||
itemConduit.setOutputFilter(dir, outputFilter);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return super.slotClick(par1, par2, par3, par4EntityPlayer);
|
||||
} catch (Exception e) {
|
||||
@@ -226,9 +157,8 @@ public class ExternalConnectionContainer extends Container {
|
||||
}
|
||||
|
||||
private class FilterSlot extends Slot {
|
||||
final boolean isInput;
|
||||
|
||||
boolean isInput;
|
||||
|
||||
public FilterSlot(IInventory par1iInventory, int par2, int par3, int par4, boolean isInput) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.isInput = isInput;
|
||||
|
||||
@@ -199,6 +199,7 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
tes.draw();
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
}
|
||||
|
||||
public ForgeDirection getDir() {
|
||||
|
||||
@@ -21,19 +21,19 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private GuiContainerBase gui;
|
||||
private final GuiContainerBase gui;
|
||||
|
||||
private ToggleButtonEIO useMetaB;
|
||||
private ToggleButtonEIO useNbtB;
|
||||
private IconButtonEIO whiteListB;
|
||||
private ToggleButtonEIO useOreDictB;
|
||||
private ToggleButtonEIO stickyB;
|
||||
private final ToggleButtonEIO useMetaB;
|
||||
private final ToggleButtonEIO useNbtB;
|
||||
private final IconButtonEIO whiteListB;
|
||||
private final ToggleButtonEIO useOreDictB;
|
||||
private final ToggleButtonEIO stickyB;
|
||||
|
||||
boolean isAdvanced;
|
||||
boolean isStickyModeAvailable;
|
||||
final boolean isAdvanced;
|
||||
final boolean isStickyModeAvailable;
|
||||
|
||||
private IItemFilterContainer filterContainer;
|
||||
private ItemFilter filter;
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
@@ -58,8 +58,8 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
isAdvanced = filter.isAdvanced();
|
||||
|
||||
int butLeft = xOffset + 92;
|
||||
int x = butLeft ;
|
||||
int y = yOffset;
|
||||
int x = butLeft;
|
||||
int y = yOffset + 1;
|
||||
whiteListB = new IconButtonEIO(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
|
||||
whiteListB.setToolTip(Lang.localize("gui.conduit.item.whitelist"));
|
||||
|
||||
@@ -91,6 +91,15 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
useOreDictB.setUnselectedToolTip(Lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
}
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset+1, yOffset+1, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {
|
||||
@@ -98,9 +107,8 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
|
||||
@Override
|
||||
public void updateButtons() {
|
||||
|
||||
ItemFilter activeFilter = filter;
|
||||
|
||||
|
||||
if(isAdvanced) {
|
||||
useNbtB.onGuiInit();
|
||||
useNbtB.setSelected(activeFilter.isMatchNBT());
|
||||
|
||||
@@ -54,16 +54,16 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private String inputHeading;
|
||||
private String outputHeading;
|
||||
|
||||
private IconButtonEIO nextFilterB;
|
||||
private final IconButtonEIO nextFilterB;
|
||||
|
||||
private ToggleButtonEIO loopB;
|
||||
private ToggleButtonEIO roundRobinB;
|
||||
private final ToggleButtonEIO loopB;
|
||||
private final ToggleButtonEIO roundRobinB;
|
||||
|
||||
private IconButtonEIO priUpB;
|
||||
private IconButtonEIO priDownB;
|
||||
private final IconButtonEIO priUpB;
|
||||
private final IconButtonEIO priDownB;
|
||||
|
||||
private RedstoneModeButton rsB;
|
||||
private ColorButton colorB;
|
||||
private final RedstoneModeButton rsB;
|
||||
private final ColorButton colorB;
|
||||
|
||||
private ColorButton channelB;
|
||||
|
||||
@@ -74,9 +74,9 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private int priLeft;
|
||||
private int priWidth = 32;
|
||||
|
||||
private GuiToolTip priorityTooltip;
|
||||
private GuiToolTip speedUpgradeTooltip;
|
||||
private GuiToolTip filterUpgradeTooltip;
|
||||
private final GuiToolTip priorityTooltip;
|
||||
private final GuiToolTip speedUpgradeTooltip;
|
||||
private final GuiToolTip filterUpgradeTooltip;
|
||||
|
||||
private IItemFilterGui filterGui;
|
||||
|
||||
@@ -150,12 +150,10 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
priDownB.setSize(8, 8);
|
||||
|
||||
gui.getContainer().addFilterListener(new FilterChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onFilterChanged() {
|
||||
filtersChanged();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@@ -180,9 +178,12 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
}
|
||||
|
||||
private void updateGuiVisibility() {
|
||||
|
||||
deactivate();
|
||||
createFilterGUI();
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
private void createFilterGUI() {
|
||||
boolean showInput = false;
|
||||
boolean showOutput = false;
|
||||
|
||||
@@ -191,15 +192,10 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
showInput = true;
|
||||
} else if(mode == ConnectionMode.OUTPUT) {
|
||||
showOutput = true;
|
||||
|
||||
} else if(mode == ConnectionMode.IN_OUT) {
|
||||
|
||||
if(nextFilterB != null) {
|
||||
nextFilterB.onGuiInit();
|
||||
}
|
||||
nextFilterB.onGuiInit();
|
||||
showInput = inOutShowIn;
|
||||
showOutput = !inOutShowIn;
|
||||
|
||||
}
|
||||
|
||||
if(!showInput && !showOutput) {
|
||||
@@ -212,7 +208,6 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
gui.getContainer().setOutputSlotsVisible(false);
|
||||
if(activeFilter != null) {
|
||||
filterGui = getFilterGui(activeFilter, true);
|
||||
|
||||
}
|
||||
} else if(showOutput) {
|
||||
activeFilter = itemConduit.getOutputFilter(gui.getDir());
|
||||
@@ -223,54 +218,24 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
filterGui = getFilterGui(activeFilter, false);
|
||||
}
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
|
||||
}
|
||||
|
||||
private void filtersChanged() {
|
||||
if(filterGui != null) {
|
||||
filterGui.deactivate();
|
||||
filterGui = null;
|
||||
}
|
||||
deactiveFilterGUI();
|
||||
createFilterGUI();
|
||||
|
||||
ConnectionMode mode = con.getConnectionMode(gui.getDir());
|
||||
if(mode == ConnectionMode.DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showInput = mode == ConnectionMode.INPUT || (mode == ConnectionMode.IN_OUT && inOutShowIn);
|
||||
if(showInput) {
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
gui.getContainer().setInputSlotsVisible(true);
|
||||
gui.getContainer().setOutputSlotsVisible(false);
|
||||
|
||||
activeFilter = itemConduit.getInputFilter(gui.getDir());
|
||||
if(activeFilter != null) {
|
||||
filterGui = getFilterGui(activeFilter, true);
|
||||
}
|
||||
} else {
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
gui.getContainer().setInputSlotsVisible(false);
|
||||
gui.getContainer().setOutputSlotsVisible(true);
|
||||
|
||||
activeFilter = itemConduit.getOutputFilter(gui.getDir());
|
||||
if(activeFilter != null) {
|
||||
filterGui = getFilterGui(activeFilter, false);
|
||||
}
|
||||
|
||||
}
|
||||
if(filterGui != null) {
|
||||
filterGui.updateButtons();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IItemFilterGui getFilterGui(IItemFilter filter, boolean isInput) {
|
||||
//TODO: move to a factory
|
||||
if(filter instanceof ItemFilter) {
|
||||
ItemConduitFilterContainer cont = new ItemConduitFilterContainer(itemConduit, gui.getDir(), isInput);
|
||||
return new BasicItemFilterGui(gui, cont, !isInput);
|
||||
BasicItemFilterGui basicItemFilterGui = new BasicItemFilterGui(gui, cont, !isInput);
|
||||
basicItemFilterGui.createFilterSlots();
|
||||
return basicItemFilterGui;
|
||||
} else if(filter instanceof ExistingItemFilter) {
|
||||
return new ExistingItemFilterGui(gui, itemConduit, isInput);
|
||||
} else if(filter instanceof ModItemFilter) {
|
||||
@@ -329,7 +294,6 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
if(filterGui != null) {
|
||||
filterGui.updateButtons();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -343,37 +307,35 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(itemConduit, gui.getDir()));
|
||||
} else if(guiButton.id == ID_LOOP) {
|
||||
itemConduit.setSelfFeedEnabled(gui.getDir(), !itemConduit.isSelfFeedEnabled(gui.getDir()));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
sendFilterChange();
|
||||
} else if(guiButton.id == ID_ROUND_ROBIN) {
|
||||
itemConduit.setRoundRobinEnabled(gui.getDir(), !itemConduit.isRoundRobinEnabled(gui.getDir()));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
sendFilterChange();
|
||||
} else if(guiButton.id == ID_PRIORITY_UP) {
|
||||
itemConduit.setOutputPriority(gui.getDir(), itemConduit.getOutputPriority(gui.getDir()) + 1);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
sendFilterChange();
|
||||
} else if(guiButton.id == ID_PRIORITY_DOWN) {
|
||||
itemConduit.setOutputPriority(gui.getDir(), itemConduit.getOutputPriority(gui.getDir()) - 1);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
sendFilterChange();
|
||||
} else if(guiButton.id == ID_CHANNEL) {
|
||||
|
||||
DyeColor col = DyeColor.values()[channelB.getColorIndex()];
|
||||
boolean input;
|
||||
if(isInputVisible()) {
|
||||
col = DyeColor.values()[channelB.getColorIndex()];
|
||||
itemConduit.setInputColor(gui.getDir(), col);
|
||||
input = true;
|
||||
} else {
|
||||
itemConduit.setOutputColor(gui.getDir(), DyeColor.values()[channelB.getColorIndex()]);
|
||||
input = false;
|
||||
itemConduit.setOutputColor(gui.getDir(), col);
|
||||
}
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
sendFilterChange();
|
||||
}
|
||||
|
||||
if(filterGui != null) {
|
||||
filterGui.actionPerformed(guiButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sendFilterChange() {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemConduitFilter(itemConduit, gui.getDir()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {
|
||||
@@ -406,7 +368,6 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
FontRenderer fr = gui.getFontRenderer();
|
||||
String heading = getHeading();
|
||||
int headingWidth = fr.getStringWidth(heading);
|
||||
int x = 0;
|
||||
int rgb = ColorUtil.getRGB(Color.darkGray);
|
||||
fr.drawString(heading, left + x, top, rgb);
|
||||
@@ -433,7 +394,6 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
if(filterGui != null) {
|
||||
filterGui.renderCustomOptions(top, par1, par2, par3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -452,11 +412,15 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
gui.removeToolTip(speedUpgradeTooltip);
|
||||
gui.removeToolTip(filterUpgradeTooltip);
|
||||
channelB.detach();
|
||||
deactiveFilterGUI();
|
||||
}
|
||||
|
||||
private void deactiveFilterGUI() {
|
||||
if(filterGui != null) {
|
||||
filterGui.deactivate();
|
||||
filterGui = null;
|
||||
}
|
||||
gui.getGhostSlots().clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,13 +8,8 @@ import java.util.Map;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory.Target;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.util.BlockCoord;
|
||||
@@ -22,8 +17,6 @@ import crazypants.util.Lang;
|
||||
|
||||
public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IItemConduit> {
|
||||
|
||||
private long timeAtLastApply;
|
||||
|
||||
final List<NetworkedInventory> inventories = new ArrayList<NetworkedInventory>();
|
||||
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<BlockCoord, List<NetworkedInventory>>();
|
||||
|
||||
@@ -33,15 +26,8 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
|
||||
private boolean doingSend = false;
|
||||
|
||||
private final InnerTickHandler tickHandler = new InnerTickHandler();
|
||||
|
||||
public ItemConduitNetwork() {
|
||||
super(IItemConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IItemConduit> getBaseConduitType() {
|
||||
return IItemConduit.class;
|
||||
super(IItemConduit.class, IItemConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +132,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
for (NetworkedInventory source : invs) {
|
||||
|
||||
if(source.con.getLocation().equals(con.getLocation())) {
|
||||
if(source != null && source.sendPriority != null) {
|
||||
if(source.sendPriority != null) {
|
||||
for (Target t : source.sendPriority) {
|
||||
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
|
||||
if(input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
|
||||
@@ -174,38 +160,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isRemote(ItemConduit itemConduit) {
|
||||
World world = itemConduit.getBundle().getEntity().getWorldObj();
|
||||
if(world != null && world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
World world = conduit.getBundle().getEntity().getWorldObj();
|
||||
if(world == null) {
|
||||
return;
|
||||
}
|
||||
if(world.isRemote) {
|
||||
return;
|
||||
}
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if(curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
tickHandler.tick = world.getTotalWorldTime();
|
||||
ConduitNetworkTickHandler.instance.addListener(tickHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private void doTick(long tick) {
|
||||
|
||||
public void doNetworkTick() {
|
||||
for (NetworkedInventory ni : inventories) {
|
||||
if(requiresSort) {
|
||||
ni.updateInsertOrder();
|
||||
}
|
||||
ni.onTick(tick);
|
||||
ni.onTick();
|
||||
}
|
||||
requiresSort = false;
|
||||
|
||||
@@ -217,18 +178,4 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
|
||||
static int MAX_SLOT_CHECK_PER_TICK = 64;
|
||||
|
||||
private class InnerTickHandler implements TickListener {
|
||||
|
||||
long tick;
|
||||
|
||||
@Override
|
||||
public void tickStart(ServerTickEvent evt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(ServerTickEvent evt) {
|
||||
doTick(tick);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,10 +62,9 @@ public class ItemConduitRenderer extends DefaultConduitRenderer {
|
||||
Tessellator.instance.setColorOpaque_I(outChannel.getColor());
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, outTex, false);
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorOpaque_F(1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class ItemExtractSpeedUpgrade extends Item implements IResourceTooltipPro
|
||||
|
||||
private final IIcon[] icons;
|
||||
|
||||
public static ItemExtractSpeedUpgrade create() {
|
||||
public static ItemExtractSpeedUpgrade create() {
|
||||
ItemExtractSpeedUpgrade result = new ItemExtractSpeedUpgrade();
|
||||
result.init();
|
||||
return result;
|
||||
@@ -42,6 +42,7 @@ public class ItemExtractSpeedUpgrade extends Item implements IResourceTooltipPro
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, icons.length - 1);
|
||||
return icons[damage];
|
||||
@@ -62,6 +63,7 @@ public class ItemExtractSpeedUpgrade extends Item implements IResourceTooltipPro
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int j = 0; j < UPGRADES.length; ++j) {
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
|
||||
@@ -91,7 +91,7 @@ public class NetworkedInventory {
|
||||
return con.getOutputPriority(conDir);
|
||||
}
|
||||
|
||||
public void onTick(long tick) {
|
||||
public void onTick() {
|
||||
if(tickDeficit > 0 || !canExtract() || !con.isExtractionRedstoneConditionMet(conDir)) {
|
||||
//do nothing
|
||||
} else {
|
||||
|
||||
@@ -3,10 +3,8 @@ package crazypants.enderio.conduit.item.filter;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -14,6 +12,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
import crazypants.gui.GhostSlot;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class ExistingItemFilter implements IItemFilter {
|
||||
@@ -88,8 +87,7 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> getSlots(int xOffset, int yOffset) {
|
||||
return Collections.emptyList();
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,10 +4,10 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.gui.GhostSlot;
|
||||
|
||||
public interface IItemFilter {
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface IItemFilter {
|
||||
|
||||
boolean isSticky();
|
||||
|
||||
List<Slot> getSlots(int xOffset, int yOffset);
|
||||
void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb);
|
||||
|
||||
int getSlotCount();
|
||||
|
||||
|
||||
@@ -53,23 +53,25 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
|
||||
filter = new ItemFilter(true);
|
||||
}
|
||||
if(stack.stackTagCompound != null && stack.stackTagCompound.hasKey("filter")) {
|
||||
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
|
||||
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, 1);
|
||||
return icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
|
||||
|
||||
icons[0] = IIconRegister.registerIcon("enderio:filterUpgradeBasic");
|
||||
icons[1] = IIconRegister.registerIcon("enderio:filterUpgradeAdvanced");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,6 +82,7 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
par3List.add(new ItemStack(this, 1, j));
|
||||
@@ -88,18 +91,18 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
if(!TooltipAddera.instance.showAdvancedTooltips()) {
|
||||
par3List.add(Lang.localize("itemConduitFilterUpgrade"));
|
||||
TooltipAddera.instance.addShowDetailsTooltip(par3List);
|
||||
} else {
|
||||
par3List.add(EnumChatFormatting.ITALIC + Lang.localize("itemConduitFilterUpgrade.configured"));
|
||||
par3List.add(EnumChatFormatting.ITALIC + Lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
par3List.add(Lang.localize("itemConduitFilterUpgrade"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,9 +4,13 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -17,10 +21,6 @@ import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.gui.TooltipAddera;
|
||||
import crazypants.util.ItemUtil;
|
||||
import crazypants.util.Lang;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
|
||||
|
||||
@@ -76,6 +76,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:existingItemFilter");
|
||||
}
|
||||
@@ -84,7 +85,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
|
||||
public String getUnlocalizedNameForTooltip(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
@@ -16,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
import crazypants.gui.TemplateSlot;
|
||||
import crazypants.gui.GhostSlot;
|
||||
|
||||
public class ItemFilter implements IInventory, IItemFilter {
|
||||
|
||||
@@ -340,9 +339,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> getSlots(int xOffset, int yOffset) {
|
||||
List<Slot> result = new ArrayList<Slot>();
|
||||
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
int topY = yOffset;
|
||||
int leftX = xOffset;
|
||||
int index = 0;
|
||||
@@ -351,13 +348,12 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
for (int col = 0; col < 5; ++col) {
|
||||
int x = leftX + col * 18;
|
||||
int y = topY + row * 20;
|
||||
result.add(new TemplateSlot(this, index, x, y));
|
||||
slots.add(new ItemFilterGhostSlot(index, x, y, cb));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSlotCount() {
|
||||
return getSizeInventory();
|
||||
@@ -381,7 +377,31 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
// + sticky + ", items=" + Arrays.toString(items) + ", oreIds=" + Arrays.toString(oreIds) + ", isAdvanced=" + isAdvanced + "]";
|
||||
return "ItemFilter [isAdvanced=" + isAdvanced + ", items=" + Arrays.toString(items) + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ItemFilterGhostSlot extends GhostSlot {
|
||||
private final int slot;
|
||||
private final Runnable cb;
|
||||
|
||||
ItemFilterGhostSlot(int slot, int x, int y, Runnable cb) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.slot = slot;
|
||||
this.cb = cb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if(stack != null) {
|
||||
stack = stack.copy();
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
items[slot] = stack;
|
||||
cb.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return items[slot];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class ItemModItemFilter extends Item implements IItemFilterUpgrade, IReso
|
||||
|
||||
protected ItemModItemFilter() {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemModItemFilter.unlocalisedName);
|
||||
setUnlocalizedName(ModObject.itemModItemFilter.unlocalisedName);
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(64);
|
||||
}
|
||||
@@ -46,6 +46,7 @@ public class ItemModItemFilter extends Item implements IItemFilterUpgrade, IReso
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:modItemFilter");
|
||||
}
|
||||
@@ -54,15 +55,15 @@ public class ItemModItemFilter extends Item implements IItemFilterUpgrade, IReso
|
||||
public String getUnlocalizedNameForTooltip(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
if(TooltipAddera.instance.showAdvancedTooltips()) {
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if(FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
if(TooltipAddera.instance.showAdvancedTooltips()) {
|
||||
par3List.add(EnumChatFormatting.ITALIC + Lang.localize("itemConduitFilterUpgrade.configured"));
|
||||
par3List.add(EnumChatFormatting.ITALIC + Lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.gui.TooltipAddera;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -54,6 +44,7 @@ public class ItemPowerItemFilter extends Item implements IItemFilterUpgrade, IRe
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:filterUpgradePower");
|
||||
}
|
||||
|
||||
@@ -2,16 +2,15 @@ package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
import crazypants.gui.GhostSlot;
|
||||
|
||||
public class ModItemFilter implements IItemFilter {
|
||||
|
||||
@@ -91,8 +90,7 @@ public class ModItemFilter implements IItemFilter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> getSlots(int xOffset, int yOffset) {
|
||||
return Collections.emptyList();
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
import crazypants.gui.GhostSlot;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -80,8 +81,7 @@ public class PowerItemFilter implements IItemFilter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Slot> getSlots(int xOffset, int yOffset) {
|
||||
return Collections.emptyList();
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,18 +9,13 @@ public class AbstractTankConduitNetwork<T extends AbstractTankConduit> extends A
|
||||
protected boolean fluidTypeLocked = false;
|
||||
|
||||
protected AbstractTankConduitNetwork(Class<T> cl) {
|
||||
super(cl);
|
||||
super(cl, ILiquidConduit.class);
|
||||
}
|
||||
|
||||
public FluidStack getFluidType() {
|
||||
return liquidType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ILiquidConduit> getBaseConduitType() {
|
||||
return ILiquidConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(T con) {
|
||||
super.addConduit(con);
|
||||
|
||||
@@ -9,9 +9,6 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.FluidUtil;
|
||||
@@ -24,27 +21,16 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
|
||||
private Iterator<LiquidOutput> outputIterator;
|
||||
|
||||
private int ticksActiveUnsynced;
|
||||
|
||||
private boolean lastSyncedActive = false;
|
||||
|
||||
private int lastSyncedVolume = -1;
|
||||
|
||||
private long timeAtLastApply;
|
||||
|
||||
private final InnerTickHandler tickHandler = new InnerTickHandler();
|
||||
|
||||
private int ticksEmpty;
|
||||
|
||||
public AdvancedLiquidConduitNetwork() {
|
||||
super(AdvancedLiquidConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ILiquidConduit> getBaseConduitType() {
|
||||
return ILiquidConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(AdvancedLiquidConduit con) {
|
||||
tank.setCapacity(tank.getCapacity() + AdvancedLiquidConduit.CONDUIT_VOLUME);
|
||||
@@ -108,24 +94,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
World world = conduit.getBundle().getEntity().getWorldObj();
|
||||
if(world == null) {
|
||||
return;
|
||||
}
|
||||
if(world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if(curTime > 0 && curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
ConduitNetworkTickHandler.instance.addListener(tickHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doTick() {
|
||||
public void doNetworkTick() {
|
||||
if(liquidType == null || outputs.isEmpty() || !tank.containsValidLiquid() || tank.isEmpty()) {
|
||||
updateActiveState();
|
||||
return;
|
||||
@@ -172,7 +141,6 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
con.setActive(false);
|
||||
}
|
||||
lastSyncedActive = false;
|
||||
ticksActiveUnsynced = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -325,17 +293,4 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
setConduitVolumes();
|
||||
lastSyncedVolume = tank.getFluidAmount();
|
||||
}
|
||||
|
||||
private class InnerTickHandler implements TickListener {
|
||||
|
||||
@Override
|
||||
public void tickStart(ServerTickEvent evt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(ServerTickEvent evt) {
|
||||
doTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,12 +29,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
boolean filling;
|
||||
|
||||
public EnderLiquidConduitNetwork() {
|
||||
super(EnderLiquidConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ILiquidConduit> getBaseConduitType() {
|
||||
return ILiquidConduit.class;
|
||||
super(EnderLiquidConduit.class, ILiquidConduit.class);
|
||||
}
|
||||
|
||||
public void connectionChanged(EnderLiquidConduit con, ForgeDirection conDir) {
|
||||
|
||||
@@ -5,15 +5,10 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidConduit> {
|
||||
@@ -22,8 +17,6 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
super(LiquidConduit.class);
|
||||
}
|
||||
|
||||
private long timeAtLastApply;
|
||||
|
||||
private int ticksEmpty = 0;
|
||||
|
||||
private int maxFlowsPerTick = 10;
|
||||
@@ -31,7 +24,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
|
||||
private boolean printFlowTiming = false;
|
||||
|
||||
private int pushToken = 0;
|
||||
private int lastPushToken = 0;
|
||||
|
||||
private int inputVolume;
|
||||
|
||||
@@ -39,8 +32,6 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
|
||||
private boolean inputLocked = false;
|
||||
|
||||
private final InnerTickHandler tickHandler = new InnerTickHandler();
|
||||
|
||||
public boolean lockNetworkForFill() {
|
||||
if(inputLocked) {
|
||||
return false;
|
||||
@@ -54,24 +45,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
World world = conduit.getBundle().getEntity().getWorldObj();
|
||||
if(world == null) {
|
||||
return;
|
||||
}
|
||||
if(world.isRemote || liquidType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if(curTime > 0 && curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
ConduitNetworkTickHandler.instance.addListener(tickHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private void doTick() {
|
||||
|
||||
public void doNetworkTick() {
|
||||
List<LiquidConduit> cons = getConduits();
|
||||
if(cons == null || cons.isEmpty()) {
|
||||
return;
|
||||
@@ -114,7 +88,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
}
|
||||
|
||||
int getNextPushToken() {
|
||||
return ++pushToken;
|
||||
return ++lastPushToken;
|
||||
}
|
||||
|
||||
private boolean doFlow() {
|
||||
@@ -386,19 +360,6 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
this.bc = bc;
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class InnerTickHandler implements TickListener {
|
||||
|
||||
@Override
|
||||
public void tickStart(ServerTickEvent evt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(ServerTickEvent evt) {
|
||||
doTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,4 +13,6 @@ public interface IMEConduit extends IConduit {
|
||||
|
||||
boolean isDense();
|
||||
|
||||
int getChannelsInUse();
|
||||
|
||||
}
|
||||
@@ -12,11 +12,11 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AECableType;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
@@ -121,6 +121,18 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChannelsInUse() {
|
||||
int channelsInUse = 0;
|
||||
IGridNode node = getNode();
|
||||
if(node != null) {
|
||||
for (IGridConnection gc : node.getConnections()) {
|
||||
channelsInUse = Math.max(channelsInUse, gc.getUsedChannels());
|
||||
}
|
||||
}
|
||||
return channelsInUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public boolean canConnectToExternal(ForgeDirection dir, boolean ignoreDisabled) {
|
||||
@@ -128,15 +140,31 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
BlockCoord pos = getLocation();
|
||||
TileEntity te = world.getTileEntity(pos.x + dir.offsetX, pos.y + dir.offsetY, pos.z + dir.offsetZ);
|
||||
|
||||
if(te instanceof TileConduitBundle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// because the AE2 API doesn't allow an easy query like "which side can connect to an ME cable" it needs this mess
|
||||
if(te instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) te).getPart(dir.getOpposite());
|
||||
if(part == null) {
|
||||
part = ((IPartHost) te).getPart(ForgeDirection.UNKNOWN);
|
||||
return part != null;
|
||||
}
|
||||
return part.getExternalFacingNode() != null;
|
||||
if(part.getExternalFacingNode() != null) {
|
||||
return true;
|
||||
}
|
||||
String name = part.getClass().getSimpleName();
|
||||
return "PartP2PTunnelME".equals(name) || "PartQuartzFiber".endsWith(name) ||
|
||||
"PartToggleBus".equals(name) || "PartInvertedToggleBus".equals(name);
|
||||
} else if(te instanceof IGridHost) {
|
||||
return !(te instanceof TileConduitBundle) && ((IGridHost) te).getCableConnectionType(dir.getOpposite()) != AECableType.NONE;
|
||||
IGridNode node = ((IGridHost) te).getGridNode(dir.getOpposite());
|
||||
if(node == null) {
|
||||
node = ((IGridHost) te).getGridNode(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
if(node != null) {
|
||||
return node.getGridBlock().getConnectableSides().contains(dir.getOpposite());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||