This commit is contained in:
drcrazy 2019-07-27 01:52:51 +03:00
parent 4e1dfa0018
commit a7de6b428a
3 changed files with 30 additions and 29 deletions

View file

@ -50,7 +50,10 @@ public class AlarmBlockEntity extends BlockEntity
}
public void rightClick() {
if (!world.isClient) {
if (world.isClient) {
return;
}
if (selectedSound < 3) {
selectedSound++;
} else {
@ -59,7 +62,6 @@ public class AlarmBlockEntity extends BlockEntity
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
}
}
// BlockEntity
@Override
@ -79,16 +81,16 @@ public class AlarmBlockEntity extends BlockEntity
super.fromTag(compound);
}
//TODO 1.13 seems to be gone?
// @Override
// public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) {
// return false;
// }
// ITickable
@Override
public void tick() {
if (!world.isClient && world.getTime() % 25 == 0 && world.isReceivingRedstonePower(getPos())) {
if (world.isClient()){
return;
}
if (world.getTime() % 25 != 0) {
return;
}
if (world.isReceivingRedstonePower(getPos())) {
BlockAlarm.setActive(true, world, pos);
switch (selectedSound) {
case 1:
@ -101,8 +103,7 @@ public class AlarmBlockEntity extends BlockEntity
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.ALARM_3, SoundCategory.BLOCKS, 4F, 1F);
break;
}
} else if (!world.isClient && world.getTime() % 25 == 0) {
} else {
BlockAlarm.setActive(false, world, pos);
}
}

View file

@ -149,13 +149,13 @@ public class CableBlockEntity extends BlockEntity
return;
}
Collections.shuffle(acceptors);
for (EnergyBlockEntity blockEntity : acceptors) {
acceptors.forEach(blockEntity -> {
double drain = Math.min(energy, transferRate);
if (drain > 0 && blockEntity.addEnergy(drain, true) > 0) {
double move = blockEntity.addEnergy(drain, false);
useEnergy(move, false);
}
}
});
}
// IListInfoProvider

View file

@ -89,7 +89,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override
public boolean canAcceptEnergy(Direction direction) {
if (IC2TransformersStyle == true){
if (IC2TransformersStyle){
return getFacingEnum() == direction;
}
return getFacingEnum() != direction;
@ -97,7 +97,7 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity
@Override
public boolean canProvideEnergy(Direction direction) {
if (IC2TransformersStyle == true){
if (IC2TransformersStyle){
return getFacingEnum() != direction;
}
return getFacing() == direction;