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

com.magistuarmory.block.PaviseUpperCollisionBlock Maven / Gradle / Ivy

The newest version!
package com.magistuarmory.block;

import net.minecraft.class_1160;
import net.minecraft.class_1542;
import net.minecraft.class_1657;
import net.minecraft.class_1750;
import net.minecraft.class_1799;
import net.minecraft.class_1922;
import net.minecraft.class_1936;
import net.minecraft.class_1937;
import net.minecraft.class_2215;
import net.minecraft.class_2248;
import net.minecraft.class_2338;
import net.minecraft.class_238;
import net.minecraft.class_2586;
import net.minecraft.class_259;
import net.minecraft.class_265;
import net.minecraft.class_2680;
import net.minecraft.class_3614;
import net.minecraft.class_3726;
import net.minecraft.class_4970;
import org.jetbrains.annotations.NotNull;


public class PaviseUpperCollisionBlock extends class_2248
{
	static final class_238 COLLISION_AABB = new class_238(0.0 / 16.0, 0.0, 7.5 / 16.0, 1.0, 8.0 / 16.0, 8.5 / 16.0);

	public PaviseUpperCollisionBlock()
	{
		super(class_4970.class_2251.method_9637(class_3614.field_15932).method_9624());
	}

	@Override
	public class_2680 method_9605(class_1750 context)
	{
		return this.method_9564();
	}

	@Override
	public @NotNull class_1799 method_9574(class_1922 blockgetter, class_2338 blockpos, class_2680 blockstate)
	{
		if (blockgetter.method_8321(blockpos.method_10074()) instanceof PaviseBlockEntity pavise)
			return pavise.getItem();

		return class_1799.field_8037;
	}

	@Override
	public void method_33614(class_1937 level, class_1657 player, class_2338 blockPos, class_2680 blockstate)
	{

	}

	@Override
	public class_265 method_9530(class_2680 blockstate, class_1922 blockgetter, class_2338 blockpos, class_3726 context)
	{
		class_238 aabb = COLLISION_AABB;

		if (blockgetter.method_8321(blockpos.method_10074()) instanceof PaviseBlockEntity pavise)
		{
			class_2680 blockstate2 = pavise.method_11010();
			float yrot = -blockstate2.method_11654(class_2215.field_9924) * 360.0F / 16.0F;
			aabb = PaviseBlock.rotateAABB(aabb, class_1160.field_20705.method_23214(yrot));
		}

		return class_259.method_1078(aabb);
	}

	@Override
	public void method_9585(class_1936 accessor, class_2338 blockpos, class_2680 blockstate)
	{
		class_2586 blockentity = accessor.method_8321(blockpos.method_10074());
		if (blockentity instanceof PaviseBlockEntity pavise && pavise.method_10997() != null)
			accessor.method_8649(new class_1542(pavise.method_10997(), blockpos.method_10263() + 0.5, blockpos.method_10264() - 0.5, blockpos.method_10260() + 0.5, pavise.getItem()));

		if (accessor.method_8320(blockpos.method_10074()).method_26204() == ModBlocks.PAVISE.get())
			accessor.method_22352(blockpos.method_10074(), false);
		super.method_9585(accessor, blockpos, blockstate);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy