com.parzivail.util.block.connecting.DelegatedConnectingBlock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pswg Show documentation
Show all versions of pswg Show documentation
Explore the galaxy with Galaxies: Parzi's Star Wars Mod!
package com.parzivail.util.block.connecting;
import Z;
import net.minecraft.class_1750;
import net.minecraft.class_1922;
import net.minecraft.class_1936;
import net.minecraft.class_2248;
import net.minecraft.class_2338;
import net.minecraft.class_2350;
import net.minecraft.class_2429;
import net.minecraft.class_2680;
import net.minecraft.class_2689;
import net.minecraft.class_4970;
public abstract class DelegatedConnectingBlock extends class_2429
{
protected DelegatedConnectingBlock(class_4970.class_2251 settings)
{
super(0.5f, settings);
this.method_9590(
this.field_10647.method_11664()
.method_11657(field_11332, false)
.method_11657(field_11335, false)
.method_11657(field_11331, false)
.method_11657(field_11328, false)
.method_11657(field_11327, false)
.method_11657(field_11330, false)
);
}
@Override
public class_2680 method_9605(class_1750 ctx)
{
return this.withConnectionProperties(ctx.method_8045(), ctx.method_8037());
}
public class_2680 withConnectionProperties(class_1922 world, class_2338 pos)
{
var self = this.method_9564();
return this.method_9564()
.method_11657(field_11330, shouldConnectTo(self, world.method_8320(pos.method_10074())))
.method_11657(field_11327, shouldConnectTo(self, world.method_8320(pos.method_10084())))
.method_11657(field_11332, shouldConnectTo(self, world.method_8320(pos.method_10095())))
.method_11657(field_11335, shouldConnectTo(self, world.method_8320(pos.method_10078())))
.method_11657(field_11331, shouldConnectTo(self, world.method_8320(pos.method_10072())))
.method_11657(field_11328, shouldConnectTo(self, world.method_8320(pos.method_10067())));
}
protected abstract boolean shouldConnectTo(class_2680 self, class_2680 other);
@Override
public class_2680 method_9559(class_2680 state, class_2350 direction, class_2680 newState, class_1936 world, class_2338 pos, class_2338 posFrom)
{
if (!state.method_26184(world, pos))
{
world.method_39279(pos, this, 1);
return super.method_9559(state, direction, newState, world, pos, posFrom);
}
else
{
// TODO: connections don't always work
var bl = shouldConnectTo(state, newState);
return state.method_11657(field_11329.get(direction), bl);
}
}
@Override
protected void method_9515(class_2689.class_2690 builder)
{
builder.method_11667(field_11332, field_11335, field_11331, field_11328, field_11327, field_11330);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy