minor adjustments and fixes and cleaned imports

This commit is contained in:
Ella Paws 2022-02-07 04:50:22 +01:00
parent 78570dcc55
commit 2130c637fb
8 changed files with 33 additions and 49 deletions

View File

@ -1,11 +1,16 @@
package ella.techia;
import ella.techia.registry.TechiaRegistry;
import ella.techia.screen.*;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public class TechiaClient implements ClientModInitializer {
@Override
public void onInitializeClient(){
ScreenRegistry.register(Techia.BOX_SCREEN_HANDLER, BoxScreen::new);
ScreenRegistry.register(TechiaRegistry.BOX_SCREEN_HANDLER, BoxScreen::new);
ScreenRegistry.register(TechiaRegistry.WORKBENCH_SCREEN_HANDLER, WorkbenchScreen::new);
ScreenRegistry.register(TechiaRegistry.SMELTER_SCREEN_HANDLER, SmelterScreen::new);
}
}

View File

@ -2,26 +2,10 @@ package ella.techia.block;
import ella.techia.leti.LetiNetwork;
import net.minecraft.block.*;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Connector extends LetiConnectable {

View File

@ -1,11 +1,9 @@
package ella.techia.block;
import net.minecraft.block.*;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
public class Inverter extends FacingLeti /*implements LetiBlock, Waterloggable*/ {

View File

@ -2,26 +2,18 @@ package ella.techia.block;
import ella.techia.leti.LetiNetwork;
import net.minecraft.block.*;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public abstract class LetiConnectable extends Block implements LetiBlock, Waterloggable {

View File

@ -2,26 +2,13 @@ package ella.techia.block;
import ella.techia.leti.LetiNetwork;
import net.minecraft.block.*;
import net.minecraft.entity.ai.pathing.NavigationType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class LetiToggle extends LetiConnectable {
@ -42,11 +29,9 @@ public class LetiToggle extends LetiConnectable {
super.onUse(state, world, pos, player, hand, hit);
boolean pow = state.get(Properties.POWERED);
world.setBlockState(pos, state.with(Properties.POWERED, !pow));
// Will this play the sound for only the player? probably not what we want
world.playSound(player, pos, SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.BLOCKS, 0.3f, pow? 0.5f: 0.6f);
//world.playSound(pos.x, pos.y, pos.z, SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.BLOCKS, 0.3f, pow? 0.5f: 0.6f, true);
for(LetiNetwork network : LetiNetwork.findAdjacentNetworks()){
network.updateInputs(pow);
network.updateInputs();
}
return ActionResult.SUCCESS;
}

View File

@ -3,9 +3,13 @@ package ella.techia.block;
import ella.techia.block.entity.SmelterEntity;
import ella.techia.registry.TechiaRegistry;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.*;
//import net.minecraft.client.particle.ParticleManager
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.*;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
@ -17,6 +21,14 @@ public class Smelter extends BlockWithEntity {
public Smelter(net.minecraft.block.AbstractBlock.Settings settings){
super(settings);
this.setDefaultState(this.stateManager.getDefaultState().with(Properties.LIT, true));
// FIXME when lava can properly be inserted and taken out (whyever you'd do that), set default lit state to false!
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
super.appendProperties(builder);
builder.add(Properties.LIT);
}
@Override
@ -26,6 +38,7 @@ public class Smelter extends BlockWithEntity {
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
// TODO lava bucket
if(!world.isClient){
NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos);
@ -54,8 +67,14 @@ public class Smelter extends BlockWithEntity {
}
}
/*@Override
@Override
@Environment(CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random){
TODO particles and/or sound
}*/
if(state.get(Properties.LIT)){
if(random.nextFloat() < 0.005f)
world.playSound(null, pos, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.AMBIENT, 0.5f, 1f);
if(random.nextFloat() < 0.05f)
((ClientWorld)world).addParticle(ParticleTypes.SMOKE, (double)pos.getX() + 0.125 + random.nextDouble() * 0.75, (double)pos.getY() + 1.03, (double)pos.getZ() + 0.125 + random.nextDouble() * 0.75, 0, 0.02, 0.13, 0.02, 0.4d);
}
}
}

View File

@ -6,7 +6,6 @@ import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;

View File

@ -1,6 +1,8 @@
package ella.techia.leti;
import java.util.*;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map.Entry;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;