Final adjustments

This commit is contained in:
benpospo@gmail.com 2023-07-10 14:49:14 +02:00 committed by drcrazy
parent 6a09eb859c
commit 4d61bb4481
4 changed files with 7 additions and 74 deletions

View file

@ -26,14 +26,11 @@ package techreborn;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.minecraft.client.item.ClampedModelPredicateProvider;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.client.render.model.BakedModel;
@ -42,7 +39,6 @@ import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.client.world.ClientWorld;
@ -52,12 +48,9 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import reborncore.client.ClientJumpEvent;
import reborncore.client.ClientNetworkManager;
import reborncore.client.gui.GuiBase;
import reborncore.client.multiblock.MultiblockRenderer;
import reborncore.common.powerSystem.RcEnergyItem;
@ -67,7 +60,6 @@ import techreborn.client.ClientGuiType;
import techreborn.client.ClientboundPacketHandlers;
import techreborn.client.events.ClientJumpHandler;
import techreborn.client.events.StackToolTipHandler;
import techreborn.client.keybindings.KeyBindings;
import techreborn.client.render.BaseDynamicFluidBakedModel;
import techreborn.client.render.DynamicBucketBakedModel;
import techreborn.client.render.DynamicCellBakedModel;
@ -84,7 +76,6 @@ import techreborn.items.FrequencyTransmitterItem;
import techreborn.items.armor.BatpackItem;
import techreborn.items.tool.ChainsawItem;
import techreborn.items.tool.industrial.NanosaberItem;
import techreborn.packets.ServerboundPackets;
import java.util.Arrays;
import java.util.Collection;
@ -94,13 +85,6 @@ import java.util.function.Supplier;
public class TechRebornClient implements ClientModInitializer {
// Keybindings
public KeyBinding nanoSuitFlight = KeyBindingHelper.registerKeyBinding(
new KeyBinding("key.techreborn.nanoSuitFlight",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_SPACE,
"key.category.techreborn"));
@Override
public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> {
@ -112,13 +96,6 @@ public class TechRebornClient implements ClientModInitializer {
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_base"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_fluid"), "inventory"));
out.accept(new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory"));
ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (nanoSuitFlight.wasPressed()) {
client.player.sendMessage(Text.literal("Key 1 was pressed!"), false);
ClientNetworkManager.sendToServer(ServerboundPackets.createPacketNanoSuitFlight());
}
});
});
ModelLoadingRegistry.INSTANCE.registerVariantProvider(resourceManager -> (modelIdentifier, modelProviderContext) -> {

View file

@ -37,13 +37,13 @@ import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import reborncore.api.items.ArmorBlockEntityTicker;
import reborncore.common.powerSystem.RcEnergyTier;
import techreborn.config.TechRebornConfig;
import java.util.Objects;
public class NanoSuitItem extends TREnergyArmourItem implements ArmorBlockEntityTicker {
public NanoSuitItem(ArmorMaterial material, Type slot) {
@ -67,7 +67,6 @@ public class NanoSuitItem extends TREnergyArmourItem implements ArmorBlockEntity
if (equipmentSlot == this.getSlotType() && getStoredEnergy(stack) > 0) {
attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", 8, EntityAttributeModifier.Operation.ADDITION));
attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION));
}
return ImmutableMultimap.copyOf(attributes);
@ -77,35 +76,11 @@ public class NanoSuitItem extends TREnergyArmourItem implements ArmorBlockEntity
@Override
public void tickArmor(ItemStack stack, PlayerEntity playerEntity) {
World world = playerEntity.getWorld();
switch (this.getSlotType()) {
case HEAD -> {
if ((world.isNight() || world.getLightLevel(playerEntity.getBlockPos()) <= 4) && tryUseEnergy(stack, TechRebornConfig.nanoSuitNightVisionCost)) {
playerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1000, 1, false, false));
} else {
playerEntity.removeStatusEffect(StatusEffects.NIGHT_VISION);
}
// Night Vision
if (Objects.requireNonNull(this.getSlotType()) == EquipmentSlot.HEAD) {
if ((world.isNight() || world.getLightLevel(playerEntity.getBlockPos()) <= 6) && tryUseEnergy(stack, TechRebornConfig.nanoSuitNightVisionCost)) {
playerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 220, 1, false, false));
}
case FEET -> {
if (tryUseEnergy(stack, TechRebornConfig.nanoSuitFlightCost)) {
playerEntity.setNoGravity(true);
playerEntity.updatePosition(playerEntity.getX(), playerEntity.getY() + 0.1, playerEntity.getZ());
world.addParticle(ParticleTypes.SOUL_FIRE_FLAME, playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), 0.0, -1.0, 0.0);
} else {
playerEntity.setNoGravity(false);
playerEntity.sendMessage(Text.literal("uwu"));
}
}
}
}
public void boostPlayer(ItemStack stack, PlayerEntity playerEntity) {
World world = playerEntity.getWorld();
if (tryUseEnergy(stack, TechRebornConfig.nanoSuitFlightCost)) {
playerEntity.setNoGravity(true);
playerEntity.updatePosition(playerEntity.getX(), playerEntity.getY() + 0.3, playerEntity.getZ());
world.addParticle(ParticleTypes.SOUL_FIRE_FLAME, playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), 1.0, 1.0, 1.0);
} else {
playerEntity.setNoGravity(false);
}
}
}

View file

@ -47,9 +47,7 @@ import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRArmorMaterials;
import techreborn.init.TRContent;
import techreborn.items.armor.NanoSuitItem;
public class ServerboundPackets {
@ -66,7 +64,6 @@ public class ServerboundPackets {
public static final Identifier JUMP = new Identifier(TechReborn.MOD_ID, "jump");
public static final Identifier PUMP_DEPTH = new Identifier(TechReborn.MOD_ID, "pump_depth");
public static final Identifier PUMP_RANGE = new Identifier(TechReborn.MOD_ID, "pump_range");
public static final Identifier NANO_SUIT_FLIGHT = new Identifier(TechReborn.MOD_ID, "nano_suit_flight");
public static void init() {
NetworkManager.registerServerBoundHandler(AESU, (server, player, handler, buf, responseSender) -> {
@ -231,18 +228,6 @@ public class ServerboundPackets {
}
});
}));
NetworkManager.registerServerBoundHandler(NANO_SUIT_FLIGHT, ((server, player, handler, buf, responseSender) -> {
NanoSuitItem nanoSuitItem = new NanoSuitItem(TRArmorMaterials.NANO, ArmorItem.Type.BOOTS);
server.execute(() -> {
for (ItemStack stack : player.getArmorItems()) {
if (!stack.isEmpty() && stack.getItem().equals(TRContent.NANO_BOOTS)) {
nanoSuitItem.boostPlayer(stack, player);
}
}
});
}));
}
public static IdentifiedPacket createPacketAesu(int buttonID, boolean shift, boolean ctrl, AdjustableSUBlockEntity blockEntity) {
@ -334,8 +319,4 @@ public class ServerboundPackets {
buf.writeInt(buttonAmount);
});
}
public static IdentifiedPacket createPacketNanoSuitFlight() {
return NetworkManager.createServerBoundPacket(NANO_SUIT_FLIGHT, buf -> {});
}
}

View file

@ -17,6 +17,6 @@
}
},
"result": {
"item": "techreborn:nano_leggings"
"item": "techreborn:nano_chestplate"
}
}