Ring of loki improvement (#25)

* fix deps

* make ring trigger block activation

* remove runtime dep

* AdReSs ReVieW
This commit is contained in:
Батьків Нестор-Євген Васильович authored and GitHub committed 2023-04-24 20:24:17 +02:00
1 parent 391406e1de
commit 876b18328d
2 files changed
+28 -6

No files matched your search

+4 -3
View File
@@ -5,13 +5,14 @@ dependencies {
compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.0:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.11.13-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.2.7-GTNH:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:api') {transitive=false}
compile('com.github.GTNewHorizons:GTNHLib:0.0.4:dev')
compile('com.github.GTNewHorizons:GTNHLib:0.0.13:dev')
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
}
@@ -12,7 +12,6 @@ package vazkii.botania.common.item.relic;
import java.util.ArrayList;
import java.util.List;
import com.gtnewhorizon.gtnhlib.GTNHLib;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -62,6 +61,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
private static final String TAG_Y_ORIGIN = "yOrigin";
private static final String TAG_Z_ORIGIN = "zOrigin";
private static final String TAG_MODE = "mode";
private Boolean recursion = false;
public ItemLokiRing() {
super(LibItemNames.LOKI_RING);
@@ -70,6 +70,8 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
if(recursion) return;
EntityPlayer player = event.entityPlayer;
ItemStack lokiRing = getLokiRing(player);
if(lokiRing == null || player.worldObj.isRemote)
@@ -126,19 +128,38 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
}
}
} else if(heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && isRingEnabled(lokiRing)) {
recursion = true;
for(ChunkCoordinates cursor : cursors) {
int x = lookPos.blockX + cursor.posX;
int y = lookPos.blockY + cursor.posY;
int z = lookPos.blockZ + cursor.posZ;
Item item = heldItemStack.getItem();
if(!player.worldObj.isAirBlock(x, y, z) && ManaItemHandler.requestManaExact(lokiRing, player, cost, true)) {
item.onItemUse(player.capabilities.isCreativeMode ? heldItemStack.copy() : heldItemStack, player, player.worldObj, x, y, z, lookPos.sideHit, (float) lookPos.hitVec.xCoord - x, (float) lookPos.hitVec.yCoord - y, (float) lookPos.hitVec.zCoord - z);
if(heldItemStack.stackSize == 0) {
float hitX = (float) (lookPos.hitVec.xCoord - lookPos.blockX);
float hitY = (float) (lookPos.hitVec.yCoord - lookPos.blockY);
float hitZ = (float) (lookPos.hitVec.zCoord - lookPos.blockZ);
Block markedBlock = player.worldObj.getBlock(x, y, z);
Boolean wasActivated = markedBlock.onBlockActivated(player.worldObj, x, y, z, player, lookPos.sideHit, hitX,hitY,hitZ);
if (heldItemStack.stackSize == 0 ) {
event.setCanceled(true);
recursion = false;
return;
}
if (!wasActivated) {
item.onItemUse(player.capabilities.isCreativeMode ? heldItemStack.copy() : heldItemStack, player, player.worldObj, x, y, z, lookPos.sideHit, (float) lookPos.hitVec.xCoord - x, (float) lookPos.hitVec.yCoord - y, (float) lookPos.hitVec.zCoord - z);
if(heldItemStack.stackSize == 0) {
event.setCanceled(true);
recursion = false;
return;
}
}
}
}
recursion = false;
}
}
public static void setMode(ItemStack stack, boolean state) {