All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.parzivail.util.block.rotating.WaterloggableRotatingBlockWithGuiEntity Maven / Gradle / Ivy

There is a newer version: 0.0.114+1.20.2
Show newest version
package com.parzivail.util.block.rotating;

import java.util.function.BiFunction;
import net.minecraft.class_1268;
import net.minecraft.class_1269;
import net.minecraft.class_1657;
import net.minecraft.class_1937;
import net.minecraft.class_2338;
import net.minecraft.class_2586;
import net.minecraft.class_2680;
import net.minecraft.class_3965;

public class WaterloggableRotatingBlockWithGuiEntity extends WaterloggableRotatingBlockWithEntity
{
	private final BiFunction blockEntityBiFunction;

	public WaterloggableRotatingBlockWithGuiEntity(class_2251 settings, BiFunction blockEntityBiFunction)
	{
		super(settings);
		this.blockEntityBiFunction = blockEntityBiFunction;
	}

	@Override
	public class_2586 method_10123(class_2338 pos, class_2680 state)
	{
		if (!getBlockEntityUsePos(state, pos).equals(pos))
			return null;
		return blockEntityBiFunction.apply(pos, state);
	}

	protected class_2338 getBlockEntityUsePos(class_2680 state, class_2338 pos)
	{
		return pos;
	}

	@Override
	public class_1269 method_9534(class_2680 state, class_1937 world, class_2338 pos, class_1657 player, class_1268 hand, class_3965 hit)
	{
		if (world.field_9236)
			return class_1269.field_5812;
		else
		{
			player.method_17355(state.method_26196(world, getBlockEntityUsePos(state, pos)));
			return class_1269.field_21466;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy