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.CogwheelBlockItem;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock; 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.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.tterrag.registrate.util.RegistryEntry; import com.tterrag.registrate.util.RegistryEntry;
@ -34,13 +33,6 @@ public class AllBlocksNew {
.build() .build()
.register(); .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) public static final RegistryEntry<SchematicTableBlock> SCHEMATIC_TABLE = REGISTRATE.block("schematic_table", SchematicTableBlock::new)
.initialProperties(() -> Blocks.LECTERN) .initialProperties(() -> Blocks.LECTERN)
.blockstate((ctx, prov) -> prov.horizontalBlock(ctx.getEntry(), prov.models().getExistingFile(ctx.getId()), 0)) .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.List;
import java.util.stream.Collectors; 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.AllBlocks;
import com.simibubi.create.ScreenResources; import com.simibubi.create.ScreenResources;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter; import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter;
@ -41,23 +41,24 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
@Override @Override
public void render(int xPosition, int yPosition, ItemStack ingredient) { public void render(int xPosition, int yPosition, ItemStack ingredient) {
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.translated(xPosition, yPosition, 0); RenderSystem.translated(xPosition, yPosition, 0);
float scale = getScale(recipe); float scale = getScale(recipe);
GlStateManager.scaled(scale, scale, scale); RenderSystem.scaled(scale, scale, scale);
if (ingredient != null) { if (ingredient != null) {
GlStateManager.enableDepthTest(); RenderSystem.enableDepthTest();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enable();
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
FontRenderer font = getFontRenderer(minecraft, ingredient); FontRenderer font = getFontRenderer(minecraft, ingredient);
ItemRenderer itemRenderer = minecraft.getItemRenderer(); ItemRenderer itemRenderer = minecraft.getItemRenderer();
itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0); itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0);
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null); itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
GlStateManager.disableBlend(); RenderSystem.disableBlend();
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
} }
GlStateManager.popMatrix();
RenderSystem.popMatrix();
} }
@Override @Override
@ -149,29 +150,29 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
@Override @Override
public void draw(ShapedRecipe recipe, double mouseX, double mouseY) { public void draw(ShapedRecipe recipe, double mouseX, double mouseY) {
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
float scale = getScale(recipe); 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 row = 0; row < recipe.getHeight(); row++)
for (int col = 0; col < recipe.getWidth(); col++) for (int col = 0; col < recipe.getWidth(); col++)
if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) { if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) {
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.translated((int) col * 19 * scale, (int) row * 19 * scale, 0); RenderSystem.translated((int) col * 19 * scale, (int) row * 19 * scale, 0);
GlStateManager.scaled(scale, scale, scale); RenderSystem.scaled(scale, scale, scale);
ScreenResources.JEI_SLOT.draw(0, 0); ScreenResources.JEI_SLOT.draw(0, 0);
GlStateManager.popMatrix(); RenderSystem.popMatrix();
} }
GlStateManager.popMatrix(); RenderSystem.popMatrix();
ScreenResources.JEI_SLOT.draw(133, 80); ScreenResources.JEI_SLOT.draw(133, 80);
ScreenResources.JEI_DOWN_ARROW.draw(128, 59); ScreenResources.JEI_DOWN_ARROW.draw(128, 59);
ScreenResources.JEI_SHADOW.draw(116, 36); ScreenResources.JEI_SHADOW.draw(116, 36);
crafter.draw(219, 8); crafter.draw(219, 8);
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.translated(0, 0, 200); RenderSystem.translated(0, 0, 200);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
int amount = 0; int amount = 0;
@ -180,10 +181,10 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
continue; continue;
amount++; amount++;
} }
Minecraft.getInstance().fontRenderer Minecraft.getInstance().fontRenderer
.drawStringWithShadow(amount + "", 142, 39, 0xFFFFFF); .drawStringWithShadow(amount + "", 142, 39, 0xFFFFFF);
RenderHelper.enableStandardItemLighting(); RenderSystem.popMatrix();
GlStateManager.popMatrix();
} }
@Override @Override

View file

