net.minecraft.client.gui.screen.ingame.HandledScreen Java Examples

The following examples show how to use net.minecraft.client.gui.screen.ingame.HandledScreen. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoTotemHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	IClientPlayerInteractionManager im = IMC.getInteractionManager();
	PlayerInventory inventory = MC.player.inventory;
	
	if(nextTickSlot != -1)
	{
		im.windowClick_PICKUP(nextTickSlot);
		nextTickSlot = -1;
	}
	
	ItemStack offhandStack = inventory.getStack(40);
	if(offhandStack.getItem() == Items.TOTEM_OF_UNDYING)
		return;
	
	if(MC.currentScreen instanceof HandledScreen
		&& !(MC.currentScreen instanceof AbstractInventoryScreen))
		return;
	
	for(int slot = 0; slot <= 36; slot++)
	{
		if(inventory.getStack(slot).getItem() != Items.TOTEM_OF_UNDYING)
			continue;
		
		int newTotemSlot = slot < 9 ? slot + 36 : slot;
		boolean offhandEmpty = offhandStack.isEmpty();
		
		im.windowClick_PICKUP(newTotemSlot);
		im.windowClick_PICKUP(45);
		
		if(!offhandEmpty)
			nextTickSlot = newTotemSlot;
		
		break;
	}
}
 
Example #2
Source File: MixinContainerScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = @At("RETURN"), method = "render")
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta, CallbackInfo info) {
	EventDrawContainer event = new EventDrawContainer(
			(HandledScreen<?>) MinecraftClient.getInstance().currentScreen, mouseX, mouseY, matrix); // hmm // hmm?
	BleachHack.eventBus.post(event);
	if (event.isCancelled()) info.cancel();
}
 
Example #3
Source File: EventDrawContainer.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public EventDrawContainer(HandledScreen<?> screen, int mX, int mY, MatrixStack matrix) {
	this.screen = screen;
	this.mouseX = mX;
	this.mouseY = mY;
	this.matrix = matrix;
}