This commit is contained in:
parent
0664de5de5
commit
e5aa71f751
@ -3,11 +3,11 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 20w13b
|
minecraft_version = 20w14a
|
||||||
curseforge_id = 365308
|
curseforge_id = 365308
|
||||||
simple_minecraft_version = 1.16-Snapshot
|
simple_minecraft_version = 1.16-Snapshot
|
||||||
yarn_build = 4
|
yarn_build = 2
|
||||||
fabric_loader_version = 0.7.8+build.189
|
fabric_loader_version = 0.5.7+build.314-1.16
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.7
|
mod_version = 1.2.7
|
||||||
@ -19,4 +19,4 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_api_version = 0.5.6+build.313-1.16
|
fabric_api_version = 0.5.6+build.313-1.16
|
||||||
cloth_config_version = 3.2.1-unstable
|
cloth_config_version = 3.2.1-unstable
|
||||||
auto_config_version = 1.2.4
|
auto_config_version = 1.2.4
|
||||||
mod_menu_version = 1.11.0+build.2
|
mod_menu_version = 1.11.1+build.3
|
||||||
|
@ -6,7 +6,7 @@ import com.thebrokenrail.sorcerycraft.block.CastingTableBlock;
|
|||||||
import com.thebrokenrail.sorcerycraft.command.SpellCommand;
|
import com.thebrokenrail.sorcerycraft.command.SpellCommand;
|
||||||
import com.thebrokenrail.sorcerycraft.entity.SpellEntity;
|
import com.thebrokenrail.sorcerycraft.entity.SpellEntity;
|
||||||
import com.thebrokenrail.sorcerycraft.item.SpellItem;
|
import com.thebrokenrail.sorcerycraft.item.SpellItem;
|
||||||
import com.thebrokenrail.sorcerycraft.mixin.CriterionRegistryHook;
|
import com.thebrokenrail.sorcerycraft.mixin.CriteriaRegistryHook;
|
||||||
import com.thebrokenrail.sorcerycraft.packet.SelectSpellC2SPacket;
|
import com.thebrokenrail.sorcerycraft.packet.SelectSpellC2SPacket;
|
||||||
import com.thebrokenrail.sorcerycraft.spell.util.RandomSpellLootTableFunction;
|
import com.thebrokenrail.sorcerycraft.spell.util.RandomSpellLootTableFunction;
|
||||||
import com.thebrokenrail.sorcerycraft.spell.api.registry.Spells;
|
import com.thebrokenrail.sorcerycraft.spell.api.registry.Spells;
|
||||||
@ -154,8 +154,8 @@ public class SorceryCraft implements ModInitializer {
|
|||||||
INTERACT_WITH_CASTING_TABLE_STAT = registerStat("interact_with_casting_table");
|
INTERACT_WITH_CASTING_TABLE_STAT = registerStat("interact_with_casting_table");
|
||||||
CAST_SPELL_STAT = registerStat("cast_spell");
|
CAST_SPELL_STAT = registerStat("cast_spell");
|
||||||
|
|
||||||
DISCOVER_ALL_SPELLS_CRITERION = CriterionRegistryHook.callRegister(new DiscoverAllSpellsCriterion());
|
DISCOVER_ALL_SPELLS_CRITERION = CriteriaRegistryHook.callRegister(new DiscoverAllSpellsCriterion());
|
||||||
CREATE_SPELL_CRITERION = CriterionRegistryHook.callRegister(new CreateSpellCriterion());
|
CREATE_SPELL_CRITERION = CriteriaRegistryHook.callRegister(new CreateSpellCriterion());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Identifier registerStat(String name) {
|
private Identifier registerStat(String name) {
|
||||||
|
@ -91,8 +91,8 @@ public class CastingTableScreenHandler extends ScreenHandler {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CastingTableScreenHandler.this.inventory.setInvStack(0, ItemStack.EMPTY);
|
CastingTableScreenHandler.this.inventory.setStack(0, ItemStack.EMPTY);
|
||||||
CastingTableScreenHandler.this.inventory.takeInvStack(1, spells[index].getItemCost().getCount());
|
CastingTableScreenHandler.this.inventory.removeStack(1, spells[index].getItemCost().getCount());
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -141,7 +141,7 @@ public class CastingTableScreenHandler extends ScreenHandler {
|
|||||||
this.index = index;
|
this.index = index;
|
||||||
onContentChanged(inventory);
|
onContentChanged(inventory);
|
||||||
|
|
||||||
if (inventory.getInvStack(0).isEmpty() && inventory.getInvStack(1).isEmpty()) {
|
if (inventory.getStack(0).isEmpty() && inventory.getStack(1).isEmpty()) {
|
||||||
ItemStack spellItem = new ItemStack(SorceryCraft.SPELL_ITEM);
|
ItemStack spellItem = new ItemStack(SorceryCraft.SPELL_ITEM);
|
||||||
autoFill(0, spellItem, true);
|
autoFill(0, spellItem, true);
|
||||||
ItemStack paymentItem = getRecipes()[index].getItemCost();
|
ItemStack paymentItem = getRecipes()[index].getItemCost();
|
||||||
@ -198,8 +198,8 @@ public class CastingTableScreenHandler extends ScreenHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void onContentChanged(Inventory inventory) {
|
public void onContentChanged(Inventory inventory) {
|
||||||
super.onContentChanged(inventory);
|
super.onContentChanged(inventory);
|
||||||
ItemStack item = inventory.getInvStack(0);
|
ItemStack item = inventory.getStack(0);
|
||||||
ItemStack cost = inventory.getInvStack(1);
|
ItemStack cost = inventory.getStack(1);
|
||||||
if (inventory == this.inventory) {
|
if (inventory == this.inventory) {
|
||||||
if (spells.length > 0 &&
|
if (spells.length > 0 &&
|
||||||
!item.isEmpty() &&
|
!item.isEmpty() &&
|
||||||
@ -211,9 +211,9 @@ public class CastingTableScreenHandler extends ScreenHandler {
|
|||||||
resultSpells.put(spells[index].getID(), spells[index].getLevel());
|
resultSpells.put(spells[index].getID(), spells[index].getLevel());
|
||||||
}
|
}
|
||||||
SpellHelper.setSpells(resultItem, resultSpells);
|
SpellHelper.setSpells(resultItem, resultSpells);
|
||||||
result.setInvStack(2, resultItem);
|
result.setStack(2, resultItem);
|
||||||
} else {
|
} else {
|
||||||
result.setInvStack(2, ItemStack.EMPTY);
|
result.setStack(2, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,14 +223,14 @@ public class CastingTableScreenHandler extends ScreenHandler {
|
|||||||
for (int i = 3; i < 39; ++i) {
|
for (int i = 3; i < 39; ++i) {
|
||||||
ItemStack itemStack = slots.get(i).getStack();
|
ItemStack itemStack = slots.get(i).getStack();
|
||||||
if (!itemStack.isEmpty() && itemCompatible(stack, itemStack)) {
|
if (!itemStack.isEmpty() && itemCompatible(stack, itemStack)) {
|
||||||
ItemStack invSlot = inventory.getInvStack(slot);
|
ItemStack invSlot = inventory.getStack(slot);
|
||||||
int count = invSlot.isEmpty() ? 0 : invSlot.getCount();
|
int count = invSlot.isEmpty() ? 0 : invSlot.getCount();
|
||||||
int requiredCount = Math.min((onlyOne ? 1 : stack.getMaxCount()) - count, itemStack.getCount());
|
int requiredCount = Math.min((onlyOne ? 1 : stack.getMaxCount()) - count, itemStack.getCount());
|
||||||
ItemStack modifiedItem = itemStack.copy();
|
ItemStack modifiedItem = itemStack.copy();
|
||||||
int totalCount = count + requiredCount;
|
int totalCount = count + requiredCount;
|
||||||
itemStack.decrement(requiredCount);
|
itemStack.decrement(requiredCount);
|
||||||
modifiedItem.setCount(totalCount);
|
modifiedItem.setCount(totalCount);
|
||||||
inventory.setInvStack(slot, modifiedItem);
|
inventory.setStack(slot, modifiedItem);
|
||||||
if (totalCount >= stack.getMaxCount() || onlyOne) {
|
if (totalCount >= stack.getMaxCount() || onlyOne) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class SpellItem extends Item {
|
|||||||
super.inventoryTick(stack, world, entity, slot, selected);
|
super.inventoryTick(stack, world, entity, slot, selected);
|
||||||
if (!world.isClient() && entity instanceof PlayerEntity) {
|
if (!world.isClient() && entity instanceof PlayerEntity) {
|
||||||
PlayerEntity player = (PlayerEntity) entity;
|
PlayerEntity player = (PlayerEntity) entity;
|
||||||
Map<Identifier, Integer> itemSpells = SpellHelper.getSpells(player.inventory.getInvStack(slot));
|
Map<Identifier, Integer> itemSpells = SpellHelper.getSpells(player.inventory.getStack(slot));
|
||||||
|
|
||||||
SpellHelper.learnSpells(player, itemSpells);
|
SpellHelper.learnSpells(player, itemSpells);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.thebrokenrail.sorcerycraft.mixin;
|
package com.thebrokenrail.sorcerycraft.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.advancement.criterion.Criteria;
|
||||||
import net.minecraft.advancement.criterion.Criterion;
|
import net.minecraft.advancement.criterion.Criterion;
|
||||||
import net.minecraft.advancement.criterion.Criterions;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
@Mixin(Criterions.class)
|
@Mixin(Criteria.class)
|
||||||
public interface CriterionRegistryHook {
|
public interface CriteriaRegistryHook {
|
||||||
@Invoker("register")
|
@Invoker("register")
|
||||||
static <T extends Criterion<?>> T callRegister(T criterion) {
|
static <T extends Criterion<?>> T callRegister(T criterion) {
|
||||||
return criterion;
|
return criterion;
|
@ -6,7 +6,7 @@
|
|||||||
"MixinClientPlayNetworkHandler"
|
"MixinClientPlayNetworkHandler"
|
||||||
],
|
],
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CriterionRegistryHook",
|
"CriteriaRegistryHook",
|
||||||
"MixinClientPlayerEntity",
|
"MixinClientPlayerEntity",
|
||||||
"MixinPlayerEntity",
|
"MixinPlayerEntity",
|
||||||
"MixinServerPlayerEntity"
|
"MixinServerPlayerEntity"
|
||||||
|
Reference in New Issue
Block a user