@ -12,6 +12,7 @@ import com.google.common.collect.Sets;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.advancement.AllTriggers;
@ -132,7 +133,7 @@ public class CreateAdvancements implements IDataProvider {
void kineticsBranch(Consumer<Advancement> t, Advancement root) { void kineticsBranch(Consumer<Advancement> t, Advancement root) {
String id = Create.ID; 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) .withParent(root)
.withCriterion("0", AllTriggers.ROTATION.instance()) .withCriterion("0", AllTriggers.ROTATION.instance())
.register(t, id + ":its_alive"); .register(t, id + ":its_alive");
@ -158,7 +159,7 @@ public class CreateAdvancements implements IDataProvider {
.withParent(goggles) .withParent(goggles)
.register(t, id + ":stress_gauge"); .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) .withParent(its_alive)
.withCriterion("0", AllTriggers.SHIFTING_GEARS.instance()) .withCriterion("0", AllTriggers.SHIFTING_GEARS.instance())
.register(t, id + ":shifting_gears"); .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, public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) { BlockRayTraceResult hit) {
if (player != null && AllItems.WRENCH.typeOf(player.getHeldItem(handIn))) if (player != null && AllItems.WRENCH.typeOf(player.getHeldItem(handIn)))
return false; return ActionResultType.PASS;
DistExecutor.runWhenOn(Dist.CLIENT, DistExecutor.runWhenOn(Dist.CLIENT,
() -> () -> withTileEntityDo(worldIn, pos, te -> this.displayScreen(te, player))); () -> () -> withTileEntityDo(worldIn, pos, te -> this.displayScreen(te, player)));
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;

View file

@ -59,7 +59,7 @@ public class CrateBlock extends ProperDirectionalBlock implements IWrenchable {
BlockPos pos = context.getPos(); BlockPos pos = context.getPos();
World world = context.getWorld(); World world = context.getWorld();
if (!context.isPlacerSneaking()) { if (!context.getPlayer().isSneaking()) {
for (Direction d : Direction.values()) { for (Direction d : Direction.values()) {
BlockState state = world.getBlockState(pos.offset(d)); BlockState state = world.getBlockState(pos.offset(d));
if (state.getBlock() == this && !state.get(DOUBLE)) 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 java.util.Optional;
import com.simibubi.create.AllBlocks; 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;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part;
import com.simibubi.create.modules.contraptions.relays.belt.item.BeltConnectorItem; 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); BlockPos offset = BeltBlock.nextSegmentPosition(state, BlockPos.ZERO, isStart);
int i = length - 1; int i = length - 1;
Axis axis = state.get(BeltBlock.HORIZONTAL_FACING).rotateY().getAxis(); 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 BeltConnectorItem
.createBelts(world, target, target.add(offset.getX() * i, offset.getY() * i, offset.getZ() * i)); .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.LinkedList;
import java.util.List; import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew; import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
@ -151,7 +152,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (!world.isBlockPresent(pos.offset(facing))) if (!world.isBlockPresent(pos.offset(facing)))
continue; 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; hasCreativeCrate = true;
} }
@ -503,7 +504,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
} }
if (!isLastSegment) if (!isLastSegment)
blockState = (blockState.get(BeltBlock.PART) == Part.MIDDLE) ? Blocks.AIR.getDefaultState() 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; return blockState;
} }
@ -599,10 +600,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
int amountFound = 0; int amountFound = 0;
for (IItemHandler iItemHandler : attachedInventories) { for (IItemHandler iItemHandler : attachedInventories) {
amountFound += ItemHelper amountFound += ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s),
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, ExtractionCountMode.UPTO, required.getCount(), true).getCount();
required.getCount(), true)
.getCount();
if (amountFound < required.getCount()) if (amountFound < required.getCount())
continue; continue;
@ -615,10 +614,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (!simulate && success) { if (!simulate && success) {
int amountFound = 0; int amountFound = 0;
for (IItemHandler iItemHandler : attachedInventories) { for (IItemHandler iItemHandler : attachedInventories) {
amountFound += ItemHelper amountFound += ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s),
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, ExtractionCountMode.UPTO, required.getCount(), false).getCount();
required.getCount(), false)
.getCount();
if (amountFound < required.getCount()) if (amountFound < required.getCount())
continue; continue;
break; break;
@ -665,16 +662,14 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
public void finishedPrinting() { public void finishedPrinting() {
inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setStackInSlot(0, ItemStack.EMPTY);
inventory inventory.setStackInSlot(1,
.setStackInSlot(1, new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1));
new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1));
state = State.STOPPED; state = State.STOPPED;
statusMsg = "finished"; statusMsg = "finished";
resetPrinter(); resetPrinter();
target = getPos().add(1, 0, 0); target = getPos().add(1, 0, 0);
world world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(),
.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(), SoundCategory.BLOCKS, 1, .7f);
SoundCategory.BLOCKS, 1, .7f);
sendUpdate = true; sendUpdate = true;
} }
@ -830,9 +825,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
} }
public void playFiringSound() { public void playFiringSound() {
world world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(),
.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(), SoundCategory.BLOCKS, .1f, 1.1f);
SoundCategory.BLOCKS, .1f, 1.1f);
} }
public void sendToContainer(PacketBuffer buffer) { public void sendToContainer(PacketBuffer buffer) {
@ -896,7 +890,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
} }
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {} public void addBehaviours(List<TileEntityBehaviour> behaviours) {
}
@Override @Override
public void lazyTick() { public void lazyTick() {