Skip to content

Commit 7f70b15

Browse files
authored
Merge pull request #922 from L-Lawlite/1.21.1
1.21.1
2 parents d347107 + 2f795d6 commit 7f70b15

39 files changed

+177
-196
lines changed

src/main/java/com/mrh0/createaddition/blocks/alternator/AlternatorBlock.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import net.minecraft.world.level.block.state.BlockState;
2020
import net.minecraft.world.phys.shapes.CollisionContext;
2121
import net.minecraft.world.phys.shapes.VoxelShape;
22+
import org.jetbrains.annotations.Nullable;
2223

2324
public class AlternatorBlock extends DirectionalKineticBlock implements IBE<AlternatorBlockEntity>, IRotate {
2425

@@ -28,7 +29,8 @@ public class AlternatorBlock extends DirectionalKineticBlock implements IBE<Alte
2829
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
2930
return ALTERNATOR_SHAPE.get(state.getValue(FACING));
3031
}
31-
32+
33+
@Nullable
3234
@Override
3335
public BlockState getStateForPlacement(BlockPlaceContext context) {
3436
Direction preferred = getPreferredFacing(context);
@@ -38,12 +40,7 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
3840
return defaultBlockState().setValue(FACING, preferred);
3941
}
4042

41-
@Override
42-
public boolean hideStressImpact() {
43-
return false;
44-
}
45-
46-
public AlternatorBlock(Properties properties) {
43+
public AlternatorBlock(Properties properties) {
4744
super(properties);
4845
}
4946

src/main/java/com/mrh0/createaddition/blocks/alternator/AlternatorBlockEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected Block getStressConfigKey() {
141141

142142
public void firstTick() {
143143
updateCache();
144-
};
144+
}
145145

146146
public void updateCache() {
147147
if (level == null) return;
@@ -153,7 +153,7 @@ public void updateCache() {
153153
getBlockPos().relative(side),
154154
side.getOpposite(),
155155
() -> !this.isRemoved(),
156-
() -> { invalidSides.add(side); }
156+
() -> invalidSides.add(side)
157157
));
158158
}
159159
}

src/main/java/com/mrh0/createaddition/blocks/alternator/AlternatorRenderer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.mrh0.createaddition.blocks.alternator;
22

33
import com.simibubi.create.AllPartialModels;
4-
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
54
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
65

76
import net.createmod.catnip.render.CachedBuffers;

src/main/java/com/mrh0/createaddition/blocks/cake/CACakeBlock.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package com.mrh0.createaddition.blocks.cake;
22

33
import net.minecraft.stats.Stats;
4-
import net.minecraft.world.InteractionHand;
54
import net.minecraft.world.InteractionResult;
6-
import net.minecraft.world.ItemInteractionResult;
75
import net.minecraft.world.entity.player.Player;
8-
import net.minecraft.world.item.ItemStack;
96
import net.minecraft.world.level.Level;
107
import net.minecraft.world.level.LevelAccessor;
118
import net.minecraft.world.level.block.CakeBlock;

src/main/java/com/mrh0/createaddition/blocks/connector/base/AbstractConnectorBlockEntity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public AbstractConnectorBlockEntity(BlockEntityType<?> blockEntityTypeIn, BlockP
5656
this.nodeCache = new IWireNode[getNodeCount()];
5757
}
5858

59+
@Nullable
5960
@Override
6061
public IEnergyStorage getEnergyStorage(@Nullable Direction direction) {
6162
if(isEnergyInput(direction) || isEnergyOutput(direction)) return internal;
@@ -396,7 +397,7 @@ public void updateExternalEnergyStorage() {
396397
getPos().relative(side),
397398
side.getOpposite(),
398399
() -> !this.isRemoved(), // validity check (because the cache might outlive the object it belongs to)
399-
() -> { externalStorageInvalid = true; } // invalidation listener
400+
() -> externalStorageInvalid = true // invalidation listener
400401
);
401402
}
402403

src/main/java/com/mrh0/createaddition/blocks/connector/base/ConnectorMode.java

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,24 @@ public String getSerializedName() {
2828
}
2929

3030
public ConnectorMode getNext() {
31-
switch (this) {
32-
//case Passive:
33-
// return None;
34-
case None:
35-
return Pull;
36-
case Pull:
37-
return Push;
38-
case Push:
39-
return None;
40-
}
41-
return None;
42-
}
31+
return switch (this) {
32+
//case Passive:
33+
// return None;
34+
case None -> Pull;
35+
case Pull -> Push;
36+
case Push -> None;
37+
default -> None;
38+
};
39+
}
4340

4441
public MutableComponent getTooltip() {
45-
switch (this) {
46-
case Passive:
47-
return Component.translatable("createaddition.tooltip.energy.passive");
48-
case None:
49-
return Component.translatable("createaddition.tooltip.energy.none");
50-
case Pull:
51-
return Component.translatable("createaddition.tooltip.energy.pull");
52-
case Push:
53-
return Component.translatable("createaddition.tooltip.energy.push");
54-
}
55-
return Component.translatable("createaddition.tooltip.energy.none");
56-
}
42+
return switch (this) {
43+
case Passive -> Component.translatable("createaddition.tooltip.energy.passive");
44+
case None -> Component.translatable("createaddition.tooltip.energy.none");
45+
case Pull -> Component.translatable("createaddition.tooltip.energy.pull");
46+
case Push -> Component.translatable("createaddition.tooltip.energy.push");
47+
};
48+
}
5749

5850
public boolean isActive() {
5951
return this == Push || this == Pull;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@ParametersAreNonnullByDefault
2+
@MethodsReturnNonnullByDefault
3+
package com.mrh0.createaddition.blocks.connector.base;
4+
5+
import net.minecraft.MethodsReturnNonnullByDefault;
6+
7+
import javax.annotation.ParametersAreNonnullByDefault;

src/main/java/com/mrh0/createaddition/blocks/creative_energy/CreativeEnergyBlockEntity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import net.minecraft.core.BlockPos;
88
import net.minecraft.core.Direction;
99
import net.minecraft.server.level.ServerLevel;
10-
import net.minecraft.world.level.block.entity.BlockEntity;
1110
import net.minecraft.world.level.block.entity.BlockEntityType;
1211
import net.minecraft.world.level.block.state.BlockState;
1312
import net.neoforged.neoforge.capabilities.BlockCapabilityCache;
@@ -57,7 +56,7 @@ public void tick() {
5756

5857
public void firstTick() {
5958
updateCache();
60-
};
59+
}
6160

6261
public void updateCache() {
6362
if (level == null) return;
@@ -69,7 +68,7 @@ public void updateCache() {
6968
getBlockPos().relative(side),
7069
side.getOpposite(),
7170
() -> !this.isRemoved(),
72-
() -> { invalidSides.add(side); }
71+
() -> invalidSides.add(side)
7372
));
7473
}
7574
}

src/main/java/com/mrh0/createaddition/blocks/digital_adapter/DigitalAdapterBlockEntity.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package com.mrh0.createaddition.blocks.digital_adapter;
22

3-
import com.mrh0.createaddition.CreateAddition;
4-
import com.mrh0.createaddition.compat.computercraft.DigitalAdapterPeripheral;
5-
import com.mrh0.createaddition.compat.computercraft.Peripherals;
6-
import com.mrh0.createaddition.index.CABlockEntities;
73
import com.simibubi.create.content.contraptions.bearing.MechanicalBearingBlockEntity;
84
import com.simibubi.create.content.contraptions.elevator.ElevatorPulleyBlockEntity;
95
import com.simibubi.create.content.contraptions.piston.MechanicalPistonBlockEntity;
@@ -19,10 +15,7 @@
1915
import net.minecraft.world.level.block.entity.BlockEntity;
2016
import net.minecraft.world.level.block.entity.BlockEntityType;
2117
import net.minecraft.world.level.block.state.BlockState;
22-
import net.neoforged.neoforge.capabilities.Capabilities;
23-
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
2418

25-
import javax.annotation.Nonnull;
2619
import java.util.ArrayList;
2720
import java.util.List;
2821

@@ -155,14 +148,14 @@ public SpeedGaugeBlockEntity getSpeedGauge(Direction dir) {
155148
public void setTargetSpeed(Direction dir, int speed) {
156149
SpeedControllerBlockEntity scte = getSpeedController(dir);
157150
if(scte == null) return;
158-
ISpeedControllerAdapter sts = (ISpeedControllerAdapter)((Object)scte);
151+
ISpeedControllerAdapter sts = (ISpeedControllerAdapter) scte;
159152
sts.setTargetSpeed(speed);
160153
}
161154

162155
public int getTargetSpeed(Direction dir) {
163156
SpeedControllerBlockEntity scte = getSpeedController(dir);
164157
if(scte == null) return 0;
165-
ISpeedControllerAdapter sts = (ISpeedControllerAdapter)((Object)scte);
158+
ISpeedControllerAdapter sts = (ISpeedControllerAdapter) scte;
166159
return sts.getTargetSpeed();
167160
}
168161
}

src/main/java/com/mrh0/createaddition/blocks/electric_motor/ElectricMotorBlock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import net.minecraft.world.level.block.state.properties.BooleanProperty;
2525
import net.minecraft.world.phys.shapes.CollisionContext;
2626
import net.minecraft.world.phys.shapes.VoxelShape;
27+
import org.jetbrains.annotations.Nullable;
2728

2829
public class ElectricMotorBlock extends DirectionalKineticBlock implements IBE<ElectricMotorBlockEntity> {
2930

@@ -47,6 +48,7 @@ public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos,
4748
return ELECTRIC_MOTOR_SHAPE.get(state.getValue(FACING));
4849
}
4950

51+
@Nullable
5052
@Override
5153
public BlockState getStateForPlacement(BlockPlaceContext context) {
5254
Direction preferred = getPreferredFacing(context);
@@ -85,7 +87,7 @@ public void setPowered(Level world, BlockPos pos, boolean powered) {
8587
}
8688

8789
@Override
88-
public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, Direction side) {
90+
public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos pos, @Nullable Direction side) {
8991
return true;
9092
}
9193

0 commit comments

Comments
 (0)