mirror of
https://github.com/TicTicBoooom-Mods/MasterfulMachinery.git
synced 2026-01-18 16:37:23 +01:00
Added UV locking for controllers
This commit is contained in:
@@ -21,7 +21,7 @@ apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
version = '1.16.5-0.1.64-B' + getVersionNumber()
|
||||
version = '1.16.5-0.1.65-B' + getVersionNumber()
|
||||
group = 'com.ticticboooom.mods.mm' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'MasterfulMachinery'
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
|
||||
|
||||
@@ -31,14 +31,17 @@ public class ControllerBlock extends HorizontalBlock {
|
||||
private final String controllerId;
|
||||
@Getter
|
||||
private final String texOverride;
|
||||
@Getter
|
||||
private final boolean lockUV;
|
||||
|
||||
public ControllerBlock(RegistryObject<TileEntityType<?>> type, String name, String id, String texOverride) {
|
||||
public ControllerBlock(RegistryObject<TileEntityType<?>> type, String name, String id, String texOverride, boolean lockUV) {
|
||||
super(AbstractBlock.Properties.create(Material.IRON).setRequiresTool().hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestLevel(0)
|
||||
.harvestTool(ToolType.PICKAXE));
|
||||
this.type = type;
|
||||
this.controllerName = name;
|
||||
this.controllerId = id;
|
||||
this.texOverride = texOverride;
|
||||
this.lockUV = lockUV;
|
||||
this.setDefaultState(this.getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,7 @@ public class ControllerBlockEntity extends UpdatableTile implements ITickableTil
|
||||
|
||||
processData.setMsg("Failed to construct \nthe machine");
|
||||
List<MachineStructureRecipe> structures = world.getRecipeManager().getRecipesForType(RecipeTypes.MACHINE_STRUCTURE);
|
||||
// TODO Maybe check if our structure is still matching before finding a new structure?
|
||||
boolean foundStructure = false;
|
||||
|
||||
if (processData.getStructureDefinition().getStructure() != null) {
|
||||
MachineStructureRecipe structure = processData.getStructureDefinition().getStructure();
|
||||
int transformIndex = processData.getStructureDefinition().getTransformIndex();
|
||||
@@ -58,7 +56,6 @@ public class ControllerBlockEntity extends UpdatableTile implements ITickableTil
|
||||
processData.setMsg("Found structure");
|
||||
onStructureFound(structure, transformIndex);
|
||||
foundStructure = true;
|
||||
|
||||
} else {
|
||||
invalidateRecipe();
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public class MMBlockStateProvider extends BlockStateProvider {
|
||||
}
|
||||
dynamicBlockNorthOverlay(controller.getId(), controller.get().getTexOverride() != null ? RLUtils.toRL(controller.get().getTexOverride()) : BASE_TEXTURE, CONTROLLER_TEXTURE);
|
||||
VariantBlockStateBuilder variantBuilder = getVariantBuilder(controller.get());
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.NORTH).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(0).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.SOUTH).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(180).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.EAST).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(90).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.WEST).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(270).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.NORTH).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(0).uvLock(controller.get().isLockUV()).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.SOUTH).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(180).uvLock(controller.get().isLockUV()).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.EAST).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(90).uvLock(controller.get().isLockUV()).addModel();
|
||||
variantBuilder.partialState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.WEST).modelForState().modelFile(new ModelFile.UncheckedModelFile(new ResourceLocation(MM.ID, "block/" + controller.getId().getPath()))).rotationY(270).uvLock(controller.get().isLockUV()).addModel();
|
||||
}
|
||||
|
||||
for (RegistryObject<MachinePortBlock> port : MMLoader.IPORT_BLOCKS) {
|
||||
|
||||
@@ -65,7 +65,6 @@ public class WeatherPortParser extends PortFactory {
|
||||
return new ResourceLocation(MM.ID, "block/compat_ports/astral_starlight_output_cutout");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RegistryObject<MachinePortBlock> registerBlock(String id, DeferredRegister<Block> reg, Registerable<RegistryObject<TileEntityType<?>>> type, String name, String controllerId, String textureOverride, ResourceLocation overlay, ResourceLocation portTypeId) {
|
||||
return super.registerBlock(id, reg, type, name, controllerId, textureOverride, overlay, portTypeId);
|
||||
|
||||
@@ -61,16 +61,21 @@ public class MMLoader {
|
||||
String controllerId = obj.get("controllerId").getAsString();
|
||||
String controllerName = obj.get("name").getAsString();
|
||||
String texOverride = null;
|
||||
boolean lockUV = false;
|
||||
if (obj.has("textureOverride")) {
|
||||
texOverride = obj.get("textureOverride").getAsString();
|
||||
}
|
||||
if (obj.has("lockUV")) {
|
||||
lockUV = obj.get("lockUV").getAsBoolean();
|
||||
}
|
||||
final String textureOverrideFinal = texOverride;
|
||||
final boolean lockUVFinal = lockUV;
|
||||
{
|
||||
Registerable<RegistryObject<TileEntityType<?>>> controllerTile = new Registerable<>();
|
||||
Registerable<RegistryObject<ControllerBlock>> controllerBlock = new Registerable<>();
|
||||
Registerable<RegistryObject<ContainerType<ControllerBlockContainer>>> cont = new Registerable<>();
|
||||
cont.set(MMSetup.CONTAINER_REG.register(controllerId + "_controller", () -> IForgeContainerType.create((i, o, u) -> new ControllerBlockContainer(cont.get().get(), i, o, u))));
|
||||
controllerBlock.set(MMSetup.BLOCKS_REG.register(controllerId + "_controller", () -> new ControllerBlock(controllerTile.get(), controllerName, controllerId, textureOverrideFinal)));
|
||||
controllerBlock.set(MMSetup.BLOCKS_REG.register(controllerId + "_controller", () -> new ControllerBlock(controllerTile.get(), controllerName, controllerId, textureOverrideFinal, lockUVFinal)));
|
||||
controllerTile.set(MMSetup.TILES_REG.register(controllerId + "_controller", () -> TileEntityType.Builder.create(() -> new ControllerBlockEntity(controllerTile.get(), cont.get(), controllerId), controllerBlock.get().get()).build(null)));
|
||||
MMSetup.ITEMS_REG.register(controllerId + "_controller", () -> new BlockItem(controllerBlock.get().get(), new Item.Properties().group(MASTERFUL_ITEM_GROUP)));
|
||||
BLOCKS.add(controllerBlock.get());
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#Tue Jul 12 14:38:10 BST 2022
|
||||
VERSION_CODE=974
|
||||
#Fri Aug 12 14:32:26 UTC 2022
|
||||
VERSION_CODE=989
|
||||
|
||||
Reference in New Issue
Block a user