Compare commits
No commits in common. "4360b0381a2e34ad50e39381be1e0f1bcdf0d379" and "a38a20d523199bba77f4d7eddb32d8be9ed7c900" have entirely different histories.
4360b0381a
...
a38a20d523
|
@ -7,7 +7,6 @@ import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.block.enums.WireConnection;
|
import net.minecraft.block.enums.WireConnection;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -25,7 +24,6 @@ import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldView;
|
|
||||||
|
|
||||||
public class GlowstoneWireBlock extends Block{
|
public class GlowstoneWireBlock extends Block{
|
||||||
// These are the states of the wires coming off our block
|
// These are the states of the wires coming off our block
|
||||||
|
@ -77,16 +75,6 @@ public class GlowstoneWireBlock extends Block{
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
|
||||||
BlockPos blockPos = pos.down();
|
|
||||||
BlockState blockState = world.getBlockState(blockPos);
|
|
||||||
return this.canRunOnTop(world, blockPos, blockState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canRunOnTop(BlockView world, BlockPos pos, BlockState floor) {
|
|
||||||
return floor.isSideSolidFullSquare(world, pos, Direction.UP) || floor.isOf(Blocks.HOPPER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||||
switch(rotation) {
|
switch(rotation) {
|
||||||
case CLOCKWISE_180:
|
case CLOCKWISE_180:
|
||||||
|
@ -122,36 +110,26 @@ public class GlowstoneWireBlock extends Block{
|
||||||
|
|
||||||
public void update(World world, BlockPos pos, BlockState state){
|
public void update(World world, BlockPos pos, BlockState state){
|
||||||
System.out.println("Update");
|
System.out.println("Update");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if I'm this,
|
// isnt system.out BUT will update neighors?
|
||||||
// then update all my neighbors
|
|
||||||
// then tell my neighbors to update all their neighbors (why?)
|
|
||||||
public void updateNeighbors(World world, BlockPos pos){
|
public void updateNeighbors(World world, BlockPos pos){
|
||||||
|
System.out.println("Update neighbors");
|
||||||
if (world.getBlockState(pos).isOf(this)) {
|
if (world.getBlockState(pos).isOf(this)) {
|
||||||
world.updateNeighborsAlways(pos, this);
|
world.updateNeighborsAlways(pos, this);
|
||||||
//Direction[] d = Direction.values();
|
Direction[] var3 = Direction.values();
|
||||||
//int dl = d.length;
|
int var4 = var3.length;
|
||||||
|
|
||||||
//for(int i = 0; i < dl; ++i) {
|
for(int var5 = 0; var5 < var4; ++var5) {
|
||||||
// Direction direction = d[i];
|
Direction direction = var3[var5];
|
||||||
// world.updateNeighborsAlways(pos.offset(direction), this);
|
world.updateNeighborsAlways(pos.offset(direction), this);
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify){
|
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify){
|
||||||
if (!world.isClient) {
|
System.out.println("Neighbor update");
|
||||||
if (state.canPlaceAt(world, pos)) {
|
|
||||||
this.update(world, pos, state);
|
|
||||||
} else {
|
|
||||||
dropStacks(state, world, pos);
|
|
||||||
world.removeBlock(pos, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class glowBlocks {
|
||||||
public static final Block GLOWSTONEWIRE = new GlowstoneWireBlock(FabricBlockSettings.of(Material.SUPPORTED).breakInstantly().noCollision().luminance(8));
|
public static final Block GLOWSTONEWIRE = new GlowstoneWireBlock(FabricBlockSettings.of(Material.SUPPORTED).breakInstantly().noCollision().luminance(8));
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.register(Registry.BLOCK, new Identifier("glowstonewire", "glowstone_wire"), GLOWSTONEWIRE);
|
Registry.register(Registry.BLOCK, new Identifier("glowstonedust", "glowstone_wire"), GLOWSTONEWIRE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@ import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public class glowItems {
|
public class glowItems {
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.register(Registry.ITEM, new Identifier("glowstonewire", "glowstone_wire"), new BlockItem(glowBlocks.GLOWSTONEWIRE, new FabricItemSettings().group(ItemGroup.MISC)));
|
Registry.register(Registry.ITEM, new Identifier("glowstonedust", "glowstone_wire"), new BlockItem(glowBlocks.GLOWSTONEWIRE, new FabricItemSettings().group(ItemGroup.MISC)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue