Fixed tagging and some misc

This commit is contained in:
grimmauld 2020-09-23 23:14:00 +02:00
parent ae7a24d2a3
commit 88d52814c5
7 changed files with 38 additions and 21 deletions

View File

@ -6,6 +6,7 @@ import static net.minecraftforge.eventbus.api.Event.Result.DENY;
import java.util.ArrayList;
import java.util.List;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.block.*;
import net.minecraft.enchantment.EnchantmentHelper;
@ -148,7 +149,7 @@ public class DeployerHandler {
if (entity.processInitialInteract(player, hand).isAccepted())
success = true;
else if (entity instanceof LivingEntity
&& stack.interactWithEntity(player, (LivingEntity) entity, hand))
&& stack.useOnEntity(player, (LivingEntity) entity, hand).isAccepted())
success = true;
}
if (!success && stack.isFood() && entity instanceof PlayerEntity) {
@ -198,7 +199,7 @@ public class DeployerHandler {
LeftClickBlock event = ForgeHooks.onLeftClickBlock(player, clickedPos, face);
if (event.isCanceled())
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;
if (event.getUseBlock() != DENY)
clickedState.onBlockClicked(world, clickedPos, player);

View File

@ -266,7 +266,7 @@ public class ContraptionCollider {
VoxelShapes.compare(voxelshape, VoxelShapes.create(bb.shrink(1.0E-7D)), IBooleanFunction.AND)
? Stream.empty()
: 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));
Vector3d Vector3d = movement.lengthSquared() == 0.0D ? movement
: collideBoundingBoxHeuristically(e, movement, bb, world, ctx, reuseablestream);

View File

@ -6,6 +6,7 @@ import java.util.function.Supplier;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import net.minecraft.advancements.criterion.EntityPredicate;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.loot.ConditionArrayParser;
import net.minecraft.util.ResourceLocation;
@ -32,7 +33,7 @@ public class SimpleTrigger extends CriterionTriggerBase<SimpleTrigger.Instance>
public static class Instance extends CriterionTriggerBase.Instance {
public Instance(ResourceLocation idIn) {
super(idIn);
super(idIn, EntityPredicate.AndPredicate.EMPTY); // FIXME: Is this right?
}
@Override

View File

@ -20,8 +20,8 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
GeneratedRecipe
CRUSHING_WHEEL = create(AllBlocks.CRUSHING_WHEEL::get).returns(2)
.recipe(b -> b.key('P', ItemTags.PLANKS)
.key('S', I.stone())
.recipe(b -> b.key('P', Ingredient.fromTag(ItemTags.PLANKS))
.key('S', Ingredient.fromTag(I.stone()))
.key('A', I.andesite())
.patternLine(" AAA ")
.patternLine("AAPAA")
@ -31,18 +31,18 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
INTEGRATED_CIRCUIT = create(AllItems.INTEGRATED_CIRCUIT::get).returns(1)
.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('C', Tags.Items.NUGGETS_GOLD)
.key('C', Ingredient.fromTag(Tags.Items.NUGGETS_GOLD))
.patternLine(" L ")
.patternLine("RRQRR")
.patternLine(" CCC ")),
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('H', AllItems.BRASS_HAND.get())
.key('S', Tags.Items.RODS_WOODEN)
.key('S', Ingredient.fromTag(Tags.Items.RODS_WOODEN))
.patternLine(" L ")
.patternLine(" R ")
.patternLine("SSS")
@ -50,8 +50,8 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
.patternLine(" H ")),
FURNACE_ENGINE = create(AllBlocks.FURNACE_ENGINE::get).returns(1)
.recipe(b -> b.key('P', I.brassSheet())
.key('B', I.brass())
.recipe(b -> b.key('P', Ingredient.fromTag(I.brassSheet()))
.key('B', Ingredient.fromTag(I.brass()))
.key('I', Ingredient.fromItems(Blocks.PISTON, Blocks.STICKY_PISTON))
.key('C', I.brassCasing())
.patternLine("PPB")
@ -59,7 +59,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
.patternLine("PPB")),
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())
.patternLine(" BBB")
.patternLine("CB B")
@ -71,7 +71,7 @@ public class MechanicalCraftingRecipeGen extends CreateRecipeProvider {
.patternLine("EBE")),
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('I', I.circuit())
.key('A', I.andesite())

View File

@ -27,6 +27,7 @@ import net.minecraft.item.Items;
import net.minecraft.item.crafting.CookingRecipeSerializer;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider;
@ -863,7 +864,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
.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)
.rewardXP(.1f)
.inBlastFurnace();
@ -886,13 +887,13 @@ public class StandardRecipeGen extends CreateRecipeProvider {
}
GeneratedRecipe metalCompacting(List<ItemProviderEntry<? extends IItemProvider>> variants,
List<Supplier<Tag<Item>>> ingredients) {
List<Supplier<ITag<Item>>> ingredients) {
GeneratedRecipe result = null;
for (int i = 0; i + 1 < variants.size(); i++) {
ItemProviderEntry<? extends IItemProvider> currentEntry = variants.get(i);
ItemProviderEntry<? extends IItemProvider> nextEntry = variants.get(i + 1);
Supplier<Tag<Item>> currentIngredient = ingredients.get(i);
Supplier<Tag<Item>> nextIngredient = ingredients.get(i + 1);
Supplier<ITag<Item>> currentIngredient = ingredients.get(i);
Supplier<ITag<Item>> nextIngredient = ingredients.get(i + 1);
result = create(nextEntry).withSuffix("_from_compacting")
.unlockedBy(currentEntry::get)
@ -948,7 +949,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
return this;
}
GeneratedRecipeBuilder unlockedByTag(Supplier<Tag<Item>> tag) {
GeneratedRecipeBuilder unlockedByTag(Supplier<ITag<Item>> tag) {
this.unlockedBy = () -> ItemPredicate.Builder.create()
.tag(tag.get())
.build();
@ -996,7 +997,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
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()));
}

View File

@ -69,7 +69,7 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
@Override
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,
AllGuiTextures.FONT_COLOR);
}

View File

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility;
import java.util.function.Consumer;
import net.minecraft.block.Blocks;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.item.Items;
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.OnlyIn;
import javax.annotation.Nullable;
public class BlockHelper {
@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_) {
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;
}
}
}