Ported new changes to 1.15

This commit is contained in:
simibubi 2020-05-11 00:48:58 +02:00
parent 901c530f62
commit e69af69b0a
7 changed files with 42 additions and 52 deletions

View file

@ -8,7 +8,6 @@ import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.tterrag.registrate.util.RegistryEntry;
@ -34,13 +33,6 @@ public class AllBlocksNew {
.build()
.register();
public static final RegistryEntry<CreativeCrateBlock> CREATIVE_CRATE = REGISTRATE.block("creative_crate", CreativeCrateBlock::new)
.initialProperties(() -> Blocks.CHEST)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), prov.models().getExistingFile(ctx.getId())))
.simpleItem()
.register();
public static final RegistryEntry<SchematicTableBlock> SCHEMATIC_TABLE = REGISTRATE.block("schematic_table", SchematicTableBlock::new)
.initialProperties(() -> Blocks.LECTERN)
.blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models().getExistingFile(ctx.getId()), 0))

View file

@ -5,7 +5,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter;
@ -41,23 +41,24 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
@Override
public void render(int xPosition, int yPosition, ItemStack ingredient) {
GlStateManager.pushMatrix();
GlStateManager.translated(xPosition, yPosition, 0);
RenderSystem.pushMatrix();
RenderSystem.translated(xPosition, yPosition, 0);
float scale = getScale(recipe);
GlStateManager.scaled(scale, scale, scale);
RenderSystem.scaled(scale, scale, scale);
if (ingredient != null) {
GlStateManager.enableDepthTest();
RenderHelper.enableGUIStandardItemLighting();
RenderSystem.enableDepthTest();
RenderHelper.enable();
Minecraft minecraft = Minecraft.getInstance();
FontRenderer font = getFontRenderer(minecraft, ingredient);
ItemRenderer itemRenderer = minecraft.getItemRenderer();
itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0);
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
GlStateManager.disableBlend();
RenderSystem.disableBlend();
RenderHelper.disableStandardItemLighting();
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
@Override
@ -149,29 +150,29 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
@Override
public void draw(ShapedRecipe recipe, double mouseX, double mouseY) {
GlStateManager.pushMatrix();
RenderSystem.pushMatrix();
float scale = getScale(recipe);
GlStateManager.translated(getXPadding(recipe), getYPadding(recipe), 0);
RenderSystem.translated(getXPadding(recipe), getYPadding(recipe), 0);
for (int row = 0; row < recipe.getHeight(); row++)
for (int col = 0; col < recipe.getWidth(); col++)
if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) {
GlStateManager.pushMatrix();
GlStateManager.translated((int) col * 19 * scale, (int) row * 19 * scale, 0);
GlStateManager.scaled(scale, scale, scale);
RenderSystem.pushMatrix();
RenderSystem.translated((int) col * 19 * scale, (int) row * 19 * scale, 0);
RenderSystem.scaled(scale, scale, scale);
ScreenResources.JEI_SLOT.draw(0, 0);
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
ScreenResources.JEI_SLOT.draw(133, 80);
ScreenResources.JEI_DOWN_ARROW.draw(128, 59);
ScreenResources.JEI_SHADOW.draw(116, 36);
crafter.draw(219, 8);
GlStateManager.pushMatrix();
GlStateManager.translated(0, 0, 200);
RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 200);
RenderHelper.disableStandardItemLighting();
int amount = 0;
@ -180,10 +181,10 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
continue;
amount++;
}
Minecraft.getInstance().fontRenderer
.drawStringWithShadow(amount + "", 142, 39, 0xFFFFFF);
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
@Override

View file

@ -12,6 +12,7 @@ import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllItems;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.advancement.AllTriggers;
@ -132,7 +133,7 @@ public class CreateAdvancements implements IDataProvider {
void kineticsBranch(Consumer<Advancement> t, Advancement root) {
String id = Create.ID;
Advancement its_alive = advancement("its_alive", AllBlocks.COGWHEEL.get(), TaskType.NORMAL)
Advancement its_alive = advancement("its_alive", AllBlocksNew.COGWHEEL.get(), TaskType.NORMAL)
.withParent(root)
.withCriterion("0", AllTriggers.ROTATION.instance())
.register(t, id + ":its_alive");
@ -158,7 +159,7 @@ public class CreateAdvancements implements IDataProvider {
.withParent(goggles)
.register(t, id + ":stress_gauge");
Advancement shifting_gears = advancement("shifting_gears", AllBlocks.LARGE_COGWHEEL.get(), TaskType.NORMAL)
Advancement shifting_gears = advancement("shifting_gears", AllBlocksNew.LARGE_COGWHEEL.get(), TaskType.NORMAL)
.withParent(its_alive)
.withCriterion("0", AllTriggers.SHIFTING_GEARS.instance())
.register(t, id + ":shifting_gears");

View file

@ -87,7 +87,7 @@ public class StockswitchBlock extends HorizontalBlock implements ITE<Stockswitch
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
if (player != null && AllItems.WRENCH.typeOf(player.getHeldItem(handIn)))
return false;
return ActionResultType.PASS;
DistExecutor.runWhenOn(Dist.CLIENT,
() -> () -> withTileEntityDo(worldIn, pos, te -> this.displayScreen(te, player)));
return ActionResultType.SUCCESS;

View file

@ -59,7 +59,7 @@ public class CrateBlock extends ProperDirectionalBlock implements IWrenchable {
BlockPos pos = context.getPos();
World world = context.getWorld();
if (!context.isPlacerSneaking()) {
if (!context.getPlayer().isSneaking()) {
for (Direction d : Direction.values()) {
BlockState state = world.getBlockState(pos.offset(d));
if (state.getBlock() == this && !state.get(DOUBLE))

View file

@ -3,6 +3,7 @@ package com.simibubi.create.modules.schematics.block;
import java.util.Optional;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part;
import com.simibubi.create.modules.contraptions.relays.belt.item.BeltConnectorItem;
@ -151,7 +152,7 @@ public abstract class LaunchedItem {
BlockPos offset = BeltBlock.nextSegmentPosition(state, BlockPos.ZERO, isStart);
int i = length - 1;
Axis axis = state.get(BeltBlock.HORIZONTAL_FACING).rotateY().getAxis();
world.setBlockState(target, AllBlocks.SHAFT.getDefault().with(ShaftBlock.AXIS, axis));
world.setBlockState(target, AllBlocksNew.getDefault(AllBlocksNew.SHAFT).with(ShaftBlock.AXIS, axis));
BeltConnectorItem
.createBelts(world, target, target.add(offset.getX() * i, offset.getY() * i, offset.getZ() * i));
}

View file

@ -3,6 +3,7 @@ package com.simibubi.create.modules.schematics.block;
import java.util.LinkedList;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents;
@ -151,7 +152,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (!world.isBlockPresent(pos.offset(facing)))
continue;
if (AllBlocksNew.CREATIVE_CRATE.get() == world.getBlockState(pos.offset(facing)).getBlock()) {
if (AllBlocks.CREATIVE_CRATE.get() == world.getBlockState(pos.offset(facing)).getBlock()) {
hasCreativeCrate = true;
}
@ -503,7 +504,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
}
if (!isLastSegment)
blockState = (blockState.get(BeltBlock.PART) == Part.MIDDLE) ? Blocks.AIR.getDefaultState()
: AllBlocks.SHAFT.getDefault().with(ShaftBlock.AXIS, facing.rotateY().getAxis());
: AllBlocksNew.getDefault(AllBlocksNew.SHAFT).with(ShaftBlock.AXIS, facing.rotateY().getAxis());
return blockState;
}
@ -599,10 +600,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
int amountFound = 0;
for (IItemHandler iItemHandler : attachedInventories) {
amountFound += ItemHelper
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), true)
.getCount();
amountFound += ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s),
ExtractionCountMode.UPTO, required.getCount(), true).getCount();
if (amountFound < required.getCount())
continue;
@ -615,10 +614,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (!simulate && success) {
int amountFound = 0;
for (IItemHandler iItemHandler : attachedInventories) {
amountFound += ItemHelper
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), false)
.getCount();
amountFound += ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s),
ExtractionCountMode.UPTO, required.getCount(), false).getCount();
if (amountFound < required.getCount())
continue;
break;
@ -665,16 +662,14 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
public void finishedPrinting() {
inventory.setStackInSlot(0, ItemStack.EMPTY);
inventory
.setStackInSlot(1,
new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1));
inventory.setStackInSlot(1,
new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1));
state = State.STOPPED;
statusMsg = "finished";
resetPrinter();
target = getPos().add(1, 0, 0);
world
.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(),
SoundCategory.BLOCKS, 1, .7f);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(),
SoundCategory.BLOCKS, 1, .7f);
sendUpdate = true;
}
@ -830,9 +825,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
}
public void playFiringSound() {
world
.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(),
SoundCategory.BLOCKS, .1f, 1.1f);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(),
SoundCategory.BLOCKS, .1f, 1.1f);
}
public void sendToContainer(PacketBuffer buffer) {
@ -896,7 +890,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
}
@Override
public void lazyTick() {