mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 20:33:41 +01:00
Fixed tagging and some misc
This commit is contained in:
parent
ae7a24d2a3
commit
88d52814c5
7 changed files with 38 additions and 21 deletions
|
@ -6,6 +6,7 @@ import static net.minecraftforge.eventbus.api.Event.Result.DENY;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
@ -148,7 +149,7 @@ public class DeployerHandler {
|
||||||
if (entity.processInitialInteract(player, hand).isAccepted())
|
if (entity.processInitialInteract(player, hand).isAccepted())
|
||||||
success = true;
|
success = true;
|
||||||
else if (entity instanceof LivingEntity
|
else if (entity instanceof LivingEntity
|
||||||
&& stack.interactWithEntity(player, (LivingEntity) entity, hand))
|
&& stack.useOnEntity(player, (LivingEntity) entity, hand).isAccepted())
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
if (!success && stack.isFood() && entity instanceof PlayerEntity) {
|
if (!success && stack.isFood() && entity instanceof PlayerEntity) {
|
||||||
|
@ -198,7 +199,7 @@ public class DeployerHandler {
|
||||||
LeftClickBlock event = ForgeHooks.onLeftClickBlock(player, clickedPos, face);
|
LeftClickBlock event = ForgeHooks.onLeftClickBlock(player, clickedPos, face);
|
||||||
if (event.isCanceled())
|
if (event.isCanceled())
|
||||||
return;
|
return;
|
||||||
if (world.extinguishFire(player, clickedPos, face))
|
if (BlockHelper.extinguishFire(world, player, clickedPos, face)) // FIXME: is there an equivalent in world, as there was in 1.15?
|
||||||
return;
|
return;
|
||||||
if (event.getUseBlock() != DENY)
|
if (event.getUseBlock() != DENY)
|
||||||
clickedState.onBlockClicked(world, clickedPos, player);
|
clickedState.onBlockClicked(world, clickedPos, player);
|
||||||
|
|
|
@ -266,7 +266,7 @@ public class ContraptionCollider {
|
||||||
VoxelShapes.compare(voxelshape, VoxelShapes.create(bb.shrink(1.0E-7D)), IBooleanFunction.AND)
|
VoxelShapes.compare(voxelshape, VoxelShapes.create(bb.shrink(1.0E-7D)), IBooleanFunction.AND)
|
||||||
? Stream.empty()
|
? Stream.empty()
|
||||||
: Stream.of(voxelshape);
|
: Stream.of(voxelshape);
|
||||||
Stream<VoxelShape> stream1 = world.getEmptyCollisionShapes(e, bb.expand(movement), ImmutableSet.of());
|
Stream<VoxelShape> stream1 = world.getEntityCollisions(e, bb.expand(movement), entity -> false); // FIXME: 1.15 equivalent translated correctly?
|
||||||
ReuseableStream<VoxelShape> reuseablestream = new ReuseableStream<>(Stream.concat(stream1, stream));
|
ReuseableStream<VoxelShape> reuseablestream = new ReuseableStream<>(Stream.concat(stream1, stream));
|
||||||
Vector3d Vector3d = movement.lengthSquared() == 0.0D ? movement
|
Vector3d Vector3d = movement.lengthSquared() == 0.0D ? movement
|
||||||
: collideBoundingBoxHeuristically(e, movement, bb, world, ctx, reuseablestream);
|
: collideBoundingBoxHeuristically(e, movement, bb, world, ctx, reuseablestream);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.function.Supplier;
|
||||||
import com.google.gson.JsonDeserializationContext;
|
import com.google.gson.JsonDeserializationContext;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import net.minecraft.advancements.criterion.EntityPredicate;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.loot.ConditionArrayParser;
|
import net.minecraft.loot.ConditionArrayParser;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -32,7 +33,7 @@ public class SimpleTrigger extends CriterionTriggerBase<SimpleTrigger.Instance>
|
||||||
public static class Instance extends CriterionTriggerBase.Instance {
|
public static class Instance extends CriterionTriggerBase.Instance {
|
||||||
|
|
||||||
public Instance(ResourceLocation idIn) {
|
public Instance(ResourceLocation idIn) {
|
||||||
super(idIn);
|
super(idIn, EntityPredicate.AndPredicate.EMPTY); // FIXME: Is this right?
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
||||||
GeneratedRecipe
|
GeneratedRecipe
|
||||||
|
|
||||||
CRUSHING_WHEEL = create(AllBlocks.CRUSHING_WHEEL::get).returns(2)
|
CRUSHING_WHEEL = create(AllBlocks.CRUSHING_WHEEL::get).returns(2)
|
||||||
.recipe(b -> b.key('P', ItemTags.PLANKS)
|
.recipe(b -> b.key('P', Ingredient.fromTag(ItemTags.PLANKS))
|
||||||
.key('S', I.stone())
|
.key('S', Ingredient.fromTag(I.stone()))
|
||||||
.key('A', I.andesite())
|
.key('A', I.andesite())
|
||||||
.patternLine(" AAA ")
|
.patternLine(" AAA ")
|
||||||
.patternLine("AAPAA")
|
.patternLine("AAPAA")
|
||||||
|
@ -31,18 +31,18 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
||||||
|
|
||||||
INTEGRATED_CIRCUIT = create(AllItems.INTEGRATED_CIRCUIT::get).returns(1)
|
INTEGRATED_CIRCUIT = create(AllItems.INTEGRATED_CIRCUIT::get).returns(1)
|
||||||
.recipe(b -> b.key('L', AllItems.LAPIS_SHEET.get())
|
.recipe(b -> b.key('L', AllItems.LAPIS_SHEET.get())
|
||||||
.key('R', I.redstone())
|
.key('R', Ingredient.fromTag(I.redstone()))
|
||||||
.key('Q', AllItems.POLISHED_ROSE_QUARTZ.get())
|
.key('Q', AllItems.POLISHED_ROSE_QUARTZ.get())
|
||||||
.key('C', Tags.Items.NUGGETS_GOLD)
|
.key('C', Ingredient.fromTag(Tags.Items.NUGGETS_GOLD))
|
||||||
.patternLine(" L ")
|
.patternLine(" L ")
|
||||||
.patternLine("RRQRR")
|
.patternLine("RRQRR")
|
||||||
.patternLine(" CCC ")),
|
.patternLine(" CCC ")),
|
||||||
|
|
||||||
EXTENDO_GRIP = create(AllItems.EXTENDO_GRIP::get).returns(1)
|
EXTENDO_GRIP = create(AllItems.EXTENDO_GRIP::get).returns(1)
|
||||||
.recipe(b -> b.key('L', I.brass())
|
.recipe(b -> b.key('L', Ingredient.fromTag(I.brass()))
|
||||||
.key('R', I.cog())
|
.key('R', I.cog())
|
||||||
.key('H', AllItems.BRASS_HAND.get())
|
.key('H', AllItems.BRASS_HAND.get())
|
||||||
.key('S', Tags.Items.RODS_WOODEN)
|
.key('S', Ingredient.fromTag(Tags.Items.RODS_WOODEN))
|
||||||
.patternLine(" L ")
|
.patternLine(" L ")
|
||||||
.patternLine(" R ")
|
.patternLine(" R ")
|
||||||
.patternLine("SSS")
|
.patternLine("SSS")
|
||||||
|
@ -50,8 +50,8 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
||||||
.patternLine(" H ")),
|
.patternLine(" H ")),
|
||||||
|
|
||||||
FURNACE_ENGINE = create(AllBlocks.FURNACE_ENGINE::get).returns(1)
|
FURNACE_ENGINE = create(AllBlocks.FURNACE_ENGINE::get).returns(1)
|
||||||
.recipe(b -> b.key('P', I.brassSheet())
|
.recipe(b -> b.key('P', Ingredient.fromTag(I.brassSheet()))
|
||||||
.key('B', I.brass())
|
.key('B', Ingredient.fromTag(I.brass()))
|
||||||
.key('I', Ingredient.fromItems(Blocks.PISTON, Blocks.STICKY_PISTON))
|
.key('I', Ingredient.fromItems(Blocks.PISTON, Blocks.STICKY_PISTON))
|
||||||
.key('C', I.brassCasing())
|
.key('C', I.brassCasing())
|
||||||
.patternLine("PPB")
|
.patternLine("PPB")
|
||||||
|
@ -59,7 +59,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
||||||
.patternLine("PPB")),
|
.patternLine("PPB")),
|
||||||
|
|
||||||
FLYWHEEL = create(AllBlocks.FLYWHEEL::get).returns(1)
|
FLYWHEEL = create(AllBlocks.FLYWHEEL::get).returns(1)
|
||||||
.recipe(b -> b.key('B', I.brass())
|
.recipe(b -> b.key('B', Ingredient.fromTag(I.brass()))
|
||||||
.key('C', I.brassCasing())
|
.key('C', I.brassCasing())
|
||||||
.patternLine(" BBB")
|
.patternLine(" BBB")
|
||||||
.patternLine("CB B")
|
.patternLine("CB B")
|
||||||
|
@ -71,7 +71,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
|
||||||
.patternLine("EBE")),
|
.patternLine("EBE")),
|
||||||
|
|
||||||
MECHANICAL_ARM = create(AllBlocks.MECHANICAL_ARM::get).returns(1)
|
MECHANICAL_ARM = create(AllBlocks.MECHANICAL_ARM::get).returns(1)
|
||||||
.recipe(b -> b.key('L', I.brassSheet())
|
.recipe(b -> b.key('L', Ingredient.fromTag(I.brassSheet()))
|
||||||
.key('R', I.cog())
|
.key('R', I.cog())
|
||||||
.key('I', I.circuit())
|
.key('I', I.circuit())
|
||||||
.key('A', I.andesite())
|
.key('A', I.andesite())
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.crafting.CookingRecipeSerializer;
|
import net.minecraft.item.crafting.CookingRecipeSerializer;
|
||||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.tags.ITag;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.Tag;
|
||||||
import net.minecraft.util.IItemProvider;
|
import net.minecraft.util.IItemProvider;
|
||||||
|
@ -863,7 +864,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||||
.inBlastFurnace();
|
.inBlastFurnace();
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratedRecipe blastMetalOre(Supplier<? extends IItemProvider> result, Tag<Item> ore) {
|
GeneratedRecipe blastMetalOre(Supplier<? extends IItemProvider> result, ITag<Item> ore) {
|
||||||
return create(result::get).withSuffix("_from_ore").viaCookingTag(() -> ore)
|
return create(result::get).withSuffix("_from_ore").viaCookingTag(() -> ore)
|
||||||
.rewardXP(.1f)
|
.rewardXP(.1f)
|
||||||
.inBlastFurnace();
|
.inBlastFurnace();
|
||||||
|
@ -886,13 +887,13 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratedRecipe metalCompacting(List<ItemProviderEntry<? extends IItemProvider>> variants,
|
GeneratedRecipe metalCompacting(List<ItemProviderEntry<? extends IItemProvider>> variants,
|
||||||
List<Supplier<Tag<Item>>> ingredients) {
|
List<Supplier<ITag<Item>>> ingredients) {
|
||||||
GeneratedRecipe result = null;
|
GeneratedRecipe result = null;
|
||||||
for (int i = 0; i + 1 < variants.size(); i++) {
|
for (int i = 0; i + 1 < variants.size(); i++) {
|
||||||
ItemProviderEntry<? extends IItemProvider> currentEntry = variants.get(i);
|
ItemProviderEntry<? extends IItemProvider> currentEntry = variants.get(i);
|
||||||
ItemProviderEntry<? extends IItemProvider> nextEntry = variants.get(i + 1);
|
ItemProviderEntry<? extends IItemProvider> nextEntry = variants.get(i + 1);
|
||||||
Supplier<Tag<Item>> currentIngredient = ingredients.get(i);
|
Supplier<ITag<Item>> currentIngredient = ingredients.get(i);
|
||||||
Supplier<Tag<Item>> nextIngredient = ingredients.get(i + 1);
|
Supplier<ITag<Item>> nextIngredient = ingredients.get(i + 1);
|
||||||
|
|
||||||
result = create(nextEntry).withSuffix("_from_compacting")
|
result = create(nextEntry).withSuffix("_from_compacting")
|
||||||
.unlockedBy(currentEntry::get)
|
.unlockedBy(currentEntry::get)
|
||||||
|
@ -948,7 +949,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratedRecipeBuilder unlockedByTag(Supplier<Tag<Item>> tag) {
|
GeneratedRecipeBuilder unlockedByTag(Supplier<ITag<Item>> tag) {
|
||||||
this.unlockedBy = () -> ItemPredicate.Builder.create()
|
this.unlockedBy = () -> ItemPredicate.Builder.create()
|
||||||
.tag(tag.get())
|
.tag(tag.get())
|
||||||
.build();
|
.build();
|
||||||
|
@ -996,7 +997,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
||||||
return unlockedBy(item).viaCookingIngredient(() -> Ingredient.fromItems(item.get()));
|
return unlockedBy(item).viaCookingIngredient(() -> Ingredient.fromItems(item.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneratedCookingRecipeBuilder viaCookingTag(Supplier<Tag<Item>> tag) {
|
GeneratedCookingRecipeBuilder viaCookingTag(Supplier<ITag<Item>> tag) {
|
||||||
return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.fromTag(tag.get()));
|
return unlockedByTag(tag).viaCookingIngredient(() -> Ingredient.fromTag(tag.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
public void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||||
AllGuiTextures.TEXT_INPUT.draw(this, guiLeft, guiTop);
|
AllGuiTextures.TEXT_INPUT.draw(matrixStack, this, guiLeft, guiTop);
|
||||||
textRenderer.draw(matrixStack, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 11,
|
textRenderer.draw(matrixStack, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 11,
|
||||||
AllGuiTextures.FONT_COLOR);
|
AllGuiTextures.FONT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.state.Property;
|
import net.minecraft.state.Property;
|
||||||
|
@ -30,6 +31,8 @@ import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BlockHelper {
|
public class BlockHelper {
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -196,4 +199,15 @@ public class BlockHelper {
|
||||||
public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) {
|
public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) {
|
||||||
return !p_220056_0_.isIn(BlockTags.LEAVES) && Block.doesSideFillSquare(p_220056_0_.getCollisionShape(p_220056_1_, p_220056_2_), p_220056_3_);
|
return !p_220056_0_.isIn(BlockTags.LEAVES) && Block.doesSideFillSquare(p_220056_0_.getCollisionShape(p_220056_1_, p_220056_2_), p_220056_3_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean extinguishFire(World world, @Nullable PlayerEntity p_175719_1_, BlockPos p_175719_2_, Direction p_175719_3_) {
|
||||||
|
p_175719_2_ = p_175719_2_.offset(p_175719_3_);
|
||||||
|
if (world.getBlockState(p_175719_2_).getBlock() == Blocks.FIRE) {
|
||||||
|
world.playEvent(p_175719_1_, 1009, p_175719_2_, 0);
|
||||||
|
world.removeBlock(p_175719_2_, false);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue