generated from tilera/1710mod
chore: format code
This commit is contained in:
parent
6992b986ab
commit
994a09a2f2
5 changed files with 535 additions and 193 deletions
|
@ -52,7 +52,9 @@ public class ClassicCasting {
|
|||
|
||||
proxy.init();
|
||||
|
||||
ResearchTableExtensionRegistry.registerResearchTableExtension(ClassicResearchTableExtension.class, true);
|
||||
ResearchTableExtensionRegistry.registerResearchTableExtension(
|
||||
ClassicResearchTableExtension.class, true
|
||||
);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
|
|
@ -57,29 +57,65 @@ public class ItemResearchNotes extends Item {
|
|||
@SideOnly(value = Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamageForRenderPass(int par1, int renderPass) {
|
||||
return renderPass == 0 ? (par1 / 64 == 0 ? this.iconNote : this.iconDiscovery) : (par1 / 64 == 0 ? this.iconNoteOver : this.iconDiscoveryOver);
|
||||
return renderPass == 0
|
||||
? (par1 / 64 == 0 ? this.iconNote : this.iconDiscovery)
|
||||
: (par1 / 64 == 0 ? this.iconNoteOver : this.iconDiscoveryOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer player) {
|
||||
if (!par2World.isRemote && CCResearchManager.getData(stack).getTotalProgress() == 1.0f && !ResearchManager.isResearchComplete(player.getDisplayName(), CCResearchManager.getData((ItemStack)stack).key)) {
|
||||
if (ResearchManager.doesPlayerHaveRequisites(player.getDisplayName(), CCResearchManager.getData((ItemStack)stack).key)) {
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete(ResearchManager.getData((ItemStack)stack).key), (EntityPlayerMP)player);
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, CCResearchManager.getData(stack).key);
|
||||
String[] siblings = ResearchCategories.getResearch((String)ResearchManager.getData((ItemStack)stack).key).siblings;
|
||||
public ItemStack
|
||||
onItemRightClick(ItemStack stack, World par2World, EntityPlayer player) {
|
||||
if (!par2World.isRemote
|
||||
&& CCResearchManager.getData(stack).getTotalProgress() == 1.0f
|
||||
&& !ResearchManager.isResearchComplete(
|
||||
player.getDisplayName(), CCResearchManager.getData((ItemStack) stack).key
|
||||
)) {
|
||||
if (ResearchManager.doesPlayerHaveRequisites(
|
||||
player.getDisplayName(),
|
||||
CCResearchManager.getData((ItemStack) stack).key
|
||||
)) {
|
||||
PacketHandler.INSTANCE.sendTo(
|
||||
new PacketResearchComplete(
|
||||
ResearchManager.getData((ItemStack) stack).key
|
||||
),
|
||||
(EntityPlayerMP) player
|
||||
);
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(
|
||||
player, CCResearchManager.getData(stack).key
|
||||
);
|
||||
String[] siblings
|
||||
= ResearchCategories
|
||||
.getResearch(
|
||||
(String) ResearchManager.getData((ItemStack) stack).key
|
||||
)
|
||||
.siblings;
|
||||
if (siblings != null) {
|
||||
for (String s : siblings) {
|
||||
ResearchItem sibling = ResearchCategories.getResearch(s);
|
||||
if (s == null) continue;
|
||||
if (ResearchManager.isResearchComplete(player.getDisplayName(), sibling.key) || !ResearchManager.doesPlayerHaveRequisites(player.getDisplayName(), sibling.key)) continue;
|
||||
PacketHandler.INSTANCE.sendTo(new PacketResearchComplete(sibling.key), (EntityPlayerMP)player);
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, sibling.key);
|
||||
if (s == null)
|
||||
continue;
|
||||
if (ResearchManager.isResearchComplete(
|
||||
player.getDisplayName(), sibling.key
|
||||
)
|
||||
|| !ResearchManager.doesPlayerHaveRequisites(
|
||||
player.getDisplayName(), sibling.key
|
||||
))
|
||||
continue;
|
||||
PacketHandler.INSTANCE.sendTo(
|
||||
new PacketResearchComplete(sibling.key),
|
||||
(EntityPlayerMP) player
|
||||
);
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(
|
||||
player, sibling.key
|
||||
);
|
||||
}
|
||||
}
|
||||
--stack.stackSize;
|
||||
par2World.playSoundAtEntity(player, "thaumcraft.learn", 0.75f, 1.0f);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText(LanguageRegistry.instance().getStringLocalization("tc.discoveryerror")));
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
LanguageRegistry.instance().getStringLocalization("tc.discoveryerror")
|
||||
));
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
|
@ -93,7 +129,8 @@ public class ItemResearchNotes extends Item {
|
|||
md -= 64;
|
||||
}
|
||||
//TODO: WTF
|
||||
//return stack.getItemDamage() == 0 || par2 == 0 ? 0xFFFFFF : EnumTag.get((int)md).color;
|
||||
//return stack.getItemDamage() == 0 || par2 == 0 ? 0xFFFFFF :
|
||||
//EnumTag.get((int)md).color;
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
|
@ -110,20 +147,33 @@ public class ItemResearchNotes extends Item {
|
|||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return itemstack.getItemDamage() < 64 ? LanguageRegistry.instance().getStringLocalization("item.researchnotes.name") : LanguageRegistry.instance().getStringLocalization("item.discovery.name");
|
||||
return itemstack.getItemDamage() < 64
|
||||
? LanguageRegistry.instance().getStringLocalization("item.researchnotes.name")
|
||||
: LanguageRegistry.instance().getStringLocalization("item.discovery.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
public void addInformation(
|
||||
ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4
|
||||
) {
|
||||
if (CCResearchManager.getData(stack).getTotalProgress() >= 0.2f) {
|
||||
ResearchItem item = ResearchCategories.getResearch(ResearchManager.getData((ItemStack)stack).key);
|
||||
ResearchItem item = ResearchCategories.getResearch(
|
||||
ResearchManager.getData((ItemStack) stack).key
|
||||
);
|
||||
if (item != null)
|
||||
list.add(item.getName());
|
||||
} else {
|
||||
list.add(LanguageRegistry.instance().getStringLocalization("tc.discoveryunknown"));
|
||||
list.add(
|
||||
LanguageRegistry.instance().getStringLocalization("tc.discoveryunknown")
|
||||
);
|
||||
}
|
||||
if (stack.getItemDamage() < 64 && CCResearchManager.getData(stack).getTotalProgress() > 0.333332f) {
|
||||
list.add((int)(CCResearchManager.getData(stack).getTotalProgress() * 100.0f) + LanguageRegistry.instance().getStringLocalization("tc.discoveryprogress"));
|
||||
if (stack.getItemDamage() < 64
|
||||
&& CCResearchManager.getData(stack).getTotalProgress() > 0.333332f) {
|
||||
list.add(
|
||||
(int) (CCResearchManager.getData(stack).getTotalProgress() * 100.0f)
|
||||
+ LanguageRegistry.instance().getStringLocalization("tc.discoveryprogress"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,4 +181,3 @@ public class ItemResearchNotes extends Item {
|
|||
return itemstack.getItemDamage() < 64 ? EnumRarity.rare : EnumRarity.epic;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ import thaumcraft.common.config.ConfigItems;
|
|||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
public class CCResearchManager {
|
||||
|
||||
public static ItemStack createNote(ItemStack stack, String key) {
|
||||
ResearchItem research = ResearchCategories.getResearch(key);
|
||||
if (research == null) return null;
|
||||
if (research == null)
|
||||
return null;
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ public class CCResearchManager {
|
|||
return var1;
|
||||
}
|
||||
NBTTagCompound var3 = stack.stackTagCompound.getCompoundTag("tcr");
|
||||
if (!var3.hasKey("project") || !var3.hasKey("tags") || !var3.hasKey("progress") || !var3.hasKey("failed")) {
|
||||
if (!var3.hasKey("project") || !var3.hasKey("tags") || !var3.hasKey("progress")
|
||||
|| !var3.hasKey("failed")) {
|
||||
return var1;
|
||||
}
|
||||
|
||||
|
@ -67,8 +68,8 @@ public class CCResearchManager {
|
|||
busted = true;
|
||||
break;
|
||||
}
|
||||
if (!busted && var1.tags.length != ResearchList.getResearchTags(var1.key).length) {
|
||||
busted = true;
|
||||
if (!busted && var1.tags.length != ResearchList.getResearchTags(var1.key).length)
|
||||
{ busted = true;
|
||||
}
|
||||
if (busted) {
|
||||
byte[] tt = var1.tags;
|
||||
|
@ -87,7 +88,6 @@ public class CCResearchManager {
|
|||
}
|
||||
|
||||
public static void updateData(ItemStack stack, ResearchNoteData data) {
|
||||
|
||||
if (stack.stackTagCompound == null) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
@ -111,29 +111,47 @@ public class CCResearchManager {
|
|||
data.failedTags.writeToNBT(var3, "failed");
|
||||
}
|
||||
|
||||
public static void createResearchNoteForTable(ClassicResearchTableExtension table, String key) {
|
||||
if (table.getStackInSlot(5) == null && table.getStackInSlot(6) != null && table.getStackInSlot(6).isItemEqual(new ItemStack(Items.paper))) {
|
||||
public static void
|
||||
createResearchNoteForTable(ClassicResearchTableExtension table, String key) {
|
||||
if (table.getStackInSlot(5) == null && table.getStackInSlot(6) != null
|
||||
&& table.getStackInSlot(6).isItemEqual(new ItemStack(Items.paper))) {
|
||||
table.decrStackSize(6, 1);
|
||||
ResearchItem item = ResearchCategories.getResearch(key);
|
||||
//int md = ResearchList.getResearchPrimaryTag(key);
|
||||
int md = 0;
|
||||
table.setInventorySlotContents(5, CCResearchManager.createNote(new ItemStack(CCItems.researchNotes, 1, md), key));
|
||||
table.setInventorySlotContents(
|
||||
5,
|
||||
CCResearchManager.createNote(
|
||||
new ItemStack(CCItems.researchNotes, 1, md), key
|
||||
)
|
||||
);
|
||||
table.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static String findMatchingResearch(EntityPlayer player, Aspect[] tags, short[] tagAmounts) {
|
||||
public static String
|
||||
findMatchingResearch(EntityPlayer player, Aspect[] tags, short[] tagAmounts) {
|
||||
int bestMatchNum = 0;
|
||||
String bestMatch = null;
|
||||
for (ResearchCategoryList cat : ResearchCategories.researchCategories.values()) {
|
||||
for (ResearchItem research : cat.research.values()) {
|
||||
if (research.isStub() || research.isLost() || ResearchManager.isResearchComplete(player.getDisplayName(), research.key) || !ResearchManager.doesPlayerHaveRequisites(player.getDisplayName(), research.key)) continue;
|
||||
if (research.isStub() || research.isLost()
|
||||
|| ResearchManager.isResearchComplete(
|
||||
player.getDisplayName(), research.key
|
||||
)
|
||||
|| !ResearchManager.doesPlayerHaveRequisites(
|
||||
player.getDisplayName(), research.key
|
||||
))
|
||||
continue;
|
||||
int match = 0;
|
||||
for (int q = 0; q < 5; ++q) {
|
||||
if (tags[q] == null || tagAmounts[q] <= 0 || research.tags.getAmount(tags[q]) <= 0) continue;
|
||||
if (tags[q] == null || tagAmounts[q] <= 0
|
||||
|| research.tags.getAmount(tags[q]) <= 0)
|
||||
continue;
|
||||
++match;
|
||||
}
|
||||
if (match <= 0 || match <= bestMatchNum) continue;
|
||||
if (match <= 0 || match <= bestMatchNum)
|
||||
continue;
|
||||
bestMatchNum = match;
|
||||
bestMatch = research.key;
|
||||
}
|
||||
|
@ -141,41 +159,59 @@ public class CCResearchManager {
|
|||
return bestMatch;
|
||||
}
|
||||
|
||||
public static boolean progressTableResearch(World world, EntityPlayer researcher, ClassicResearchTableExtension table, ItemStack note, int baseChance, int baseLoss, Aspect[] inTags, short[] inTagAmounts) {
|
||||
public static boolean progressTableResearch(
|
||||
World world,
|
||||
EntityPlayer researcher,
|
||||
ClassicResearchTableExtension table,
|
||||
ItemStack note,
|
||||
int baseChance,
|
||||
int baseLoss,
|
||||
Aspect[] inTags,
|
||||
short[] inTagAmounts
|
||||
) {
|
||||
AspectList tags;
|
||||
String key;
|
||||
boolean progressed = false;
|
||||
if (baseLoss <= 0) {
|
||||
baseLoss = 1;
|
||||
}
|
||||
if (note.stackTagCompound == null && (key = CCResearchManager.findLostResearch(researcher)) != null) {
|
||||
if (note.stackTagCompound == null
|
||||
&& (key = CCResearchManager.findLostResearch(researcher)) != null) {
|
||||
note = CCResearchManager.createNote(note, key);
|
||||
}
|
||||
ResearchNoteData data = CCResearchManager.getData(note);
|
||||
ResearchItem research = ResearchCategories.getResearch(data.key);
|
||||
if (research == null) return false;
|
||||
if (research == null)
|
||||
return false;
|
||||
if ((tags = research.tags.copy()) != null) {
|
||||
boolean found;
|
||||
for (Aspect tag : inTags) {
|
||||
if (tag == null) continue;
|
||||
if (tag == null)
|
||||
continue;
|
||||
found = false;
|
||||
for (Aspect entry : tags.getAspects()) {
|
||||
if (entry != tag) continue;
|
||||
if (entry != tag)
|
||||
continue;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (found || data.failedTags.getAmount(tag) >= 100) continue;
|
||||
data.failedTags.add(tag, Math.round((float)(2 + world.rand.nextInt(baseLoss)) / 10.0f));
|
||||
if (found || data.failedTags.getAmount(tag) >= 100)
|
||||
continue;
|
||||
data.failedTags.add(
|
||||
tag, Math.round((float) (2 + world.rand.nextInt(baseLoss)) / 10.0f)
|
||||
);
|
||||
}
|
||||
for (Aspect tag : tags.getAspects()) {
|
||||
found = false;
|
||||
int entry;
|
||||
for (entry = 0; entry < inTags.length; ++entry) {
|
||||
if (inTags[entry] != tag) continue;
|
||||
if (inTags[entry] != tag)
|
||||
continue;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (!found) continue;
|
||||
if (!found)
|
||||
continue;
|
||||
float chance = (float) baseChance / 100.0f;
|
||||
int tries = CCResearchManager.researchIterations(inTagAmounts[entry]);
|
||||
if (tries == 0) {
|
||||
|
@ -183,8 +219,11 @@ public class CCResearchManager {
|
|||
chance = (float) baseChance / 2.0f;
|
||||
}
|
||||
for (int a = 0; a < tries; ++a) {
|
||||
if (!(world.rand.nextFloat() <= chance)) continue;
|
||||
if (data.tags.getAmount(tag) <= 0 || data.progress.get(tag) >= research.tags.getAmount(tag)) break;
|
||||
if (!(world.rand.nextFloat() <= chance))
|
||||
continue;
|
||||
if (data.tags.getAmount(tag) <= 0
|
||||
|| data.progress.get(tag) >= research.tags.getAmount(tag))
|
||||
break;
|
||||
data.progress.put(tag, data.progress.get(tag) + 1);
|
||||
chance *= 0.9f;
|
||||
progressed = true;
|
||||
|
@ -193,7 +232,8 @@ public class CCResearchManager {
|
|||
}
|
||||
CCResearchManager.updateData(note, data);
|
||||
} else {
|
||||
table.contents[5] = new ItemStack(ConfigItems.itemResource, 7 + world.rand.nextInt(3), 9);
|
||||
table.contents[5]
|
||||
= new ItemStack(ConfigItems.itemResource, 7 + world.rand.nextInt(3), 9);
|
||||
}
|
||||
return progressed;
|
||||
}
|
||||
|
@ -207,12 +247,20 @@ public class CCResearchManager {
|
|||
ArrayList<String> choices = new ArrayList<String>();
|
||||
for (ResearchCategoryList cat : ResearchCategories.researchCategories.values()) {
|
||||
for (ResearchItem research : cat.research.values()) {
|
||||
if (research.isStub() || !research.isLost() || ResearchManager.isResearchComplete(player.getDisplayName(), research.key) || !ResearchManager.doesPlayerHaveRequisites(player.getDisplayName(), research.key)) continue;
|
||||
if (research.isStub() || !research.isLost()
|
||||
|| ResearchManager.isResearchComplete(
|
||||
player.getDisplayName(), research.key
|
||||
)
|
||||
|| !ResearchManager.doesPlayerHaveRequisites(
|
||||
player.getDisplayName(), research.key
|
||||
))
|
||||
continue;
|
||||
choices.add(research.key);
|
||||
}
|
||||
}
|
||||
if (choices.size() > 0) {
|
||||
bestMatch = (String)choices.get(player.worldObj.rand.nextInt(choices.size()));
|
||||
bestMatch
|
||||
= (String) choices.get(player.worldObj.rand.nextInt(choices.size()));
|
||||
}
|
||||
return bestMatch;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ import thaumcraft.api.aspects.AspectList;
|
|||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
|
||||
public class ClassicResearchTableExtension extends ResearchTableExtension implements IInventory {
|
||||
|
||||
public class ClassicResearchTableExtension
|
||||
extends ResearchTableExtension implements IInventory {
|
||||
public ItemStack[] contents = new ItemStack[7];
|
||||
public EntityPlayer researcher = null;
|
||||
public boolean safe = true;
|
||||
|
@ -55,7 +55,8 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
nbt.setBoolean("Safe", this.safe);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < this.contents.length; ++var3) {
|
||||
if (this.contents[var3] == null) continue;
|
||||
if (this.contents[var3] == null)
|
||||
continue;
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
this.contents[var3].writeToNBT(var4);
|
||||
|
@ -72,7 +73,8 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
int var5 = var4.getByte("Slot") & 0xFF;
|
||||
if (var5 < 0 || var5 >= this.contents.length) continue;
|
||||
if (var5 < 0 || var5 >= this.contents.length)
|
||||
continue;
|
||||
this.contents[var5] = ItemStack.loadItemStackFromNBT((NBTTagCompound) var4);
|
||||
}
|
||||
}
|
||||
|
@ -121,18 +123,41 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
amounts[n] = (short) (amounts[n] + Math.round(this.tagBonus[a]));
|
||||
}
|
||||
if (this.contents[5] == null) {
|
||||
String key = CCResearchManager.findMatchingResearch(this.researcher, this.tags, amounts);
|
||||
String key = CCResearchManager.findMatchingResearch(
|
||||
this.researcher, this.tags, amounts
|
||||
);
|
||||
if (key != null) {
|
||||
CCResearchManager.createResearchNoteForTable(this, key);
|
||||
if (this.contents[5] != null) {
|
||||
CCResearchManager.progressTableResearch(this.world, this.researcher, this, this.contents[5], this.baseChance, this.baseLoss, this.tags, amounts);
|
||||
if (CCResearchManager.getData(this.contents[5]).getTotalProgress() == 1.0f) {
|
||||
this.contents[5].setItemDamage(this.contents[5].getItemDamage() + 64);
|
||||
CCResearchManager.progressTableResearch(
|
||||
this.world,
|
||||
this.researcher,
|
||||
this,
|
||||
this.contents[5],
|
||||
this.baseChance,
|
||||
this.baseLoss,
|
||||
this.tags,
|
||||
amounts
|
||||
);
|
||||
if (CCResearchManager.getData(this.contents[5]).getTotalProgress()
|
||||
== 1.0f) {
|
||||
this.contents[5].setItemDamage(
|
||||
this.contents[5].getItemDamage() + 64
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.contents[5].getItem() == CCItems.researchNotes && this.contents[5].getItemDamage() < 64) {
|
||||
CCResearchManager.progressTableResearch(this.world, this.researcher, this, this.contents[5], this.baseChance, this.baseLoss, this.tags, amounts);
|
||||
CCResearchManager.progressTableResearch(
|
||||
this.world,
|
||||
this.researcher,
|
||||
this,
|
||||
this.contents[5],
|
||||
this.baseChance,
|
||||
this.baseLoss,
|
||||
this.tags,
|
||||
amounts
|
||||
);
|
||||
if (CCResearchManager.getData(this.contents[5]).getTotalProgress() == 1.0f) {
|
||||
this.contents[5].setItemDamage(this.contents[5].getItemDamage() + 64);
|
||||
}
|
||||
|
@ -141,14 +166,23 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
}
|
||||
|
||||
public void startResearch() {
|
||||
this.world.playSoundEffect((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "random.click", 0.15f, 0.8f);
|
||||
this.world.playSoundEffect(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
"random.click",
|
||||
0.15f,
|
||||
0.8f
|
||||
);
|
||||
if (!this.world.isRemote) {
|
||||
this.doResearch();
|
||||
int chance = this.baseLoss;
|
||||
for (int a = 0; a < 5; ++a) {
|
||||
if (this.contents[a] == null || this.world.rand.nextInt(100) >= chance) continue;
|
||||
if (this.contents[a] == null || this.world.rand.nextInt(100) >= chance)
|
||||
continue;
|
||||
--this.contents[a].stackSize;
|
||||
if (this.contents[a].stackSize != 0) continue;
|
||||
if (this.contents[a].stackSize != 0)
|
||||
continue;
|
||||
this.contents[a] = null;
|
||||
}
|
||||
}
|
||||
|
@ -159,12 +193,20 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
public void toggleSafe() {
|
||||
this.safe = !this.safe;
|
||||
this.recalcBaseChance();
|
||||
this.world.playSoundEffect((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "step.wood", 0.3f, 1.2f);
|
||||
this.world.playSoundEffect(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
"step.wood",
|
||||
0.3f,
|
||||
1.2f
|
||||
);
|
||||
}
|
||||
|
||||
public void gatherResults() {
|
||||
this.data = null;
|
||||
if (this.contents[5] != null && this.contents[5].getItem() instanceof ItemResearchNotes) {
|
||||
if (this.contents[5] != null
|
||||
&& this.contents[5].getItem() instanceof ItemResearchNotes) {
|
||||
this.data = CCResearchManager.getData(this.contents[5]);
|
||||
}
|
||||
}
|
||||
|
@ -184,9 +226,12 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
this.tags[a] = null;
|
||||
this.tagAmounts[a] = 0;
|
||||
this.tagBonus[a] = 0.0f;
|
||||
if (this.contents[a] == null) continue;
|
||||
if (this.contents[a] == null)
|
||||
continue;
|
||||
AspectList t = ThaumcraftCraftingManager.getObjectTags(this.contents[a]);
|
||||
if ((t = ThaumcraftCraftingManager.getBonusTags(this.contents[a], t)) == null || t.size() <= 0) continue;
|
||||
if ((t = ThaumcraftCraftingManager.getBonusTags(this.contents[a], t)) == null
|
||||
|| t.size() <= 0)
|
||||
continue;
|
||||
for (Aspect tag : t.getAspects()) {
|
||||
ot.merge(tag, t.getAmount(tag));
|
||||
}
|
||||
|
@ -195,7 +240,8 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
return;
|
||||
}
|
||||
ArrayList<Aspect> sortedTags = new ArrayList<Aspect>();
|
||||
block2: for (Aspect tag : ot.getAspects()) {
|
||||
block2:
|
||||
for (Aspect tag : ot.getAspects()) {
|
||||
if (sortedTags.size() == 0) {
|
||||
sortedTags.add(tag);
|
||||
continue;
|
||||
|
@ -205,7 +251,9 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
continue;
|
||||
}
|
||||
for (int a = 1; a < sortedTags.size(); ++a) {
|
||||
if (ot.getAmount(tag) <= ot.getAmount((Aspect)((Object)sortedTags.get(a)))) continue;
|
||||
if (ot.getAmount(tag)
|
||||
<= ot.getAmount((Aspect) ((Object) sortedTags.get(a))))
|
||||
continue;
|
||||
sortedTags.add(a, tag);
|
||||
continue block2;
|
||||
}
|
||||
|
@ -215,7 +263,8 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
for (int a = 0; a < 5; ++a) {
|
||||
if (sortedTags.size() > a && sortedTags.get(a) != null) {
|
||||
this.tags[a] = sortedTags.get(a);
|
||||
this.tagAmounts[a] = (short)ot.getAmount((Aspect)((Object)sortedTags.get(a)));
|
||||
this.tagAmounts[a]
|
||||
= (short) ot.getAmount((Aspect) ((Object) sortedTags.get(a)));
|
||||
continue;
|
||||
}
|
||||
this.tags[a] = null;
|
||||
|
@ -227,10 +276,16 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
|
||||
private void recalculateBonus() {
|
||||
List<EntityLivingBase> ents;
|
||||
if (!this.world.isDaytime() && this.world.getBlockLightValue(this.xCoord, this.yCoord + 1, this.zCoord) < 4 && !this.world.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||
if (!this.world.isDaytime()
|
||||
&& this.world.getBlockLightValue(this.xCoord, this.yCoord + 1, this.zCoord)
|
||||
< 4
|
||||
&& !this.world.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[] { Aspect.DARKNESS }));
|
||||
}
|
||||
if (this.world.isDaytime() && this.world.getBlockLightValue(this.xCoord, this.yCoord + 1, this.zCoord) > 11 && this.world.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||
if (this.world.isDaytime()
|
||||
&& this.world.getBlockLightValue(this.xCoord, this.yCoord + 1, this.zCoord)
|
||||
> 11
|
||||
&& this.world.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[] { Aspect.LIGHT }));
|
||||
}
|
||||
if ((float) this.yCoord > (float) this.world.getActualHeight() * 0.5f) {
|
||||
|
@ -246,62 +301,120 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[] { Aspect.WEATHER }));
|
||||
}
|
||||
if (this.world.isThundering()) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.WEATHER, Aspect.ENERGY, Aspect.AIR}));
|
||||
this.incrementTagBonus(
|
||||
1.0f,
|
||||
Arrays.asList(new Aspect[] { Aspect.WEATHER, Aspect.ENERGY, Aspect.AIR })
|
||||
);
|
||||
}
|
||||
if ((ents = this.world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand(15.0, 15.0, 15.0))).size() > 0) {
|
||||
if ((ents = this.world.getEntitiesWithinAABB(
|
||||
EntityLivingBase.class,
|
||||
AxisAlignedBB
|
||||
.getBoundingBox(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
(double) (this.xCoord + 1),
|
||||
(double) (this.yCoord + 1),
|
||||
(double) (this.zCoord + 1)
|
||||
)
|
||||
.expand(15.0, 15.0, 15.0)
|
||||
))
|
||||
.size()
|
||||
> 0) {
|
||||
for (Object ent : ents) {
|
||||
try {
|
||||
if (((EntityLivingBase) ent).isAirBorne) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.FLIGHT}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.FLIGHT })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase)ent).getMaxHealth() - ((EntityLivingBase)ent).getHealth() > 0) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.FLESH}));
|
||||
if (((EntityLivingBase) ent).getMaxHealth()
|
||||
- ((EntityLivingBase) ent).getHealth()
|
||||
> 0) {
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.FLESH })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isEntityUndead()) {
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspect.DEATH, Aspects.EVIL}));
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.SOUL}));
|
||||
this.incrementTagBonus(
|
||||
0.3f,
|
||||
Arrays.asList(new Aspect[] { Aspect.DEATH, Aspects.EVIL })
|
||||
);
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.SOUL })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isPotionActive(Potion.poison)) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.POISON}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.POISON })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isPotionActive(Potion.regeneration)) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.HEAL}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.HEAL })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isPotionActive(Potion.resistance)) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.ARMOR}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.ARMOR })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isPotionActive(Potion.nightVision)) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspects.VISION}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspects.VISION })
|
||||
);
|
||||
}
|
||||
if (((EntityLivingBase) ent).isPotionActive(Potion.confusion)) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspects.FLUX}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspects.FLUX })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntitySpider) {
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspects.INSECT}));
|
||||
this.incrementTagBonus(
|
||||
0.3f, Arrays.asList(new Aspect[] { Aspects.INSECT })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntityAnimal) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.BEAST}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.BEAST })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntitySheep) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.CLOTH}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.CLOTH })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntityPlayer) {
|
||||
this.incrementTagBonus(0.4f, Arrays.asList(new Aspect[]{Aspects.CONTROL}));
|
||||
this.incrementTagBonus(
|
||||
0.4f, Arrays.asList(new Aspect[] { Aspects.CONTROL })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntityVillager) {
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspects.CONTROL}));
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.EXCHANGE}));
|
||||
this.incrementTagBonus(
|
||||
0.3f, Arrays.asList(new Aspect[] { Aspects.CONTROL })
|
||||
);
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.EXCHANGE })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntityGolem) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.ARMOR, Aspect.WEAPON}));
|
||||
this.incrementTagBonus(
|
||||
0.5f,
|
||||
Arrays.asList(new Aspect[] { Aspect.ARMOR, Aspect.WEAPON })
|
||||
);
|
||||
}
|
||||
if (ent instanceof EntityBlaze) {
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspect.FIRE}));
|
||||
this.incrementTagBonus(
|
||||
0.3f, Arrays.asList(new Aspect[] { Aspect.FIRE })
|
||||
);
|
||||
}
|
||||
if (!(ent instanceof EntityCreeper)) continue;
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspects.DESTRUCTION, Aspects.FLUX}));
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (!(ent instanceof EntityCreeper))
|
||||
continue;
|
||||
this.incrementTagBonus(
|
||||
0.3f,
|
||||
Arrays.asList(new Aspect[] { Aspects.DESTRUCTION, Aspects.FLUX })
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -309,184 +422,306 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
for (int x = -10; x <= 10; ++x) {
|
||||
for (int z = -10; z <= 10; ++z) {
|
||||
for (int y = -10; y <= 10; ++y) {
|
||||
if (y + this.yCoord <= 0 || y + this.yCoord >= this.world.getActualHeight()) continue;
|
||||
Block bi = this.world.getBlock(x + this.xCoord, y + this.yCoord, z + this.zCoord);
|
||||
int md = this.world.getBlockMetadata(x + this.xCoord, y + this.yCoord, z + this.zCoord);
|
||||
if (y + this.yCoord <= 0
|
||||
|| y + this.yCoord >= this.world.getActualHeight())
|
||||
continue;
|
||||
Block bi = this.world.getBlock(
|
||||
x + this.xCoord, y + this.yCoord, z + this.zCoord
|
||||
);
|
||||
int md = this.world.getBlockMetadata(
|
||||
x + this.xCoord, y + this.yCoord, z + this.zCoord
|
||||
);
|
||||
Material bm = bi.getMaterial();
|
||||
if (bi == Blocks.jukebox) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspects.SOUND}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspects.SOUND })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.beacon) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspects.CONTROL, Aspect.LIGHT}));
|
||||
this.incrementTagBonus(
|
||||
1.0f,
|
||||
Arrays.asList(new Aspect[] { Aspects.CONTROL, Aspect.LIGHT })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.skull) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.MIND, Aspects.EVIL}));
|
||||
this.incrementTagBonus(
|
||||
0.5f,
|
||||
Arrays.asList(new Aspect[] { Aspect.MIND, Aspects.EVIL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.anvil) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.CRAFT, Aspect.TOOL}));
|
||||
this.incrementTagBonus(
|
||||
0.5f,
|
||||
Arrays.asList(new Aspect[] { Aspect.CRAFT, Aspect.TOOL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.diamond_block) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.CRYSTAL, Aspects.VALUABLE}));
|
||||
this.incrementTagBonus(
|
||||
1.0f,
|
||||
Arrays.asList(new Aspect[] { Aspect.CRYSTAL,
|
||||
Aspects.VALUABLE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.glass_pane) {
|
||||
this.incrementTagBonus(0.1f, Arrays.asList(new Aspect[]{Aspects.VISION}));
|
||||
this.incrementTagBonus(
|
||||
0.1f, Arrays.asList(new Aspect[] { Aspects.VISION })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.glass) {
|
||||
this.incrementTagBonus(0.1f, Arrays.asList(new Aspect[]{Aspect.CRYSTAL}));
|
||||
this.incrementTagBonus(
|
||||
0.1f, Arrays.asList(new Aspect[] { Aspect.CRYSTAL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.red_flower) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspects.FLOWER}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspects.FLOWER })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.yellow_flower) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspects.FLOWER}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspects.FLOWER })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.log) {
|
||||
this.incrementTagBonus(0.1f, Arrays.asList(new Aspect[]{Aspect.TREE}));
|
||||
this.incrementTagBonus(
|
||||
0.1f, Arrays.asList(new Aspect[] { Aspect.TREE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.crafting_table) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.CRAFT, Aspect.TOOL}));
|
||||
this.incrementTagBonus(
|
||||
0.2f,
|
||||
Arrays.asList(new Aspect[] { Aspect.CRAFT, Aspect.TOOL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.stone_pressure_plate || bi == Blocks.wooden_pressure_plate) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.TRAP}));
|
||||
if (bi == Blocks.stone_pressure_plate
|
||||
|| bi == Blocks.wooden_pressure_plate) {
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.TRAP })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == ConfigBlocks.blockJar && md == 1) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.MIND, Aspects.EVIL}));
|
||||
this.incrementTagBonus(
|
||||
0.5f,
|
||||
Arrays.asList(new Aspect[] { Aspect.MIND, Aspects.EVIL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == ConfigBlocks.blockJar) {
|
||||
this.incrementTagBonus(0.33f, Arrays.asList(new Aspect[]{Aspect.TRAP}));
|
||||
this.incrementTagBonus(
|
||||
0.33f, Arrays.asList(new Aspect[] { Aspect.TRAP })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.iron_block) {
|
||||
this.incrementTagBonus(0.75f, Arrays.asList(new Aspect[]{Aspect.METAL}));
|
||||
this.incrementTagBonus(
|
||||
0.75f, Arrays.asList(new Aspect[] { Aspect.METAL })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.gold_block) {
|
||||
this.incrementTagBonus(0.75f, Arrays.asList(new Aspect[]{Aspects.VALUABLE}));
|
||||
this.incrementTagBonus(
|
||||
0.75f, Arrays.asList(new Aspect[] { Aspects.VALUABLE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.brown_mushroom_block || bi == Blocks.red_mushroom_block || bi == Blocks.brown_mushroom || bi == Blocks.red_mushroom) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspects.FUNGUS}));
|
||||
if (bi == Blocks.brown_mushroom_block
|
||||
|| bi == Blocks.red_mushroom_block || bi == Blocks.brown_mushroom
|
||||
|| bi == Blocks.red_mushroom) {
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspects.FUNGUS })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.bookshelf) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.MIND}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.MIND })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.mob_spawner) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.BEAST, Aspect.CRAFT, Aspect.TRAP}));
|
||||
this.incrementTagBonus(
|
||||
1.0f,
|
||||
Arrays.asList(new Aspect[] {
|
||||
Aspect.BEAST, Aspect.CRAFT, Aspect.TRAP })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.chest) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.VOID}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.VOID })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.farmland) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.CROP}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.CROP })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.end_portal_frame) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.ELDRITCH}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.ELDRITCH })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.ender_chest) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.VOID}));
|
||||
this.incrementTagBonus(
|
||||
1.0f, Arrays.asList(new Aspect[] { Aspect.VOID })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.lava) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.FIRE, Aspects.ROCK}));
|
||||
this.incrementTagBonus(
|
||||
0.2f,
|
||||
Arrays.asList(new Aspect[] { Aspect.FIRE, Aspects.ROCK })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.fire) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.FIRE}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.FIRE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.bedrock) {
|
||||
this.incrementTagBonus(0.1f, Arrays.asList(new Aspect[]{Aspect.DARKNESS, Aspects.ROCK, Aspect.EARTH}));
|
||||
this.incrementTagBonus(
|
||||
0.1f,
|
||||
Arrays.asList(new Aspect[] {
|
||||
Aspect.DARKNESS, Aspects.ROCK, Aspect.EARTH })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.deadbush) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.DEATH}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.DEATH })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.enchanting_table) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.MAGIC}));
|
||||
this.incrementTagBonus(
|
||||
1.0f, Arrays.asList(new Aspect[] { Aspect.MAGIC })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.water) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.WATER}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.WATER })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.redstone_wire) {
|
||||
this.incrementTagBonus(0.15f, Arrays.asList(new Aspect[]{Aspect.ENERGY, Aspect.MECHANISM}));
|
||||
this.incrementTagBonus(
|
||||
0.15f,
|
||||
Arrays.asList(new Aspect[] { Aspect.ENERGY, Aspect.MECHANISM }
|
||||
)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.unpowered_repeater || bi == Blocks.powered_repeater) {
|
||||
this.incrementTagBonus(0.25f, Arrays.asList(new Aspect[]{Aspect.ENERGY, Aspect.MECHANISM}));
|
||||
if (bi == Blocks.unpowered_repeater
|
||||
|| bi == Blocks.powered_repeater) {
|
||||
this.incrementTagBonus(
|
||||
0.25f,
|
||||
Arrays.asList(new Aspect[] { Aspect.ENERGY, Aspect.MECHANISM }
|
||||
)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.portal) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.ELDRITCH, Aspect.VOID}));
|
||||
this.incrementTagBonus(
|
||||
0.5f,
|
||||
Arrays.asList(new Aspect[] { Aspect.ELDRITCH, Aspect.VOID })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.cake) {
|
||||
this.incrementTagBonus(0.25f, Arrays.asList(new Aspect[]{Aspect.LIFE}));
|
||||
this.incrementTagBonus(
|
||||
0.25f, Arrays.asList(new Aspect[] { Aspect.LIFE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.web) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspects.INSECT}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspects.INSECT })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.tnt) {
|
||||
this.incrementTagBonus(0.25f, Arrays.asList(new Aspect[]{Aspects.DESTRUCTION, Aspect.FIRE}));
|
||||
this.incrementTagBonus(
|
||||
0.25f,
|
||||
Arrays.asList(new Aspect[] { Aspects.DESTRUCTION,
|
||||
Aspect.FIRE })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.piston) {
|
||||
this.incrementTagBonus(0.3f, Arrays.asList(new Aspect[]{Aspect.MECHANISM, Aspect.MOTION}));
|
||||
this.incrementTagBonus(
|
||||
0.3f,
|
||||
Arrays.asList(new Aspect[] { Aspect.MECHANISM, Aspect.MOTION }
|
||||
)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.emerald_block) {
|
||||
this.incrementTagBonus(1.0f, Arrays.asList(new Aspect[]{Aspect.MAGIC}));
|
||||
this.incrementTagBonus(
|
||||
1.0f, Arrays.asList(new Aspect[] { Aspect.MAGIC })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.dragonEgg) {
|
||||
this.incrementTagBonus(2.0f, Arrays.asList(new Aspect[]{Aspect.ELDRITCH, Aspects.EVIL, Aspect.MAGIC}));
|
||||
this.incrementTagBonus(
|
||||
2.0f,
|
||||
Arrays.asList(new Aspect[] {
|
||||
Aspect.ELDRITCH, Aspects.EVIL, Aspect.MAGIC })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.ice) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.COLD}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.COLD })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.plants) {
|
||||
this.incrementTagBonus(0.2f, Arrays.asList(new Aspect[]{Aspect.PLANT}));
|
||||
this.incrementTagBonus(
|
||||
0.2f, Arrays.asList(new Aspect[] { Aspect.PLANT })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bm == Material.redstoneLight) {
|
||||
this.incrementTagBonus(0.25f, Arrays.asList(new Aspect[]{Aspect.LIGHT}));
|
||||
this.incrementTagBonus(
|
||||
0.25f, Arrays.asList(new Aspect[] { Aspect.LIGHT })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.brewing_stand) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.MAGIC}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.MAGIC })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi == Blocks.cauldron) {
|
||||
this.incrementTagBonus(0.5f, Arrays.asList(new Aspect[]{Aspect.WATER}));
|
||||
this.incrementTagBonus(
|
||||
0.5f, Arrays.asList(new Aspect[] { Aspect.WATER })
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (bi != ConfigBlocks.blockMagicalLog || (md & 1) != 1) continue;
|
||||
this.incrementTagBonus(0.15f, Arrays.asList(new Aspect[]{Aspects.PURE}));
|
||||
if (bi != ConfigBlocks.blockMagicalLog || (md & 1) != 1)
|
||||
continue;
|
||||
this.incrementTagBonus(
|
||||
0.15f, Arrays.asList(new Aspect[] { Aspects.PURE })
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +729,9 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
|
||||
private void incrementTagBonus(float amt, List<Aspect> taglist) {
|
||||
for (int a = 0; a < 5; ++a) {
|
||||
if (this.tags[a] == null || !taglist.contains(this.tags[a]) || !(this.tagBonus[a] + amt <= this.maxTagBonus)) continue;
|
||||
if (this.tags[a] == null || !taglist.contains(this.tags[a])
|
||||
|| !(this.tagBonus[a] + amt <= this.maxTagBonus))
|
||||
continue;
|
||||
int n = a;
|
||||
this.tagBonus[n] = this.tagBonus[n] + amt;
|
||||
}
|
||||
|
@ -560,7 +797,14 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1) {
|
||||
return this.world.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this.getResearchTable() ? false : var1.getDistanceSq((double)this.xCoord + 0.5, (double)this.yCoord + 0.5, (double)this.zCoord + 0.5) <= 64.0;
|
||||
return this.world.getTileEntity(this.xCoord, this.yCoord, this.zCoord)
|
||||
!= this.getResearchTable()
|
||||
? false
|
||||
: var1.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 64.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -569,8 +813,7 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
|
@ -581,5 +824,4 @@ public class ClassicResearchTableExtension extends ResearchTableExtension implem
|
|||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ public class ResearchNoteData {
|
|||
return 0.0f;
|
||||
}
|
||||
for (Aspect a : tags.getAspects()) {
|
||||
if (this.tags == null || tag != a) continue;
|
||||
if (this.tags == null || tag != a)
|
||||
continue;
|
||||
return (float) this.progress.get(a) / (float) rr.tags.getAmount(a);
|
||||
}
|
||||
return 0.0f;
|
||||
|
|
Loading…
Reference in a new issue