Improve cigarette code and fix lamp inversion

This commit is contained in:
Andrew-71 2023-08-26 13:45:36 +03:00
parent 264099fef0
commit 57c72c08de
7 changed files with 12 additions and 16 deletions

View file

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 177 KiB

View file

Before

Width:  |  Height:  |  Size: 485 KiB

After

Width:  |  Height:  |  Size: 485 KiB

View file

Before

Width:  |  Height:  |  Size: 754 KiB

After

Width:  |  Height:  |  Size: 754 KiB

View file

Before

Width:  |  Height:  |  Size: 622 KiB

After

Width:  |  Height:  |  Size: 622 KiB

View file

@ -35,7 +35,7 @@ public class LampBlock extends Block implements Waterloggable {
public LampBlock(AbstractBlock.Settings settings) {
super(settings.luminance((BlockState state) -> {
if (!state.get(INVERTED)) {
if (state.get(INVERTED)) {
return state.get(ON) ? 12 : 0;
} else {
return state.get(ON) ? 0 : 12;

View file

@ -30,8 +30,8 @@ import su.a71.new_soviet.registration.NSE_Sounds;
import java.util.List;
import java.util.Objects;
public class CigaretteItem
extends Item {
// FIXME: 26.08.2023 This whole class is making my head hurt, fix!!!
public class CigaretteItem extends Item {
private final int durationInTicks;
private final Item returnedItem;
private final String local_tooltip;
@ -82,20 +82,18 @@ public class CigaretteItem
@Override
public void usageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks) {
user.setMovementSpeed(1.1f);
if (stack.getDamage() < durationInTicks - 1) {
stack.damage(1, user, e -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));}
if (stack.getDamage() < durationInTicks - 1)
stack.damage(1, user, e -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
double d = user.getX();
double e = user.getY() + user.getHeight();
double f = user.getZ();
if (NewSoviet.RANDOM.nextBetween(1, 2) == 1) {
float pitch = NewSoviet.RANDOM.nextBetween(8, 10) * 0.1f;
double d = user.getX();
double e = user.getY() + 1.5;
double f = user.getZ();
world.addParticle(ParticleTypes.SMOKE, d, e, f, 0, 0, 0);
float pitch = NewSoviet.RANDOM.nextBetween(8, 10) * 0.1f;
world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.SMOKING, SoundCategory.PLAYERS, 1.0f, pitch);
}
if (NewSoviet.RANDOM.nextBetween(1, 6) == 1) {
double d = user.getX();
double e = user.getY() + 1.5;
double f = user.getZ();
} else if (NewSoviet.RANDOM.nextBetween(1, 6) == 1) {
world.addParticle(ParticleTypes.LARGE_SMOKE, d, e, f, 0, 0, 0);
float pitch = NewSoviet.RANDOM.nextBetween(9, 10) * 0.1f;
world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_RANDOM, SoundCategory.PLAYERS, 1.0f, pitch);

View file

@ -33,9 +33,7 @@ public class NSE_Items extends NSE_BaseRegistration {
public static final Item LIGHT_BULB = new Item(new Item.Settings());
public static final Item CIGARETTE_BUTT = new Item(new Item.Settings());
//cigarettes
public static final CigaretteItem CIGARETTE = new CigaretteItem(200, NSE_Items.CIGARETTE_BUTT, "item.new_soviet.tooltip.salute", new Item.Settings());
//
private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder()
.icon(() -> new ItemStack(SICKLE))