claim bypass fix

This commit is contained in:
RubilaxXxx committed 2025-07-01 13:49:29 +02:00
1 parent 23e4f6760d
commit 1cf98f845c
12 files changed
+128 -11

No files matched your search

+1
View File
@@ -12,5 +12,6 @@ dependencies {
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.api.mana;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import vazkii.botania.api.internal.IManaBurst;
@@ -33,6 +34,11 @@ public interface ILensEffect {
*/
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack);
/**
* Player sensitive version of #collideBurst.
*/
boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player);
/**
* Called when a mana burst fired from a mana spreader with this focus is updated.
* This is called before the update is handled.
@@ -61,7 +61,7 @@ import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.EntityManaBurst.PositionProperties;
import vazkii.botania.common.lib.LibBlockNames;
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IRedirectable {
public class TileSpreader extends TileSimpleInventory implements IManaCollector, IWandBindable, IKeyLocked, IThrottledPacket, IManaSpreader, IRedirectable {
private static final int MAX_MANA = 1000;
private static final int ULTRA_MAX_MANA = 6400;
@@ -16,6 +16,10 @@ import java.util.List;
import java.util.Random;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
import cpw.mods.fml.common.launcher.Yggdrasil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockLeaves;
@@ -72,6 +76,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private static final String TAG_SHOOTER_UUID_MOST = "shooterUUIDMost";
private static final String TAG_SHOOTER_UUID_LEAST = "shooterUUIDLeast";
boolean fake = false;
final int dataWatcherEntries = 10;
@@ -81,6 +86,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
boolean fullManaLastTick = true;
EntityPlayer player;
UUID shooterIdentity = null;
int _ticksExisted = 0;
boolean scanBeam = false;
@@ -122,7 +128,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public EntityManaBurst(EntityPlayer player) {
this(player.worldObj);
this.player = player;
setBurstSourceCoords(0, -1, 0);
setLocationAndAngles(player.posX, player.posY + player.getEyeHeight(), player.posZ, player.rotationYaw + 180, -player.rotationPitch);
@@ -612,7 +618,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
ILensEffect lens = getLensInstance();
if(lens != null)
dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens());
dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens(), getPlayer());
if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ))
alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ));
@@ -665,7 +671,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
return tile;
}
public EntityPlayer getPlayer(){
return player;
}
@Override
protected float getGravityVelocity() {
return getGravity();
@@ -817,6 +825,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
public void setShooterUUID(UUID uuid) {
shooterIdentity = uuid;
}
@Override
@@ -197,6 +197,11 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
return false;
}
@Override
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player) {
return false;
}
@Override
public void updateBurst(IManaBurst burst, ItemStack stack) {
double speed = 0.35;
@@ -12,6 +12,7 @@ package vazkii.botania.common.item;
import java.awt.Color;
import java.util.List;
import java.util.UUID;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@@ -17,6 +17,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
@@ -25,6 +26,8 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.world.BlockEvent;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
@@ -48,13 +51,14 @@ public final class ToolCommons {
public static void removeBlocksInIteration(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int xs, int ys, int zs, int xe, int ye, int ze, Block block, Material[] materialsListing, boolean silk, int fortune, boolean dispose) {
float blockHardness = block == null ? 1F : block.getBlockHardness(world, x, y, z);
for(int x1 = xs; x1 < xe; x1++)
for(int y1 = ys; y1 < ye; y1++)
for(int z1 = zs; z1 < ze; z1++)
removeBlockWithDrops(player, stack, world, x1 + x, y1 + y, z1 + z, x, y, z, block, materialsListing, silk, fortune, blockHardness, dispose);
for (int x1 = xs; x1 < xe; x1++)
for (int y1 = ys; y1 < ye; y1++)
for (int z1 = zs; z1 < ze; z1++)
removeBlockWithDrops(player, stack, world, x1 + x, y1 + y, z1 + z, x, y, z, block, materialsListing, silk, fortune, blockHardness, dispose);
}
public static boolean isRightMaterial(Material material, Material[] materialsListing) {
for(Material mat : materialsListing)
if(material == mat)
@@ -76,7 +80,11 @@ public final class ToolCommons {
if(block != null && blk != block)
return;
if(!world.isRemote){
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world,((EntityPlayerMP)player).theItemInWorldManager.getGameType(),(EntityPlayerMP)player, x, y, z);
if(event.isCanceled())
return;
}
Material mat = world.getBlock(x, y, z).getMaterial();
if(!world.isRemote && blk != null && !blk.isAir(world, x, y, z) && blk.getPlayerRelativeBlockHardness(player, world, x, y, z) > 0) {
if(!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing))
@@ -100,6 +100,11 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect, I
return dead;
}
@Override
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player) {
return false;
}
@Override
public void updateBurst(IManaBurst burst, ItemStack stack) {
EntityThrowable entity = (EntityThrowable) burst;
@@ -237,6 +237,19 @@ public class ItemLens extends ItemMod implements ILensControl, ICompositableLens
return dead;
}
@Override
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player) {
EntityThrowable entity = (EntityThrowable) burst;
dead = getLens(stack.getItemDamage()).collideBurst(burst, entity, pos, isManaBlock, dead, stack, player);
ItemStack compositeLens = getCompositeLens(stack);
if(compositeLens != null && compositeLens.getItem() instanceof ILens)
dead = ((ILens) compositeLens.getItem()).collideBurst(burst, pos, isManaBlock, dead, compositeLens, player);
return dead;
}
@Override
public void updateBurst(IManaBurst burst, ItemStack stack) {
EntityThrowable entity = (EntityThrowable) burst;
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.item.lens;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
@@ -26,6 +27,9 @@ public class Lens {
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
return dead;
}
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player) {
return dead;
}
public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stack) {
// NO-OP
@@ -15,6 +15,8 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -22,6 +24,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.IManaBlock;
import vazkii.botania.common.block.ModBlocks;
@@ -82,5 +87,62 @@ public class LensMine extends Lens {
return dead;
}
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack, EntityPlayer player) {
World world = entity.worldObj;
int x = pos.blockX;
int y = pos.blockY;
int z = pos.blockZ;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
ItemStack composite = ((ItemLens) ModItems.lens).getCompositeLens(stack);
boolean warp = composite != null && composite.getItem() == ModItems.lens && composite.getItemDamage() == ItemLens.WARP;
if(warp && (block == ModBlocks.pistonRelay || block == Blocks.piston || block == Blocks.piston_extension || block == Blocks.piston_head))
return false;
int harvestLevel = ConfigHandler.harvestLevelBore;
TileEntity tile = world.getTileEntity(x, y, z);
float hardness = block.getBlockHardness(world, x, y, z);
int neededHarvestLevel = block.getHarvestLevel(meta);
int mana = burst.getMana();
ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
if((coords.posX != x || coords.posY != y || coords.posZ != z) && !(tile instanceof IManaBlock) && neededHarvestLevel <= harvestLevel && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) {
if(!world.isRemote) {
BlockEvent.BreakEvent breakEvent = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).theItemInWorldManager.getGameType(), (EntityPlayerMP) player, x, y, z);
if (breakEvent.isCanceled())
return false;
}
List<ItemStack> items = new ArrayList<>();
items.addAll(block.getDrops(world, x, y, z, meta, 0));
if(!burst.hasAlreadyCollidedAt(x, y, z)) {
if(!burst.isFake() && !entity.worldObj.isRemote) {
world.setBlockToAir(x, y, z);
if(ConfigHandler.blockBreakParticles)
entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
boolean offBounds = coords.posY < 0;
boolean doWarp = warp && !offBounds;
int dropX = doWarp ? coords.posX : x;
int dropY = doWarp ? coords.posY : y;
int dropZ = doWarp ? coords.posZ : z;
for(ItemStack stack_ : items)
world.spawnEntityInWorld(new EntityItem(world, dropX + 0.5, dropY + 0.5, dropZ + 0.5, stack_));
burst.setMana(mana - 24);
}
}
dead = false;
}
return dead;
}
}
@@ -51,6 +51,7 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.LokiCursor;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
@@ -94,7 +95,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
ItemStack stack = player.getCurrentEquippedItem();
if(stack == null) return;
Item item = player.getCurrentEquippedItem().getItem();
breakOnAllCursors(player, item, stack, x, y, z, side);
if(item instanceof ItemTerraPick)
return;
breakOnAllCursors(player, item, stack, x, y, z, side);
}