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

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

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

import net.minecraft.class_1263;
import net.minecraft.class_1264;
import net.minecraft.class_1937;
import net.minecraft.class_2338;
import net.minecraft.class_2343;
import net.minecraft.class_2586;
import net.minecraft.class_2680;
import net.minecraft.class_3908;
import net.minecraft.class_4970;
import org.jetbrains.annotations.Nullable;

public abstract class WaterloggableRotatingBlockWithEntity extends WaterloggableRotatingBlock implements class_2343
{
	protected WaterloggableRotatingBlockWithEntity(class_4970.class_2251 settings)
	{
		super(settings);
	}

	@Override
	public boolean method_9592(class_2680 state, class_1937 world, class_2338 pos, int type, int data)
	{
		super.method_9592(state, world, pos, type, data);
		var blockEntity = world.method_8321(pos);
		return blockEntity != null && blockEntity.method_11004(type, data);
	}

	@Override
	@Nullable
	public class_3908 method_17454(class_2680 state, class_1937 world, class_2338 pos)
	{
		var blockEntity = world.method_8321(pos);
		return blockEntity instanceof class_3908 ? (class_3908)blockEntity : null;
	}

	@Override
	public void method_9536(class_2680 state, class_1937 world, class_2338 pos, class_2680 newState, boolean moved)
	{
		if (!state.method_27852(newState.method_26204()))
		{
			var blockEntity = world.method_8321(pos);
			if (blockEntity instanceof class_1263)
			{
				class_1264.method_5451(world, pos, (class_1263)blockEntity);
				world.method_8455(pos, this);
			}

			super.method_9536(state, world, pos, newState, moved);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy