Skip to content

Commit

Permalink
Week #6 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
North-West-Wind committed Jan 4, 2021
1 parent 01346ef commit 4fbc2a7
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.5.0-1.16.x'
version = '1.6.0-1.16.x'
group = 'com.northwestwind.moreboots' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'moreboots'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.northwestwind.moreboots.handler;

import com.google.common.collect.Sets;
import com.northwestwind.moreboots.Reference;
import com.northwestwind.moreboots.handler.packet.*;
import com.northwestwind.moreboots.init.BlockInit;
Expand All @@ -11,6 +12,7 @@
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.FrostWalkerEnchantment;
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.Entity;
Expand All @@ -22,6 +24,7 @@
import net.minecraft.fluid.*;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.*;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -429,6 +432,48 @@ public void onKeyInput(final InputEvent.KeyInputEvent event) {
player.setMotion(motion.mul(0, 1, 0).add(direction.getX(), 0, direction.getZ()));
}
if (player.world.isRemote) MoreBootsPacketHandler.INSTANCE.sendToServer(new CPlayerSkatePacket());
} else if (Minecraft.getInstance().gameSettings.keyBindJump.isPressed() && event.getAction() == GLFW.GLFW_PRESS) {
ClientPlayerEntity player = Minecraft.getInstance().player;
if (player == null || player.func_233570_aj_() || player.abilities.isFlying) return;
ItemStack boots = player.getItemStackFromSlot(EquipmentSlotType.FEET);
if (!boots.getItem().equals(ItemInit.SANDALS)) return;
BlockPos pos = new BlockPos(player.getPositionVec());
if (pos.getY() > 255 || pos.getY() < 0) return;
if (!player.world.isAirBlock(pos) || !player.inventory.hasAny(Sets.newHashSet(Items.SAND))) return;
boolean shouldJump = player.isCreative();
if (!shouldJump) for (ItemStack stack : player.inventory.mainInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (!shouldJump) for (ItemStack stack : player.inventory.offHandInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (!shouldJump) for (ItemStack stack : player.inventory.armorInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (shouldJump) {
player.world.setBlockState(pos, Blocks.SAND.getDefaultState(), 3);
player.jump();
player.setMotion(player.getMotion().add(0,1,0));
if (player.world.isRemote) MoreBootsPacketHandler.INSTANCE.sendToServer(new CPlayerMultiJumpPacket());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ public static void registerPackets() {
ctx.get().enqueueWork(() -> msg.handle(ctx.get()));
ctx.get().setPacketHandled(true);
});
INSTANCE.registerMessage(ID++, CPlayerMultiJumpPacket.class, (packet, packetBuffer) -> packetBuffer.writeByteArray(Utils.objToBytes(packet)), packetBuffer -> (CPlayerMultiJumpPacket) Utils.bytesToObj(packetBuffer.readByteArray()), (msg, ctx) -> {
ctx.get().enqueueWork(() -> msg.handle(ctx.get()));
ctx.get().setPacketHandled(true);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.northwestwind.moreboots.handler.packet;

import com.northwestwind.moreboots.handler.MoreBootsPacketHandler;
import com.northwestwind.moreboots.init.ItemInit;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.network.NetworkDirection;
import net.minecraftforge.fml.network.NetworkEvent;

import java.io.Serializable;

public class CPlayerMultiJumpPacket implements Serializable {
public void handle(final NetworkEvent.Context ctx) {
if (!ctx.getDirection().equals(NetworkDirection.PLAY_TO_SERVER)) return;
ServerPlayerEntity player = ctx.getSender();
if(player == null) return;
ItemStack boots = player.getItemStackFromSlot(EquipmentSlotType.FEET);
if(!boots.getItem().equals(ItemInit.SANDALS)) return;
BlockPos pos = new BlockPos(player.getPositionVec());
if (pos.getY() > 255 || pos.getY() < 0) return;
if (!player.world.isAirBlock(pos)) return;
boolean shouldJump = player.isCreative();
if (!shouldJump) for (ItemStack stack : player.inventory.mainInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (!shouldJump) for (ItemStack stack : player.inventory.offHandInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (!shouldJump) for (ItemStack stack : player.inventory.armorInventory) {
if (stack.getItem().equals(Items.SAND)) {
int slot = player.inventory.getSlotFor(stack);
stack.shrink(1);
player.inventory.setInventorySlotContents(slot, stack);
shouldJump = true;
break;
}
}
if (shouldJump) {
player.world.setBlockState(pos, Blocks.SAND.getDefaultState(), 3);
player.jump();
player.setMotion(player.getMotion().add(0,1,0));
}
}
}
13 changes: 8 additions & 5 deletions src/main/java/com/northwestwind/moreboots/init/ItemInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ public class ItemInit {
public static final Item GLASS_BOOTS_EMPTY = registerBoots(ModArmorMaterial.GLASS_EMPTY, "glass_boots_empty");
public static final Item FLOATIE_BOOTS = registerBoots(ModArmorMaterial.FLOATIE, "floatie_boots", true);
public static final Item STRIDER_BOOTS = registerBoots(ModArmorMaterial.STRIDER, "strider_boots", true);
public static final Item SANDALS = registerBoots(ModArmorMaterial.SAND, "sand_boots");
//public static final Item SNIPER_BOOTS = registerBoots(ModArmorMaterial.SNIPER, "sniper_boots");

public static final Item QUARTZ_INGOT = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "quartz_ingot").setRegistryName("quartz_ingot");
public static final Item METAL_MIX = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "metal_mix").setRegistryName("metal_mix");
public static final Item BAT_HIDE = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "bat_hide").setRegistryName("bat_hide");
public static final Item STRIDER_FOOT = new ItemBase(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), "strider_foot").setRegistryName("strider_foot");
public static final Item QUARTZ_INGOT = new ItemBase("quartz_ingot");
public static final Item METAL_MIX = new ItemBase("metal_mix");
public static final Item BAT_HIDE = new ItemBase("bat_hide");
public static final Item STRIDER_FOOT = new ItemBase("strider_foot");

//public static final Item CROSSBOW = new SniperCrossbowItem().setRegistryName("minecraft", "crossbow");

Expand Down Expand Up @@ -105,6 +106,7 @@ public static void registerItems(final RegistryEvent.Register<Item> event) {
event.getRegistry().register(GLASS_BOOTS_EMPTY);
event.getRegistry().register(FLOATIE_BOOTS);
event.getRegistry().register(STRIDER_BOOTS);
event.getRegistry().register(SANDALS);
//event.getRegistry().register(SNIPER_BOOTS);

event.getRegistry().register(QUARTZ_INGOT);
Expand Down Expand Up @@ -188,7 +190,8 @@ public enum ModArmorMaterial implements IArmorMaterial {
GLASS(Reference.MODID + ":glass", 10, new int[] { 4, 1, 1, 1 }, 20, SoundEvents.BLOCK_GLASS_BREAK, 0.0f, 0.0f, () -> Ingredient.fromItems(Items.GLASS)),
SNIPER(Reference.MODID + ":sniper", 8, new int[] { 2, 1, 1, 1 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0f, 0.0f, 90000, () -> Ingredient.fromItems(Items.TIPPED_ARROW)),
FLOATIE(Reference.MODID + ":floatie", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(Items.field_234759_km_)),
STRIDER(Reference.MODID + ":strider", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(ItemInit.STRIDER_FOOT));
STRIDER(Reference.MODID + ":strider", 40, new int[] { 4, 1, 1, 1 }, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 0.0f, 160000, () -> Ingredient.fromItems(ItemInit.STRIDER_FOOT)),
SAND(Reference.MODID + ":sand", 18, new int[] { 2, 1, 1, 1 }, 8, SoundEvents.BLOCK_SAND_PLACE, 0.0f, 0.0f, 40000, () -> Ingredient.fromItems(Items.SAND));
private static final int[] MAX_DAMAGE_ARRAY = new int[] { 16, 16, 16, 16 };
private final String name;
private final float maxDamageFactor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ public ArmorItemBase(IArmorMaterial material, String registryName, boolean isNet
this.registryName = registryName;
}

public ArmorItemBase(IArmorMaterial material, String registryName) {
this(material, registryName, false);
}

@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.northwestwind.moreboots.init.item;

import com.northwestwind.moreboots.MoreBoots;
import com.northwestwind.moreboots.Reference;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
Expand All @@ -18,9 +20,14 @@
public class ItemBase extends Item {
private String registryName;

public ItemBase(Properties p_i48487_1_, String registryName) {
super(p_i48487_1_);
public ItemBase(Properties properties, String registryName) {
super(properties);
this.registryName = registryName;
setRegistryName(Reference.MODID, registryName);
}

public ItemBase(String registryName) {
this(new Item.Properties().group(MoreBoots.MoreBootsItemGroup.INSTANCE), registryName);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ issueTrackerURL="https://github.com/North-West-Wind/MoreBoots/issues"

[[mods]]
modId="moreboots"
version="1.5.0"
version="1.6.0"
displayName="More Boots"
updateJSONURL="https://github.com/North-West-Wind/MoreBoots/raw/main/update.json"
displayURL="https://github.com/North-West-Wind/MoreBoots"
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/assets/moreboots/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"item.moreboots.glass_boots": "Glass Boots",
"item.moreboots.floatie_boots": "Floatie Boots",
"item.moreboots.strider_boots": "Strider Boots",
"item.moreboots.sand_boots": "SANDals",

"item.moreboots.quartz_ingot": "Quartz Ingot",
"item.moreboots.metal_mix": "Metal Mix",
Expand Down Expand Up @@ -91,6 +92,7 @@
"tooltip.moreboots.glass_boots": "\u00A77\u00A7oActs like potions but on feet",
"tooltip.moreboots.floatie_boots": "\u00A77\u00A7oFloats on water",
"tooltip.moreboots.strider_boots": "\u00A77\u00A7oWalks on lava",
"tooltip.moreboots.sand_boots": "\u00A77\u00A7oAllows multi-jumping",
"itemGroup.morebootstab": "More Boots",

"death.attack.stomp": "%1$s was stomped by %2$s",
Expand Down Expand Up @@ -168,7 +170,8 @@
"advancements.moreboots.floatie_boots.description": "Obtain the Floatie Boots",
"advancements.moreboots.strider_boots.title": "I Need Lava",
"advancements.moreboots.strider_boots.description": "Obtain the Strider Boots",

"advancements.moreboots.sand_boots.title": "Jumping 2368 Times",
"advancements.moreboots.sand_boots.description": "Obtain the SANDals",

"key.categories.moreboots": "More Boots",
"key.moreboots.teleport": "Ender Boots Teleport"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "moreboots:items/sand_boots"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parent": "moreboots:moreboots/root",
"display": {
"icon": {
"item": "moreboots:sand_boots",
"nbt": "{Damage:0}"
},
"title": {
"translate": "advancements.moreboots.sand_boots.title"
},
"description": {
"translate": "advancements.moreboots.sand_boots.description"
},
"frame": "task",
"show_toast": true,
"announce_to_chat": true,
"hidden": false
},
"criteria": {
"sand_boots": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "moreboots:sand_boots"
}
]
}
}
},
"requirements": [
[
"sand_boots"
]
]
}
19 changes: 19 additions & 0 deletions src/main/resources/data/moreboots/recipes/sand_boots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"S S",
"# #"
],
"key": {
"#": {
"item": "minecraft:iron_ingot"
},
"S": {
"item": "minecraft:sand"
}
},
"result": {
"item": "moreboots:sand_boots",
"count": 1
}
}
28 changes: 16 additions & 12 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"1.4.0": "Week #4 Update",
"1.4.1": "Fixed random crashes + ice not generating properly",
"1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect",
"1.5.0": "Week #5 Update"
"1.5.0": "Week #5 Update",
"1.6.0": "Week #6 Update"
},
"1.16.3": {
"1.0.0": "The very first release",
Expand All @@ -22,7 +23,8 @@
"1.4.0": "Week #4 Update",
"1.4.1": "Fixed random crashes + ice not generating properly",
"1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect",
"1.5.0": "Week #5 Update"
"1.5.0": "Week #5 Update",
"1.6.0": "Week #6 Update"
},
"1.16.2": {
"1.0.0": "The very first release",
Expand All @@ -34,7 +36,8 @@
"1.4.0": "Week #4 Update",
"1.4.1": "Fixed random crashes + ice not generating properly",
"1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect",
"1.5.0": "Week #5 Update"
"1.5.0": "Week #5 Update",
"1.6.0": "Week #6 Update"
},
"1.16.1": {
"1.0.0": "The very first release",
Expand All @@ -46,16 +49,17 @@
"1.4.0": "Week #4 Update",
"1.4.1": "Fixed random crashes + ice not generating properly",
"1.4.2": "Fixed Bamboo Generation + Added Custom Warmth Effect",
"1.5.0": "Week #5 Update"
"1.5.0": "Week #5 Update",
"1.6.0": "Week #6 Update"
},
"promos": {
"1.16.4-latest": "1.5.0",
"1.16.4-recommended": "1.5.0",
"1.16.3-latest": "1.5.0",
"1.16.3-recommended": "1.5.0",
"1.16.2-latest": "1.5.0",
"1.16.2-recommended": "1.5.0",
"1.16.1-latest": "1.5.0",
"1.16.1-recommended": "1.5.0"
"1.16.4-latest": "1.6.0",
"1.16.4-recommended": "1.6.0",
"1.16.3-latest": "1.6.0",
"1.16.3-recommended": "1.6.0",
"1.16.2-latest": "1.6.0",
"1.16.2-recommended": "1.6.0",
"1.16.1-latest": "1.6.0",
"1.16.1-recommended": "1.6.0"
}
}

0 comments on commit 4fbc2a7

Please sign in to comment.