Compare commits

..

No commits in common. "4360b0381a2e34ad50e39381be1e0f1bcdf0d379" and "a38a20d523199bba77f4d7eddb32d8be9ed7c900" have entirely different histories.

3 changed files with 69 additions and 91 deletions

View File

@ -7,7 +7,6 @@ import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.enums.WireConnection;
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.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;
public class GlowstoneWireBlock extends Block{
// These are the states of the wires coming off our block
@ -77,16 +75,6 @@ public class GlowstoneWireBlock extends Block{
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) {
switch(rotation) {
case CLOCKWISE_180:
@ -122,36 +110,26 @@ public class GlowstoneWireBlock extends Block{
public void update(World world, BlockPos pos, BlockState state){
System.out.println("Update");
}
// Check if I'm this,
// then update all my neighbors
// then tell my neighbors to update all their neighbors (why?)
// isnt system.out BUT will update neighors?
public void updateNeighbors(World world, BlockPos pos){
System.out.println("Update neighbors");
if (world.getBlockState(pos).isOf(this)) {
world.updateNeighborsAlways(pos, this);
//Direction[] d = Direction.values();
//int dl = d.length;
Direction[] var3 = Direction.values();
int var4 = var3.length;
//for(int i = 0; i < dl; ++i) {
// Direction direction = d[i];
// world.updateNeighborsAlways(pos.offset(direction), this);
//}
for(int var5 = 0; var5 < var4; ++var5) {
Direction direction = var3[var5];
world.updateNeighborsAlways(pos.offset(direction), this);
}
}
}
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify){
if (!world.isClient) {
if (state.canPlaceAt(world, pos)) {
this.update(world, pos, state);
} else {
dropStacks(state, world, pos);
world.removeBlock(pos, false);
}
}
System.out.println("Neighbor update");
}
static {

View File

@ -11,7 +11,7 @@ public class glowBlocks {
public static final Block GLOWSTONEWIRE = new GlowstoneWireBlock(FabricBlockSettings.of(Material.SUPPORTED).breakInstantly().noCollision().luminance(8));
public static void init(){
Registry.register(Registry.BLOCK, new Identifier("glowstonewire", "glowstone_wire"), GLOWSTONEWIRE);
Registry.register(Registry.BLOCK, new Identifier("glowstonedust", "glowstone_wire"), GLOWSTONEWIRE);
}
}

View File

@ -8,6 +8,6 @@ import net.minecraft.util.registry.Registry;
public class glowItems {
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)));
};
}