use of org.spongepowered.asm.mixin.injection.ModifyVariable in project roadrunner by MaxNeedsSnacks.
the class ChunkHolderMixin method createShortHashSet.
/**
* Using Hashsets instead of ArraySets for better worst-case performance
* The default case of just a few items may be very slightly slower
*/
@ModifyVariable(method = "markForBlockUpdate", at = @At(ordinal = 0, value = "FIELD", target = "Lnet/minecraft/server/world/ChunkHolder;blockUpdatesBySection:[Lit/unimi/dsi/fastutil/shorts/ShortSet;", shift = At.Shift.BEFORE))
private byte createShortHashSet(byte b) {
if (blockUpdatesBySection[b] == null) {
this.pendingBlockUpdates = true;
this.blockUpdatesBySection[b] = new ShortOpenHashSet();
}
return b;
}
use of org.spongepowered.asm.mixin.injection.ModifyVariable in project MasaGadget by plusls.
the class MixinRenderUtils method modifyInv.
@ModifyVariable(method = "renderInventoryOverlay", at = @At(value = "INVOKE", target = "Lfi/dy/masa/malilib/util/GuiUtils;getScaledWindowWidth()I", ordinal = 0, remap = false), ordinal = 0)
private static Inventory modifyInv(Inventory inv) {
Inventory ret = inv;
Entity traceEntity = TraceUtil.getTraceEntity();
if (Configs.Tweakeroo.INVENTORY_PREVIEW_SUPPORT_SHULKER_BOX_ITEM_ENTITY.getBooleanValue() && ret == null && traceEntity instanceof ItemEntity) {
ItemStack itemStack = ((ItemEntity) traceEntity).getStack();
Item item = itemStack.getItem();
NbtCompound invNbt = itemStack.getSubNbt("BlockEntityTag");
DefaultedList<ItemStack> stacks = DefaultedList.ofSize(27, ItemStack.EMPTY);
if (item instanceof BlockItem && ((BlockItem) item).getBlock() instanceof ShulkerBoxBlock) {
ret = new SimpleInventory(27);
if (invNbt != null) {
Inventories.readNbt(invNbt, stacks);
}
for (int i = 0; i < 27; ++i) {
ret.setStack(i, stacks.get(i));
}
}
}
return ret;
}
use of org.spongepowered.asm.mixin.injection.ModifyVariable in project Balm by ModdingForBlockheads.
the class LivingEntityMixin method modifyFallDamage.
@ModifyVariable(method = "causeFallDamage(FFLnet/minecraft/world/damagesource/DamageSource;)Z", at = @At("STORE"), ordinal = 0)
private int modifyFallDamage(int damage) {
LivingFallEvent event = currentFallEvent.get();
float effectiveDamage = damage;
if (event != null && event.getFallDamageOverride() != null) {
effectiveDamage = event.getFallDamageOverride();
}
return (int) effectiveDamage;
}
use of org.spongepowered.asm.mixin.injection.ModifyVariable in project Balm by ModdingForBlockheads.
the class MinecraftMixin method modifyScreen.
@ModifyVariable(method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", opcode = Opcodes.GETFIELD, shift = At.Shift.AFTER), argsOnly = true)
public Screen modifyScreen(Screen screen) {
OpenScreenEvent event = new OpenScreenEvent(screen);
Balm.getEvents().fireEvent(event);
return event.getScreen();
}
use of org.spongepowered.asm.mixin.injection.ModifyVariable in project Arclight by IzzelAliz.
the class RedstoneWireBlockMixin method arclight$blockRedstone.
@ModifyVariable(method = "updatePower", name = "l", index = 8, at = @At(value = "JUMP", ordinal = 0, opcode = Opcodes.IF_ICMPEQ))
public int arclight$blockRedstone(int l, World world, BlockPos pos, BlockState state) {
int i = state.get(RedstoneWireBlock.POWER);
if (i != l) {
BlockRedstoneEvent event = new BlockRedstoneEvent(CraftBlock.at(world, pos), i, l);
Bukkit.getPluginManager().callEvent(event);
return event.getNewCurrent();
}
return l;
}
Aggregations